Addresses of ray-tracing structures: views of a structure have no buffer

A shader that walks a structure takes its address out of the structure's
descriptor. The view has no resource, so the address came out 0 and every
ray missed. Also: only programs that store by raw address declare the
copies they reach that way as written.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
localandClaude Opus 5.5 committed 2026-11-25 00:00:08 -06:00
1 parent 0b5f191b86
commit ba509c5a70
3 files changed
+75 -11

No files matched your search

+14
View File
@@ -1649,6 +1649,20 @@ pub(crate) fn buffer_range(view: &View) -> Option<(u64, u64)> {
))
}
/// The address a shader finds in a descriptor of title memory: where a
/// buffer view starts, or the ray-tracing structure of a structure's view
/// (no resource: the view's description holds the address, and the shader
/// walks the structure from there itself).
pub(crate) fn view_address(view: &View) -> Option<u64> {
const STRUCTURE: u32 = D3D12_SRV_DIMENSION_RAYTRACING_ACCELERATION_STRUCTURE.0 as u32;
match view {
View::Shader(_, Some(desc)) if desc[1] == STRUCTURE => {
Some(u64::from(desc[4]) | u64::from(desc[5]) << 32)
}
_ => buffer_range(view).map(|range| range.0),
}
}
/// The title memory the host slot of buffer view `view` is made on
/// (address, bytes): the whole buffer the view is of, which is what
/// [`make`] finds the host copy by. [`buffer_range`] is the part of it the