Repository navigation
Conversation
…ush-constant devices A device whose maxPushConstantsSize is 128 (AMD Windows driver on RDNA2 iGPUs, some Intel Arc drivers; D3D-14's push_constants_need_fallback) cannot hold the 144-byte ShaderUserData push-constant block, so previously every D3D12 PSO was refused there with E_NOTIMPL. With --pc-tail-ubo (PR ItsNotRexed#2046), translated shaders keep s0..s31 in 128 push-constant bytes and move the 16-byte tail (heap base, code base) to a uniform block at set 1, binding 0 when a stage reads it. This wires that path through the D3D12 -> Vulkan layer: - runtime/src/shader_library.h: ShaderEntry parses pc_tail.bytes into pc_tail_bytes (tested in shader_library_test). - runtime/src/vulkan_replay.h: ComputePipeline and GraphicsPipeline carry push_bytes, tail_set and tail_offset; detail::bind_user_data binds set 0 (if present), set 1 with dynamic offset (if present), and pushes push_bytes at all three push sites (ExecuteIndirect dispatch, Dispatch, Draw); the three unsupported checks cover tail_set. - runtime/shims/d3d12_vulkan_device.cpp: DeviceState::pc_tail creates one UNIFORM_BUFFER_DYNAMIC descriptor over the arena (range 16) plus an empty set-0 layout once per device. PipelineState::user_data_layout sizes the push-constant range from each stage's push_constant_bytes / pc_tail_bytes (so a --pc-tail-ubo stage that reads neither heap nor code base still fits 128 bytes), adds set 1 when any stage has pc_tail, writes the 16-byte tail once into the arena, and releases it on destruction. 144-byte shaders remain refused on <144-byte devices with a log pointing to --pc-tail-ubo. - Tests: d3d12_compute_test and d3d12_draw_test verify 144-byte refusal and --pc-tail-ubo dispatch/draw (including VS without pc_tail + PS with set-1 tail) on both simulated 128-byte devices and the host GPU, and skip the 144-byte passes when run on a real 128-byte device. - Docs: docs/d3d12_vulkan.md (sections 3.2, 5.2, Q13) and d3d12_com.h comment updated. Step 3 of the uniform-buffer tail claimed in ItsNotRexed#1902. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-Authored-By: Gemini 4 Neon <noreply@google.com>
…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>
The test's two stages declared one 144-byte push-constant range, so a device whose maxPushConstantsSize is the 128-byte Vulkan minimum refused the PSO (E_NOTIMPL at make_context) and none of the nine input-assembler bounds cases ran there; the AMD Windows driver reports 128 bytes on RDNA2 iGPUs. The fixtures now also come as a --pc-tail-ubo twin: the same GLSL compiled with -DPC_TAIL, whose stages declare s0..s31 alone (128 bytes) and no set-1 tail, since neither stage reads a root argument. A device with room for both layouts runs both and their probes must agree; one whose maxPushConstantsSize is below 144 runs the twin alone, which is where the cases were measured on RDNA2 hardware. Case E is information only where the bounded and the unbounded layer pass draw alike and the host differs: AMD's driver reads a vertex attribute past its view instead of zeroing it, so the case is not the layer's to decide there. A16, A32 and C keep their pass/fail condition on that device. Stacked on ItsNotRexed#2402's head (d230040) with ItsNotRexed#2676 applied, because the test and the layer path it needs are not on main yet. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
|
Tested 814850f on Windows 11, RTX 5080 (driver 616.92) and AMD Radeon iGPU gfx1036 (driver 26.10.1):
AI-assisted. |
|
Tested 814850f 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). |
…sh-constant devices Both tests' shaders declared 144 push-constant bytes, so a device whose maxPushConstantsSize is the 128-byte Vulkan minimum refused their PSOs and neither reached its checks (d3d12_bundle_test.cpp:130 via make_pso). d3d12_bundle reuses d3d12_draw_test's --pc-tail-ubo twins (vs_draw/ps_draw compiled with -DPC_TAIL) from a second library folder, and runs every scenario and the layer-only checks on a layer device limited to 128 bytes as well as with the 144-byte shaders. d3d12_typeless_families gets a -DPC_TAIL build of vs_fullscreen.vert (its pixel shaders declare no push constants) and draws each case on both. A device below 144 bytes runs the twins alone. Both layouts are held to the same grids or host bytes. Tested with LEONIDA_VK_VALIDATION=1 on an RTX 5090 (NVIDIA 621.35) and an AMD Radeon iGPU (AMD 26.5.2): bundles 10 scenarios with both layouts, 20 host comparisons, 0 failures; typeless draws 16 of 16 equal the host; d3d12_draw_test still passes. Both devices report 256 bytes, so the 128-byte limit is simulated; a real 128-byte device has not run it. Stacked on ItsNotRexed#3013 (and ItsNotRexed#2402), which add the fallback the twins need. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Tested 814850f (merged onto main 1628210) on NVIDIA GeForce RTX 4060 Ti, driver 610.88 (32.0.16.1088), Windows 11 26200, MSVC 14.51.36231 (VS 2026), Vulkan SDK 1.4.363.0: pass This is the 256-byte push-constant side; the PR body covers the 128-byte AMD iGPU.
AI-assisted (Claude). |
|
Tested
Not checked: a device whose |
|
Same heads-up as on #2402, since this branch carries its code: Checked with AI-assisted (Claude). |
…sh-constant devices Both tests' shaders declared 144 push-constant bytes, so a device whose maxPushConstantsSize is the 128-byte Vulkan minimum refused their PSOs and neither reached its checks (d3d12_bundle_test.cpp:130 via make_pso). d3d12_bundle reuses d3d12_draw_test's --pc-tail-ubo twins (vs_draw/ps_draw compiled with -DPC_TAIL) from a second library folder, and runs every scenario and the layer-only checks on a layer device limited to 128 bytes as well as with the 144-byte shaders. d3d12_typeless_families gets a -DPC_TAIL build of vs_fullscreen.vert (its pixel shaders declare no push constants) and draws each case on both. A device below 144 bytes runs the twins alone. Both layouts are held to the same grids or host bytes. Tested with LEONIDA_VK_VALIDATION=1 on an RTX 5090 (NVIDIA 621.35) and an AMD Radeon iGPU (AMD 26.5.2): bundles 10 scenarios with both layouts, 20 host comparisons, 0 failures; typeless draws 16 of 16 equal the host; d3d12_draw_test still passes. Both devices report 256 bytes, so the 128-byte limit is simulated; a real 128-byte device has not run it. Stacked on ItsNotRexed#3013 (and ItsNotRexed#2402), which add the fallback the twins need. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Tested 814850f on Tiger Lake (Xe-LP) iGPU 0x9a78, driver 32.0.101.7088, Windows 11, MSVC 14.44: pass Full The PR's own area: AI-assisted (GLM, operated by the account owner). |
Claim: TEST-544 in #2891
Depends on: #2676 —
runtime/test/d3d12_ia_bounds_test.cpponly exists there.Depends on: #2402 — the layer's
--pc-tail-uboset-1 path. This branch is stacked on #2402's headd2300403with #2676 applied on top, so the diff shows both commits until they land; when they merge this rebases ontomainunchanged.Root cause
The test declares one 144-byte push-constant range for its two stages: the index entries for
vs_ia_boundsandps_ia_boundssaypush_constant_bytes: 144. A device whosemaxPushConstantsSizeis the 128-byte Vulkan minimum — the AMD Windows driver reports 128 on RDNA2 iGPUs — cannot hold that range, soPipelineState::user_data_layoutrefuses the PSO with the limit in the log andCreateGraphicsPipelineStatereturnsE_NOTIMPLatmake_context(line 228). None of the nine input-assembler bounds cases ran there.Reproduced on the tree this branch is stacked on, without the change (Ryzen 5 7600 iGPU, Radeon(TM) Graphics gfx1036, AMD Windows driver 24.10.24, Vulkan 1.3.280, 128 bytes):
exit 1. The same binary on the RTX 4070 SUPER (256 bytes) passed, 9 of 9 cases.
Changes
test/glsl/vs_ia_bounds.vert,test/glsl/ps_ia_bounds.frag: declare the user-data block the translator emits (s0..s31, then heap base and code base: 144 bytes). Compiled with-DPC_TAILthey declares0..s31alone, 128 bytes, and no set 1 — neither stage reads a root argument. The modules differ by 112 bytes, so the two compiles are real.runtime/CMakeLists.txt: buildvs_ia_bounds_tail.spvandps_ia_bounds_tail.spvwith-DPC_TAILand pass them asLEONIDA_TEST_{VS,PS}_TAIL_SPV, the shape TEST-465: give four D3D12 fixtures a --pc-tail-ubo variant #2752 used for four other fixtures.test/d3d12_ia_bounds_test.cpp: a second shader library whose index declares 128 push-constant bytes per stage with nopc_tail.run_layertakes aFixture(module folder plus the two program containers) and setsLEONIDA_SHADERSbefore creating its standalone device.maxPushConstantsSizeis below 144 skips the 144-byte pair and runs the twin alone; the table labels its rowslayer (pc-tail).layer (144 B)andlayer (pc-tail). The original path keeps its full coverage there.docs/d3d12_vulkan.md: the two variants, and the measured per-vertex-versus-per-element behaviour of the AMD driver.Testing
Windows 11 build 26200, MSVC 19.44.35228.0,
RelWithDebInfo, Ninja. Built withpowershell -NoProfile -ExecutionPolicy Bypass -File scripts\build_runtime.ps1: 368 of 368 targets, 0 errors.ctest --test-dir runtime/build -R "^d3d12_ia_bounds$" --output-on-failure, withVK_LOADER_DRIVERS_SELECT,LEONIDA_VK_DEVICEandVK_LOADER_LAYERS_DISABLE=~implicit~:--pc-tail-ubopair drew the same probes as the 144-byte oneThe informational case on the AMD device is E: D3D12 keeps the vertex's position (inside the view) and zeroes its colour (outside); the layer there draws the colour from memory instead, with or without the bounds, so
robustBufferAccess2is not deciding it. B1 and B2 (vertices wholly past the view) do match, so that driver's bound holds per vertex, not per element. A16, A32 and C match the host there, so the sized index bind androbustBufferAccess2work for indices, which is what #2676 is about.Full
cteston the AMD iGPU (the device this PR is for): 116 of 122 passed, 6 failed —d3d12_typeless_families,d3d12_fspx_compute,d3d12_msaa_draw,d3d12_set0_compute,d3d12_pipeline_library,d3d12_bundle. All six print the samepipelines need 144 bytes of push constantsline, i.e. they are the class TEST-544 was: four are #2752's fixtures (TEST-465, unmerged), andd3d12_typeless_familiesandd3d12_bundleare not covered by it — posted as a finding in #2891.d3d12_ia_boundsis not among them any more.Full
cteston the RTX 4070 SUPER: 122 of 122 passed (114 run, 8 skipped), 259 s, exit 0.Not run in this pass: an Intel Arc run (the third 128-byte family) and Wine.
AI-assisted. No game data, keys or decryption: the fixtures are hand-written GLSL/HLSL and synthetic FSSM programs.
🤖 Generated with Capy (DeepSeek V4.1 Flash)