fix: recompute the container checksum after stripping Xbox shader chunks #49
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Freminet--ScarlettX!49
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-49"
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?
@marquezinii on GitHub · 2026-11-23 12:17 UTC · original
marquezinii:fix/dxbc-checksum-after-strip→main· +140 −3 · 2 files · 1 commits · openTL;DR
TranslateXboxShaderToPcrebuilds the DXBC/DXIL container without theXBOX/XS2M/XDBG/XBINchunks, but copies bytes 4..19 from the input. Those bytes are the container checksum, and the copied one was computed over the old contents. D3D12 checks it, soD3D12XboxCreateGraphicsPipelineStateandD3D12XboxCreateComputePipelineStatefailed for any shader that had something stripped. The raytracing PSO is unaffected because its state object is software-backed and never passes these bytes to D3D12. Shaders without Xbox chunks are passed through unchanged and were never affected.The rebuilt container now gets its checksum recomputed: MD5 over bytes 20..end with the D3D compiler's own last-block padding. It's about 80 lines in
shader_ir.cppand adds no dependencies.test_shader_pipelinenow takes four fxc-compiled shaders, appends anXBOXchunk with the checksum zeroed, and checks that stripping gives back the original fxc output byte for byte. That also checks the checksum against the compiler's. One of the four shaders is there because of its size: its last block takes the other padding path. The test then builds a graphics PSO on WARP from a VS with anXBOXchunk and a PS with anXS2Mchunk. Without the fix the byte comparison fails, and if that check is skipped, WARP'sCreateGraphicsPipelineStaterejects the PSO. Outside the test I also checked the same algorithm against two signed DXIL containers from dxc (ps_6_0andlib_6_3), and it matched both.Verified on Windows 11 with MSVC (VS Build Tools 18), the same way CI runs:
26/26 pass in Release and Debug. With only the test change applied,
test_shader_pipelinefails.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.