Repository navigation
feat(runtime): implement buffer CreateShaderResourceView (raw, structured, typed GFX10 V#) - #1773
Conversation
|
AI-assisted independent verification of The exact stock
I ran the adapters serially, using one process-local ICD manifest per run, an empty implicit-layer search path, and explicit Both GPUs produced the same readbacks through an SRV descriptor table and the ordinary
Both offset selections changed all 32 loaded dwords relative to their respective zero-offset selections. The entire input buffer was initialized. I checked the GLSL and generated SPIR-V for the raw byte-range and structured/typed record-count branches. Inactive lanes write zero without issuing a source load. The shader reads the first stored dword at each calculated address. CPU decoding separately confirmed RGBA32F's The disposable fixture used ordinary heap handles and an SRV root range. It omitted the Xbox-ABI calls, legacy CBV/code-base dispatches and lifetime checks, rejected root signature/PSO/command calls, all seven invalid/null/refused SRV creations, and the null dispatch. The tested command list used a single queue. This verifies the positive path for Vonsek’s D3D-229 claim. #1779 overlaps on buffer SRVs. |
dcastell1
left a comment
There was a problem hiding this comment.
Built the runtime from this tree and ran it on the RTX 5090 (621.24, Windows 11):
1/1 Test #86: d3d12_compute ... Passed 0.37 sec
The buffer-SRV path goes through the compute test with the same shader the game uses for user data, so this is the right shape to prove the view reaches the shader as a typed buffer rather than a raw one. No concerns.
|
Tested 1847263 on RTX 4070 SUPER (NVIDIA 616.64) and Intel UHD 770 (101.7092), Windows 11, MSVC 19.44: pass This adds an Intel Xe-LP iGPU and the validation layers to the runs above.
|
|
Tested on Windows 11 with two GPUs on one machine (runtime built from this PR's head, MSVC 14.51): no regression from this PR. RTX 4080 SUPER: 100/101 pass. |
|
Rebased Tested the rebased head on NVIDIA GeForce RTX 3070, driver 621.01, Vulkan 1.4.357, Windows 11 x64, with
This also confirms the approach is the right one after #1779 was reverted: #1779's placeholder records clashed with #1729's CBV, while this PR writes the GFX10 V# words directly. No game data used. AI-assisted. |
|
Tested
No regression against AI-assisted (Claude Code). |
|
RDNA3 run: pass. Tested |
|
Rebased onto current
TestedWindows 11 x64, NVIDIA GeForce RTX 3070, driver 621.01, Vulkan 1.4.357,
No validation messages. The branch is ready if you want to update the PR head; I have not pushed to your branch. |
…ured, typed GFX10 V#) Implement D3D12_SRV_DIMENSION_BUFFER in ID3D12Device::CreateShaderResourceView, writing a 16-byte GFX10 V# descriptor into the 32-byte CBV_SRV_UAV slot: - Raw (D3D12_BUFFER_SRV_FLAG_RAW, R32_TYPELESS, stride 0): OobSelect::raw, num_records = NumElements * 4, GFX10_FORMAT_32_UINT. - Structured (StructureByteStride > 0, DXGI_FORMAT_UNKNOWN): OobSelect::structured, stride = StructureByteStride, num_records = NumElements, GFX10_FORMAT_32_UINT. - Typed (stride 0, uncompressed color format incl. RGB96): OobSelect::structured, stride = element bytes, num_records = NumElements, format_from_vulkan(named), Shader4ComponentMapping applied to format_swizzle(named). - Rejects DENY_SHADER_RESOURCE, null desc on buffer, invalid format/stride/flag combinations, and out-of-bounds ranges (leaving the 32-byte slot zeroed). AI-assisted.
|
Rebased cleanly onto Re-verified on
|
1847263 to
07e2293
Compare
Claimed in the coordination issue as: claim
What and why
ID3D12Device::CreateShaderResourceViewpreviously hitif (!r->image()) return stub("ID3D12Device::CreateShaderResourceView(buffer)");, leaving descriptor heap slots zeroed for all buffer SRVs (rawByteAddressBuffer,StructuredBuffer, and typedBuffer<T>).This implements
D3D12_SRV_DIMENSION_BUFFERinruntime/shims/d3d12_vulkan_device.cpp:D3D12_RESOURCE_FLAG_DENY_SHADER_RESOURCEguard ahead of the buffer branch so it applies to buffers as well as textures.leonida::gfx10::encode(Buffer)into the first half of the 32-byte slot (trailing 16 bytes zeroed):D3D12_BUFFER_SRV_FLAG_RAW,DXGI_FORMAT_R32_TYPELESS,StructureByteStride == 0):stride = 0,num_records = NumElements * 4,GFX10_FORMAT_32_UINT,OobSelect::raw.StructureByteStride > 0,DXGI_FORMAT_UNKNOWN,stride <= 16383):stride = StructureByteStride,num_records = NumElements,GFX10_FORMAT_32_UINT,OobSelect::structured.StructureByteStride == 0, uncompressed color format includingR32G32B32_*RGB96):stride = element bytes,num_records = NumElements,format_from_vulkan(named),Shader4ComponentMappingapplied toformat_swizzle(named),OobSelect::structured.nullptrdesc on buffer,DENY_SHADER_RESOURCE, invalid format/stride/flag combinations, and out-of-boundsFirstElement/NumElementspastrd.Width(leaving all 32 bytes zeroed as a null V#).Reproduction before the fix
Running the new test in
d3d12_compute_test.exeagainst unmodifiedupstream/main(89b047cd) logged[rt] d3d12: unimplemented ID3D12Device::CreateShaderResourceView(buffer)and failed (exit=1) because the descriptor slot remained zeroed.Tested
Commit
18472630onupstream/main89b047cd, Windows 11, MSVC 19.44, Ninja,VK_LOADER_LAYERS_DISABLE=~implicit~(synthetic scene only; no game data):616.92, Vulkan1.4.351):d3d12_compute_test.exe: PASS (exit=0)gfx10::decoderound-trip verified for raw (slots 1–2), structured (slots 3–4), typedR32G32B32A32_FLOATwith customB,G,R,1Shader4ComponentMapping(slot 5), and typed RGB96R32G32B32_FLOAT(stride = 12, slot 6), plus 7 invalid/null cases leaving all 32 bytes zeroed.CBV_SRV_UAVdescriptor table (SetComputeRootDescriptorTable):FirstElement = 0, NumElements = 32): 32 in-bounds dwords matched + 32 OOB-zero dwords.stride = 16, FirstElement = 0, NumElements = 32): 32 in-bounds structs matched + 32 OOB-zero.R32G32B32A32_FLOAT, FirstElement = 8, NumElements = 24): 24 in-bounds elements matched + 40 OOB-zero.FirstElement = 64) flipped 32/32 in-bounds dwords; Structured B (FirstElement = 16) flipped 32/32 in-bounds elements; Null/refused SRV flipped 32/32 in-bounds dwords to0.26.10.1, Vulkan1.4.315):d3d12_compute_test.exe: PASS (exit=0) — exact same positive, OOB, and negative-control results.VK_LAYER_KHRONOS_validationis not installed locally; CI runs Vulkan validation on this commit.Checklist
docs/design.md, with how it was confirmed. (No translator change.)AI Assisted.