shader: add dxil-ms-xb2 to dxil-ms-dx retarget tool and fixtures #247
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/250"
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?
Imported from R0Y00/Xbox2Windows. Originally posted by MarlomMedeiros on 2026-11-21T19:16:59Z.
Refs #132
Summary
tools/dxil_retarget.py: LLVM 3.7 bitcode + DXBC container rewrite that retargetsdxil-ms-xb2modules todxil-ms-dx(note: desktop DXC rejectsdxil-ms), removes thexbox.compiler.optionsnamed metadata, canonicalizes the DXIL program header (BitcodeOffset=16, drops trailingxbop), retargets DXILSTATparts, clears XboxRTS0flags0x03000000, and zeroes the stale DXBC digest.--pebatch mode extracts and validates embedded containers.tests/dxil_retarget_check.py: pure-Python controls plus synthetic fixtures injecting xb2 triple/metadata/offset/flags into source-builtcompute_root.csoandCopyBlocks.cso, with negative controls.docs/experiments.md.Shared interfaces and overlapping work
resource_inventory.parts(),call_evidence.shader_containers(),probe_roots.validate_shader()and drivesroot_probe.exe.0x03000000flag-clearing precedent intools/root_probe.cpp(deserialized in-memory copy; this change clears the bits in the serialized container bytes).xbox.*call sites anddxil-ms-xb2triple reuses theprobe_rootsclassification.Test plan
ctest --preset dev --no-tests=error -R 'dxil_retarget|shader_metadata|dxcontainer_part_offsets' -V: 5/5 passed (dxil.dll 1.9.2602.17).XboxBvhBuilder.dll(SHA-256 pinned in experiments.md), the 9 embedded modules withoutxbox.*calls passModuleOnly9/9 after bitcode retarget, and pass container validation 9/9 after also clearing0x03000000.xbox.*intrinsics and non-DXIL aggregate instructions.Imported from R0Y00/Xbox2Windows. Originally posted by copilot-pull-request-reviewer[bot] on 2026-11-21T19:17:07Z.
Review: COMMENTED
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-21T20:28:22Z.
Please validate the encoded operand widths when reading abbreviation definitions.
BitReader.read_vbrbuildsmaskandhighfrom the supplied width before checking the input has that many bits; the current lower bound alone allows an invalid width to consume excessive memory instead of returning a format error. Enforce the LLVM bitstream width bounds before those shifts, and add a small synthetic rejection test alongside the existing round-trip controls.Imported from R0Y00/Xbox2Windows. Originally posted by MarlomMedeiros on 2026-11-21T20:42:05Z.
Done at
cf77eda.BitReader.readnow rejects widths outside [0,64] andread_vbrrejects widths outside [2,32] before the mask and high-bit shifts, matching the LLVM bitstream bounds (uint64 field read and MaxChunkSize). A crafted abbreviation operand now returns a format error instead of allocating width-proportional integers.Added a synthetic rejection control covering both encodings: an abbrev definition declaring
ENC_VBRwidth 33 and one declaringENC_FIXEDwidth 65, each parsed from a serialized stream and asserted to raise.Verification:
ctest --preset dev --no-tests=error -R 'dxil_retarget' -Vpasses 2/2;dxil_retarget_probestill validates retargeted fixtures end to end on dxil.dll 1.9.2602.17 withmodule_only=validated.