shader: validate ACCC parts through DXIL retarget #3951

Open
lambirou wants to merge 2 commits from upstream-pr/3951 into main
lambirou commented 2026-12-03 16:52:32 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by lambirou on 2026-12-03T16:52:32Z.


Problem

The GDK xdxc compiler can append an ACCC compute part to an otherwise normal
DXIL container. The existing retarget path treats unknown parts as malformed or
passes them to desktop validation, which rejects the custom FourCC. This prevents
source-built ACO containers from being inspected and retargeted reproducibly.

Change

  • Validate the bounded ACCC/FSPX version-1 compute layout: header, section
    count, declared size, ranges, overlaps and the single tag-6 code section.
  • Preserve the complete ACCC payload byte for byte while retargeting the DXIL
    program and rewriting its triple.
  • Validate, sign and create the compute PSO through a temporary container view
    with ACCC omitted, recording aco_parts_omitted: ["ACCC"].
  • Keep the preserved ACCC archive separate from that signed DXIL view. The
    archive retains its original payload with a zero digest and reports signed: false; the signed view reports signed_view: true and signing_scope: "dxil-view".
  • Expose the saved-artifact scope in CLI and PE reports, keep the no-ACCC path
    unchanged, and omit ACCC explicitly from the desktop compute-catalogue export.
  • Add synthetic positive, malformed and payload-preservation controls.

Refs #3676.

Validation

Windows development environment:

python -B tests/dxil_retarget_check.py
python -B tests/gdk_shader_corpus_check.py
python -B tests/dxcontainer_part_offsets_check.py
python -B tests/ffx_dispatch_profile_check.py
python -B tests/docs_links_check.py
  • DXIL retarget controls: passed, including malformed ACCC controls and the mock signer boundary.
  • GDK corpus: layout, payload equality and manifest-mismatch controls passed.
  • DX container offsets: 8/8 passed.
  • FFX dispatch profile: 10/10 passed.
  • Links: 285 Markdown files and 1,010 links checked.
  • A synthetic xdxc -noprecompile compute container retained a 672-byte ACCC payload after retarget. Its saved archive has a zero digest and is not desktop-ready; the separate 3,684-byte signed DXIL view validated and created a WARP PSO with 0x00000000.
  • The no-ACCC path still returns the same signed container and reports signing_scope: "container".

Limits

  • Only the observed version-1 compute ACCC/FSPX form is supported.
  • Graphics ACGS parts are not parsed.
  • The parser checks framing and preserves bytes. It does not execute the ACO ISA.
  • The WARP PSO result covers pipeline creation, not shader execution or console hardware.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:5630985317 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3951). Originally posted by [lambirou](https://github.com/lambirou) on 2026-12-03T16:52:32Z. --- ## Problem The GDK `xdxc` compiler can append an `ACCC` compute part to an otherwise normal DXIL container. The existing retarget path treats unknown parts as malformed or passes them to desktop validation, which rejects the custom FourCC. This prevents source-built ACO containers from being inspected and retargeted reproducibly. ## Change - Validate the bounded `ACCC/FSPX` version-1 compute layout: header, section count, declared size, ranges, overlaps and the single tag-6 code section. - Preserve the complete `ACCC` payload byte for byte while retargeting the DXIL program and rewriting its triple. - Validate, sign and create the compute PSO through a temporary container view with `ACCC` omitted, recording `aco_parts_omitted: ["ACCC"]`. - Keep the preserved `ACCC` archive separate from that signed DXIL view. The archive retains its original payload with a zero digest and reports `signed: false`; the signed view reports `signed_view: true` and `signing_scope: "dxil-view"`. - Expose the saved-artifact scope in CLI and PE reports, keep the no-ACCC path unchanged, and omit `ACCC` explicitly from the desktop compute-catalogue export. - Add synthetic positive, malformed and payload-preservation controls. Refs #3676. ## Validation Windows development environment: ```text python -B tests/dxil_retarget_check.py python -B tests/gdk_shader_corpus_check.py python -B tests/dxcontainer_part_offsets_check.py python -B tests/ffx_dispatch_profile_check.py python -B tests/docs_links_check.py ``` - DXIL retarget controls: passed, including malformed `ACCC` controls and the mock signer boundary. - GDK corpus: layout, payload equality and manifest-mismatch controls passed. - DX container offsets: 8/8 passed. - FFX dispatch profile: 10/10 passed. - Links: 285 Markdown files and 1,010 links checked. - A synthetic `xdxc -noprecompile` compute container retained a 672-byte `ACCC` payload after retarget. Its saved archive has a zero digest and is not desktop-ready; the separate 3,684-byte signed DXIL view validated and created a WARP PSO with `0x00000000`. - The no-ACCC path still returns the same signed container and reports `signing_scope: "container"`. ## Limits - Only the observed version-1 compute `ACCC/FSPX` form is supported. - Graphics `ACGS` parts are not parsed. - The parser checks framing and preserves bytes. It does not execute the ACO ISA. - The WARP PSO result covers pipeline creation, not shader execution or console hardware.
R0Y00 commented 2026-12-03 17:22:27 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-03T17:22:27Z.

Review: CHANGES_REQUESTED


The pure-Python DXIL retarget and GDK corpus controls passed, as did the eight DXBC offset and ten FFX profile cases. The remaining issue is the saved artifact's signing status. sign_container sends only the ACCC-free bytes to root_probe, then rebuilds the larger container and copies that digest into it. Both CLI and PE-mode reports mark the larger saved file signed, although the full container was never signed by the probe and the PR documents that WARP rejects the full file.

Please report the signing scope at the saved-artifact boundary. A preserved ACCC archive can have a separate signed DXIL view, but the archive itself should not be marked signed or be reported as the validated desktop file. Keep the existing no-ACCC output behavior and add a control that distinguishes the signed view from the preserved archive.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6174864831 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3951#pullrequestreview-6174864831). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-12-03T17:22:27Z. **Review:** CHANGES_REQUESTED --- The pure-Python DXIL retarget and GDK corpus controls passed, as did the eight DXBC offset and ten FFX profile cases. The remaining issue is the saved artifact's signing status. sign_container sends only the ACCC-free bytes to root_probe, then rebuilds the larger container and copies that digest into it. Both CLI and PE-mode reports mark the larger saved file signed, although the full container was never signed by the probe and the PR documents that WARP rejects the full file. Please report the signing scope at the saved-artifact boundary. A preserved ACCC archive can have a separate signed DXIL view, but the archive itself should not be marked signed or be reported as the validated desktop file. Keep the existing no-ACCC output behavior and add a control that distinguishes the signed view from the preserved archive.
lambirou commented 2026-12-03 17:40:29 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by lambirou on 2026-12-03T17:40:29Z.


Review feedback addressed in 1ba8b0326. The saved ACCC archive now has a zero digest and signed: false; the separate signed DXIL view carries signed_view: true and signing_scope: "dxil-view". CLI and PE reports expose the saved-artifact fields, and controls cover both the ACO archive and the unchanged no-ACCC path. Tests: DXIL retarget, GDK corpus, 8 DXBC offsets, 10 FFX profiles and 287/1,012 Markdown links all pass.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7386883906 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3951#issuecomment-7386883906). Originally posted by [lambirou](https://github.com/lambirou) on 2026-12-03T17:40:29Z. --- Review feedback addressed in `1ba8b0326`. The saved ACCC archive now has a zero digest and `signed: false`; the separate signed DXIL view carries `signed_view: true` and `signing_scope: "dxil-view"`. CLI and PE reports expose the saved-artifact fields, and controls cover both the ACO archive and the unchanged no-ACCC path. Tests: DXIL retarget, GDK corpus, 8 DXBC offsets, 10 FFX profiles and 287/1,012 Markdown links all pass.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/3951:upstream-pr/3951'
git switch 'upstream-pr/3951'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/3951'
git switch 'upstream-pr/3951'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/3951'
git switch 'upstream-pr/3951'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/3951'
git switch 'main'
git merge --squash 'upstream-pr/3951'
git switch 'main'
git merge --ff-only 'upstream-pr/3951'
git switch 'main'
git merge 'upstream-pr/3951'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
R0Y00/Xbox2Windows!3951
No description provided.