feat(tools): add a shader scan that counts DXBC containers and their parts #15
No reviewers
Labels
No labels
accessibility
bug
ci
docs
documentation
duplicate
enhancement
fixes issue
good first issue
help wanted
invalid
library request
libs
needs rebase
question
relinker
stale
tools
unblocks title
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Dark3581--AnyBox!15
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/15/head"
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?
@Callimann8 on GitHub · 2026-11-21 12:19 UTC · original
Callimann8:claude/project-thread-myl17b→main· +179 −0 · 3 files · 2 commits · merged 2026-11-21 12:32 UTCWhat
Adds
tools/shader_scan.py, a read-only scan that finds every DXBC container in a package (loose.csofiles or embedded in other files) and reports counts by kind (dxil,dxbc,mixed,rootsig,other) and by part tag. Part tags that are not standard DXBC parts point at console-specific data.The goal is to answer the shader question in #4 with data from titles people own: do console packages keep DXIL next to the native code, or only console-specific parts?
--jsonwrites names, offsets and part tags only, never shader bytes. Shaders inside compressed archives are not found; this is noted in the docs.Documented in a new "Shader formats" section of
docs/dev/GAME_TESTING.md.Tested
Linux, Python 3: new
tools/tests/test_shader_scan.py(synthetic containers: kind classification, embedded containers next to falseDXBCmagic, truncated container rejected, folder summary). Alltools/testspass,python tools/check_conventions.pypasses. Not run on a real title.Checklist
main; no other open PR implements the same functionspython tools/check_conventions.pypasses (no comments in code, one declaration per export, Conventional Commit subjects)AbxNotImplemented/AbxUnsupported); silent stubs are listed under Silent stubs through a debt fragment (n/a, tools only)docs/dev/debt/changes/<branch>.md(none changed)DxilContainer.h)@Callimann8 on GitHub · 2026-11-21 12:19 UTC · original
Some input on the approach, from reading the code and public sources only (no GXDK material).
1. Target the desktop D3D12 interfaces, not Vulkan directly.
AnyBox runs titles on the Windows loader, so desktop
d3d12.dllis always there. D3D12.X is a D3D12 dialect: heaps, descriptors, root signatures, command lists and fences are the same model, so most methods should map close to 1:1 and the D3D12 debug layer can validate the result. Going to Vulkan does not need its own layer: on Linux, vkd3d-proton already turns desktop D3D12 into Vulkan, so a D3D12.X to D3D12 layer gets Vulkan for free under Wine/Proton. A direct Vulkan backend only pays off if some console feature can be expressed in Vulkan but not in D3D12, and I don't know of one that would justify a second translation stack.2. Shaders decide the size of the project, whichever API is chosen.
Console shaders are compiled offline for one fixed GPU. If packages keep DXIL next to the console-specific data, the layer can hand the DXIL to desktop D3D12 and the shader path is small. If they hold only native GPU code, AnyBox needs an ISA to DXIL (or SPIR-V) recompiler, like the ones console emulators write (Xenia for Xbox 360 microcode, shadPS4 for GCN). That is a different scale of project. A PR adds
tools/shader_scan.py, which counts the DXBC containers in a package and their part tags (names and offsets only), so owners can post a summary line here and settle this with data.3. Interface layouts have to come from titles.
The console D3D12 headers ship only in the licensed GXDK and can't be used. Unlike exports, vtable calls don't show up in import audits or on the needs page. A first code step that fits "implement or stop":
D3D12XboxCreateDevicereturns a device whose every vtable slot callsAbxNotImplementedwith the interface and slot index in the run report. Each run then names the next method a title needs, andtools/ghidra/ImportCallArgs.java(or a vtable variant of it) shows the arguments at the call sites.4. Small pieces that can go in early.
The four root signature serialize/deserialize exports take only public desktop structs and could be forwarded to the host
d3d12.dll, with a debt note that the blob format was not checked against a console. They matter only once a device exists.Suggested order: shader data from a few titles, then the reporting stub device, then methods one by one in the order titles hit them.
@Dark3581 on GitHub · 2026-11-21 12:32 UTC · original · approved these changes
Reviewed — looks good
Merging as it is. The container check is strict enough that it found no false positives on real binaries, and it gives #4 a way to get data.
What I ran
Head
acdc483, merged locally onto currentmain(ddd30ef, after #14, #12 and #13; no conflicts). Python 3.13 on Windows 10. Tools-only change, so no library build.Results
tools/check_conventions.pydwmcore.dllandd2d1.dll(495dxbc, 6other), none in the two others. Every container ended inside its file and had a valid part tableDXBC, and a missing path: the first two report nothing, the missing path prints an error and the scan goes onFindings
Blocking
None.
Non-blocking
tools/shader_scan.py:96: the JSON keys are each path exactly as given on the command line, so an absolute path (C:\Users\<name>\...) puts the contributor's folder and user name into a file the docs suggest sharing. Making the keys relative to the scanned folder would keep them to package names only.tools/shader_scan.py:35: the 6othercontainers above hold onlyLIBF/LIBHparts, which are D3D11 function-linking libraries and a standard part, not console data.otheris also the bucket the docs say points at console-specific data, so a title with shader libraries would read as console-specific. Alibrarykind, or a list of the standard part tags with unknown ones reported separately, would make the summary answer #4 directly.Not verified
A real console package, as you noted.
Thanks, a small, focused tool that's easy to run.