Shaders: normalized buffer codes give the nearest float, cube gradients take DXIL's base-2 logarithm, d16 data of integer views keeps its bits, unordered views of vertex programs are declared

- VIctory da82e444: the host's division was a step off for some codes, and a
  material index cut from one was the code below.
- DexNom/VIctory 921d8d3b (its cube part, with its test): the level was taken
  from a natural logarithm DXIL does not have, 1.44 times too high; the
  instruction's least level was lost.
- VIctory 4243a96a, for buffers a program picks from the heap.
- VIctory a1a2077a.
Every shader is translated anew.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
localandClaude Opus 5.5 committed 2026-11-25 10:50:14 -06:00
1 parent 1cfc476831
commit 31f662bc9b
9 files changed
+501 -36

No files matched your search

+20
View File
@@ -24,6 +24,14 @@ pub const ROOT_CBV_SPACE: u32 = 1;
/// root SRV also tells the host that the buffer views of the whole heap
/// must be ready when it runs, not only those its tables name.
pub const SLOT_STRIDES: u8 = 255;
/// The bits of a [`SLOT_STRIDES`] dword that hold the stride.
pub const VIEW_STRIDE_BITS: u32 = (1 << 30) - 1;
/// In a [`SLOT_STRIDES`] dword: a typed buffer view of an integer format
/// (`UINT` or `SINT`), whose 16-bit typed accesses (`_d16`) pass bits.
/// (After VIctory 4243a96a.)
pub const VIEW_INTEGER: u32 = 1 << 31;
/// With [`VIEW_INTEGER`]: a signed (`SINT`) format.
pub const VIEW_SIGNED: u32 = 1 << 30;
/// Dwords of the [`SLOT_STRIDES`] buffer: heap indices are clamped to it.
pub const SLOT_STRIDES_COUNT: u32 = 1 << 21;
@@ -93,6 +101,8 @@ pub(crate) mod flags {
pub const DOUBLES: u64 = 1 << 2;
pub const STENCIL_REF: u64 = 1 << 11;
pub const TYPED_UAV_LOADS: u64 = 1 << 13;
/// Unordered views in a vertex, geometry or mesh program.
pub const UAVS_EVERY_STAGE: u64 = 1 << 16;
pub const ROVS: u64 = 1 << 18;
pub const WAVE_OPS: u64 = 1 << 19;
pub const BARYCENTRICS: u64 = 1 << 22;
@@ -557,6 +567,13 @@ impl Shader {
}
}
}
// Unordered views outside pixel and compute programs (memory by
// address), as DXC counts them: ranges declared below, not views
// picked from the heap (VIctory a1a2077a).
let compute = self.threads.is_some() && self.mesh.is_none() && self.geometry.is_none();
if !self.root_uavs.is_empty() && !self.pixel && !compute {
self.flags |= flags::UAVS_EVERY_STAGE;
}
let mut resources = None;
let mut bindings = Vec::new();
let i32c = |s: &mut Self, v: u32| {
@@ -871,6 +888,9 @@ impl Shader {
if self.flags & flags::DOUBLES != 0 {
features |= 0x1;
}
if self.flags & flags::UAVS_EVERY_STAGE != 0 {
features |= 0x4;
}
if self.flags & flags::STENCIL_REF != 0 {
features |= 0x200;
}