mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 23:05:53 +01:00
[PR #767] OLD-2402: Runtime: D3D12 PSOs bind the --pc-tail-ubo set-1 block for 128-byte push-constant devices #806
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#806
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/767
Author: @whoalin1
Created: 11/24/2026
Status: 🔄 Open
Base:
main← Head:pc-tail-runtime📝 Commits (1)
a53ca73Runtime: D3D12 PSOs bind the --pc-tail-ubo set-1 block for 128-byte push-constant devices📊 Changes
12 files changed (+967 additions, -340 deletions)
View changed files
📝
docs/d3d12_vulkan.md(+20 -12)📝
runtime/CMakeLists.txt(+30 -3)📝
runtime/shims/d3d12_com.h(+2 -2)📝
runtime/shims/d3d12_vulkan_device.cpp(+191 -34)📝
runtime/src/shader_library.h(+5 -0)📝
runtime/src/vulkan_replay.h(+41 -23)📝
runtime/test/d3d12_compute_test.cpp(+358 -208)📝
runtime/test/d3d12_draw_test.cpp(+278 -53)📝
runtime/test/glsl/cs_user_data.comp(+18 -2)📝
runtime/test/glsl/ps_draw.frag(+15 -1)📝
runtime/test/glsl/vs_draw.vert(+5 -1)📝
runtime/test/shader_library_test.cpp(+4 -1)📄 Description
Restores my open PR from the original repository (OLD-2402), rebased onto current
main(2d73c242f).Claim: https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7133003627
Summary
A Vulkan device whose
maxPushConstantsSizeis 128 bytes (AMD Windows driver on RDNA2 iGPUs, some Intel Arc drivers) cannot hold the 144-byteShaderUserDatapush-constant block, so previously every D3D12 PSO was refused there withE_NOTIMPL.With
--pc-tail-ubo(already merged inmain), translated shaders keeps0..s31in 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 PR wires that path through the D3D12 → Vulkan layer:runtime/src/shader_library.h:ShaderEntryparsespc_tail.bytesintopc_tail_bytes(covered byshader_library_test).runtime/src/vulkan_replay.h:ComputePipelineandGraphicsPipelinecarrypush_bytes,tail_set, andtail_offset;detail::bind_user_databinds set 0 (if present), set 1 with dynamic offset (if present), and pushespush_bytesat all three push sites (ExecuteIndirect,Dispatch,Draw).runtime/shims/d3d12_vulkan_device.cpp:DeviceState::pc_tailcreates oneUNIFORM_BUFFER_DYNAMICdescriptor over the arena (range 16) plus an empty set-0 layout once per device.PipelineState::user_data_layoutsizes the push-constant range from each stage'spush_constant_bytes/pc_tail_bytes(including VS+GS+PS), adds set 1 when any stage haspc_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.runtime/test/d3d12_compute_test.cpp&runtime/test/d3d12_draw_test.cpp: verify 144-byte refusal and--pc-tail-ubodispatch/draw (including VS withoutpc_tail+ PS with set-1 tail) on both simulated 128-byte devices and real 128-byte GPUs, skipping the 144-byte passes on real 128-byte hardware.docs/d3d12_vulkan.md&runtime/shims/d3d12_com.h: documentation updates.Verification (rebased on
2d73c242f,LEONIDA_VK_VALIDATION=1)shader_library_test— pass (rc=0)d3d12_compute_test(rc=0, 0 validation errors)d3d12_draw_test(rc=0, 0 validation errors)d3d12_bundle_test(rc=0, 0 validation errors)d3d12_geometry_test(rc=0, 0 validation errors)d3d12_mesh_test(LEONIDA_VK_VALIDATION=0,rc=0;VUID-07076under validation is tracked separately in #506)maxPushConstantsSize):d3d12_compute_test(rc=0, 0 validation errors):--pc-tail-ubo64/64 elements matched on simulated 128B device and real 128B GPU; 144B passes cleanly skippedd3d12_draw_test(rc=0, 0 validation errors):--pc-tail-uboVS+PS (VS withoutpc_tail, PS with set-1 tail) 4096/4096 pixels matched on simulated 128B device and real 128B GPU; 144B passes cleanly skippedAI-assisted (Gemini 4 Neon).
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.