Structure builder and rays: dispatches counted in threads, empty slots never entered, pages that are not there never hit; vertex signatures as DXC orders them

From DexNom/VIctory (GPL-3.0-or-later) bc3cd4b0 and 5f4c3df4:
- DispatchX's flag 0x20 says the counts are threads (bc3cd4b0). Taken for
  groups, a rehydration stage ran up to 64 times its threads and stored over
  the structures after its own. The lanes past the count leave at once, in
  every builder program of one dimension without a group barrier (there: in
  two, by digest). VICTORY_THREAD_DIMENSIONS=0: as before.
- A child that is not there may have inverted infinite bounds: it was entered
  at minus infinity, came first and ended the walk (bc3cd4b0).
- A node in a page without a copy reads zeros, a child and a box: no hit
  (bc3cd4b0).
- Signature rows in the order of their names; vertex outputs interpolated as
  the title's PSV0 says; an unread input packed beside a per-vertex one is
  constant too (5f4c3df4), with their tests.
Every shader is translated again.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
localandClaude Opus 5.5 committed 2026-11-25 09:39:18 -06:00
1 parent 972bb4b0f8
commit 810efe5829
11 files changed
+443 -44

No files matched your search

+56 -2
View File
@@ -72,7 +72,7 @@ pub(crate) fn signature(elements: &[SigElement], input: bool) -> Vec<u8> {
// Validator 1.6 writes one name per element in element order, repeats
// included, except that system values share theirs (it keys names by
// the semantic's string, which is one static string per system value);
// the rows sorted by register (unallocated last).
// the rows sorted by register (unallocated last), then name offset.
let mut offsets: Vec<u32> = Vec::new();
let mut next = 8 + 32 * elements.len() as u32;
let mut names = Vec::new();
@@ -90,7 +90,7 @@ pub(crate) fn signature(elements: &[SigElement], input: bool) -> Vec<u8> {
}
}
let mut order: Vec<usize> = (0..elements.len()).collect();
order.sort_by_key(|&i| (elements[i].row.unwrap_or(u32::MAX), elements[i].col));
order.sort_by_key(|&i| (elements[i].row.unwrap_or(u32::MAX), offsets[i]));
for i in order {
let (e, offset) = (&elements[i], offsets[i]);
let used = e.usage << e.col;
@@ -419,6 +419,60 @@ fn md5_block(state: &mut [u32; 4], block: &[u8; 64]) {
mod tests {
use super::*;
#[test]
fn packed_vertex_outputs_preserve_name_order_and_declared_interpolation() {
let integer = SigElement {
name: "TEXCOORD".into(),
index: 1,
kind: 0,
comp: 5,
interp: 1,
row: Some(0),
col: 2,
cols: 2,
usage: 3,
half: false,
};
let flat_float = SigElement {
name: "COLOR".into(),
index: 0,
comp: 9,
col: 0,
..integer.clone()
};
let smooth_float = SigElement {
index: 2,
row: Some(1),
interp: 2,
comp: 9,
..integer.clone()
};
let outputs = [integer, flat_float, smooth_float];
let mut recovered = super::super::signature(&signature(&outputs, false)).unwrap();
// DXC orders the row by semantic-name offset even though TEXCOORD
// occupies z/w and COLOR occupies x/y.
assert_eq!(recovered[0].name, "TEXCOORD");
assert_eq!(recovered[1].name, "COLOR");
// PSV records can be in a different order again.
let psv = psv(&Psv {
stage: 1,
flag: false,
inputs: &[],
outputs: &[outputs[2].clone(), outputs[1].clone(), outputs[0].clone()],
prims: &[],
mesh: None,
geometry: None,
bindings: &[],
threads: [0; 3],
wave_size: None,
});
recovered[1].interp = 2;
super::super::vertex_output_interpolation(&psv, &mut recovered).unwrap();
assert_eq!(recovered.iter().map(|e| e.interp).collect::<Vec<_>>(), [1, 1, 2]);
assert!(super::super::vertex_output_interpolation(&psv[..psv.len() - 1], &mut recovered)
.is_err());
}
#[test]
fn md5_core_matches_the_standard() {
// Standard MD5 of "abc" with standard padding, through md5_block.