Raw twins of views off dwords are moved there too, not null
4.6 twins a frame of run crash-3 were null because they begin off a dword (16 bit values at an odd one); the typed view they stand for begins there as well. Measured (raw_loads_past_views): a raw view moved on by 8 bytes gives the bytes from there and ends where it should, uniform and per lane. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
6ee5b724e5
commit
6fa0bbe02f
2 files changed
+42
-5
No files matched your search
@@ -1035,7 +1035,7 @@ void main(uint3 id : SV_DispatchThreadID, uint g : SV_GroupIndex) {
|
||||
gpu.device.GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV) as usize,
|
||||
)
|
||||
};
|
||||
let names = ["raw", "structured 24 at 24", "structured 16", "typed u32", "typed u16", "typed 4 x u32", "constant buffer", "null raw"];
|
||||
let names = ["raw", "structured 24 at 24", "structured 16", "typed u32", "typed u16", "typed 4 x u32", "constant buffer", "raw, moved to 8"];
|
||||
let view = |i: usize, format: i32, first: u64, count: u32, stride: u32, raw: bool, null: bool| {
|
||||
let desc = D3D12_SHADER_RESOURCE_VIEW_DESC {
|
||||
Format: DXGI_FORMAT(format),
|
||||
@@ -1061,7 +1061,42 @@ void main(uint3 id : SV_DispatchThreadID, uint g : SV_GroupIndex) {
|
||||
view(base + 3, 42, 0, 1024, 0, false, false);
|
||||
view(base + 4, 57, 0, 2048, 0, false, false);
|
||||
view(base + 5, 3, 0, 256, 0, false, false);
|
||||
view(base + 7, 39, 0, 1, 0, true, true);
|
||||
// 1,024 dwords from 0 made in a heap the card does not see, moved
|
||||
// on by 8 bytes (`descriptor::host::move_raw`), copied in.
|
||||
// SAFETY: plain heap creation, slots of live heaps.
|
||||
unsafe {
|
||||
let beside: ID3D12DescriptorHeap = gpu
|
||||
.device
|
||||
.CreateDescriptorHeap(&D3D12_DESCRIPTOR_HEAP_DESC {
|
||||
Type: D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV,
|
||||
NumDescriptors: 1,
|
||||
..Default::default()
|
||||
})
|
||||
.unwrap();
|
||||
let at = beside.GetCPUDescriptorHandleForHeapStart();
|
||||
let desc = D3D12_SHADER_RESOURCE_VIEW_DESC {
|
||||
Format: DXGI_FORMAT(39),
|
||||
ViewDimension: D3D12_SRV_DIMENSION_BUFFER,
|
||||
Shader4ComponentMapping: D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING,
|
||||
Anonymous: D3D12_SHADER_RESOURCE_VIEW_DESC_0 {
|
||||
Buffer: D3D12_BUFFER_SRV {
|
||||
FirstElement: 0,
|
||||
NumElements: 1024,
|
||||
StructureByteStride: 0,
|
||||
Flags: D3D12_BUFFER_SRV_FLAG_RAW,
|
||||
},
|
||||
},
|
||||
};
|
||||
gpu.device.CreateShaderResourceView(&buffer, Some(&desc), at);
|
||||
let moved = crate::descriptor::host::move_raw(at, buffer.GetGPUVirtualAddress(), 4096, 8);
|
||||
println!("the raw view was moved: {moved}");
|
||||
gpu.device.CopyDescriptorsSimple(
|
||||
1,
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE { ptr: cpu + (base + 7) * step },
|
||||
at,
|
||||
D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV,
|
||||
);
|
||||
}
|
||||
let desc = D3D12_CONSTANT_BUFFER_VIEW_DESC {
|
||||
// SAFETY: a live buffer.
|
||||
BufferLocation: unsafe { buffer.GetGPUVirtualAddress() },
|
||||
|
||||
Reference in new issue
Block a user