Repository navigation
Conversation
…fines The index buffer was bound without a size into the GPU address arena, so an index past the view read whatever followed it there, and a draw with no index buffer read past the zero page. D3D12 reads such an index as 0. Where the device has VK_KHR_maintenance5 and robustBufferAccess2, the index buffer is now bound with vkCmdBindIndexBuffer2 and the view's size (the zero page with its own size when none is bound), and robustBufferAccess2 is enabled at device creation. Both are needed for the read to be defined, so with either missing the old unsized bind is kept, with a log line. d3d12_ia_bounds compares nine cases with the PC runtime: indices past R16 and R32 views, vertices past a view, a view ending inside a vertex, no index buffer with a count past the zero page, and in-range controls. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
Tested on an NVIDIA GeForce RTX 5090 (Windows 11, driver 621.24, Vulkan SDK 1.4.363.0), |
|
Tested 9030146 merged onto main 1628210 on an RTX 5090 (driver 616.92), Windows 11, MSVC 19.44, Vulkan SDK 1.4.363, RelWithDebInfo:
AI-assisted (Claude Code). |
|
Tested
Not checked: a driver that zeroes the whole partial vertex (the gfx1036 / 23.40 case this is for), an input layout with more attributes than |
… element (D3D-353) D3D12 bounds a vertex read per input element: a view that ends inside a vertex keeps the elements before its end and zeroes the rest. Vulkan's robustBufferAccess2 may treat every attribute of a binding as out of range when one is, and AMD's 23.40 driver on an RDNA2 iGPU zeroed the whole vertex in d3d12_ia_bounds case E. The layer now gives each attribute its own binding: the slot's buffer from the element's offset on, the attribute at offset 0, so the binding's range is the element's. An element at or past the view's end binds the zero page. A layout with more attributes than maxVertexInputBindings keeps one binding per slot. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
9030146 to
6cf0672
Compare
|
Code review of 6cf0672, the D3D-353 commit (read only, no runs). The per-element bindings look right to me. What I checked:
Two notes, not blocking:
AI-assisted (Claude Code). |
The per-element bindings are all bound and numbered from 0, so a draw now binds them with one vkCmdBindVertexBuffers2 instead of one call per element (traeb0n's review of ItsNotRexed#3167). Per-slot bindings bind each run of consecutive used slots in one call. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks for the review and the tests! @traeb0n:
@zzEmmazz, thanks for the RDNA2 iGPU run — good to see the fallback case E go from wrong to D3D12 there. AI-assisted. |
|
Tested 9030146 on Intel Tiger Lake Xe-LP (0x9a78, iGPU, subgroup 8..32, no mesh), driver 32.0.101.7088, Windows 11, MSVC 14.44: pass Full runtime ctest on the PR head: 106/114 passed, 10 skipped (shader_library_corpus needs a shader work folder; vk_sync_validation, d3d12_queue_wait and d3d12_rgb9e5_rtv skip on this adapter/driver; d3d12_first_light), 2 failed — and both reproduce identically on main AI-assisted (GLM, operated by the account owner). |
Claimed in the coordination issue as: D3D-353, #3047 (comment)
Found by @RipcuBAN (finding).
Depends on: #2676 (the
d3d12_ia_boundstest comes from it).Rebased on 2026-11-22 onto #2676 +
mainf847748c: the branch first sat on #2981's head and inherited its conflicts withmain. It no longer carries #2981, sod3d12_ia_boundsruns with the 144-byte shaders here; the per-element bindings don't depend on the push-constant size.What and why
D3D12 bounds a vertex read per input element: a view that ends inside a vertex keeps the elements before its end and zeroes the rest (
d3d12_ia_boundscase E, measured on Windows D3D12 and WARP). Vulkan'srobustBufferAccess2lets an implementation treat every attribute of a binding as out of range when one is, and AMD's 23.40 driver on an RDNA2 iGPU (gfx1036) did that: it zeroed the whole partial vertex. The layer's result therefore depended on the driver.The layer now gives each input element its own Vulkan binding, so the binding's range is the element's and the bound is per element on every driver:
d3d12_vulkan_device.cpp: when the layout feeds no more attributes thanmaxVertexInputBindings, attribute i reads binding i at offset 0, with the slot's input rate. The device readsmaxVertexInputBindingsnext tomaxPushConstantsSize(16, the Vulkan minimum, until asked).vulkan_replay.h: at each draw, binding i is the slot's view starting at the element's offset (offset + element offset,size - element offset), with the slot's stride (0 for step rate 0). An element at or past the view's end, or an unbound slot, binds the zero page.docs/d3d12_vulkan.md(Reads past a view) and the case E comment say so.Tested
AMD Radeon RX 7700 XT (Navi 32, RDNA3), Windows driver 26.10.1 (Vulkan 1.4.359), Windows 11 26300, MSVC 19.44 (VS 2022 Build Tools), Ninja RelWithDebInfo.
d3d12_ia_boundsLEONIDA_NO_IA_BOUNDS=1passVK_LAYER_KHRONOS_validation(1.4.363, confirmed loaded)ctest(whole runtime, no game dir)6cf06724)tests/test_docs_*.pyNo compiler warnings in the files this PR touches.
Caveat: this GPU and driver already matched D3D12 per element before the change, so I can't show red → green here; the fix rests on the spec's per-binding rule. @RipcuBAN, could you run
d3d12_ia_boundswith this on the gfx1036 / 23.40 setup where case E diverged?No game files. AI-assisted.
🤖 Generated with Claude Code