Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions crates/xcl/src/gpu/dxil/geometry_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,23 @@ fn geometry_forms_validate() {
}
}

/// A GS that reads its ES inputs (v9..) translates with the windows in the descriptor heap:
/// `mems` only counts them there, the inputs come from window 0's view in the heap.
#[test]
fn geometry_inputs_with_heap_windows_validate() {
let (mut code, mut g) = branchy_program();
// v53 = v9 (input 0, x) before the GS ends: the inputs are fetched
let end = code.len() - 8;
let mv = encode("V_MOV_B32", "ENC_VOP1", &[("VDST", 53), ("SRC0", 256 + 9)], None).unwrap();
code.splice(end..end, mv);
g.es_inputs = vec![sig("TEXCOORD", 0, 0, 3)];
for split in [false, true] {
for windows in [1, 4, 4 | crate::gpu::recomp::HEAP_WINDOWS] {
translate_geometry(&code, opts(split, windows), &g).unwrap_or_else(|e| panic!("split {split}, windows {windows:#x}: {e}"));
}
}
}

/// The records of `branchy_program` for `prims` primitives: (group, record dwords).
fn expected_records(g: &GsInterface, prims: usize) -> Vec<u32> {
let rec = g.record();
Expand Down
9 changes: 8 additions & 1 deletion crates/xcl/src/gpu/dxil/kernel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,14 @@ fn geom_init(lw: &mut Lw, g: &GsInterface, _tid: Value, io: super::shader::RawUa
let nreg = g.input_registers();
let fetched = fetched_registers(&g.es_inputs);
let in_nv = lw.cmp(Pred::ULt, lane, nv);
let mem = lw.mems[0];
// window 0; with the windows in the descriptor heap `mems` only counts them (`mem_windows`)
let mem = match lw.heap_mem {
Some(coherent) => {
let i = lw.c(crate::gpu::recomp::MEM_HEAP_BASE);
lw.s.heap_raw_buffer_uav(i, coherent)
}
None => lw.mems[0],
};
for &v in used.iter().filter(|&&v| (9..256).contains(&v)) {
let k = ((v - 9) / 4) as usize;
if k >= fetched.len() || fetched[k] >= nreg {
Expand Down
Loading