shader: lower and draw the null export target (Part of #1723) #2612

Closed
github-bot wants to merge 3 commits from gh-pr/2612/head into gh-pr/2612/base
Owner

@⁠lambirou on GitHub · 2026-11-25 23:20 UTC · original
lambirou:startup/export-null-draw → main · +212 −1 · 5 files · 3 commits · closed without merging

Problem

exp null, off, off, off, off done vm is a pixel shader that only discards: the null target writes no channel, while vm still kills the lanes outside the entry execution mask. The startup translator refused it as export target null, and a stage whose only export was null was classified as other.

This PR revives the two commits from the closed #2026 by @⁠tedin7 and adds the missing draw coverage. #2026 was closed only to keep the Windows queue short; its branch is unchanged.

Change

  • tools/startup/gfx2hlsl.py: accept the null target, keep the vm discard, add no SV_Target or write mask, and classify a null-only stage as a pixel stage. A null export with a source operand, a compressed mask or an en: field stays refused.
  • tests/startup_gfx2hlsl_export_null_check.py: the source-built translation, classification and refusal controls from #2026.
  • tests/startup_gfx2hlsl_export_null_draw_check.py: compile a colour export followed by exp null with DXC ps_6_0, draw 4x4 pixels through offscreen_check --startup-pixel-words, and compare all 64 words with the four constants. The negative control writes mrt0 = 0 from the null site and must produce pixel mismatch.
  • CMakeLists.txt and docs/experiments.md: register the pure check plus startup_gfx2hlsl_export_null_draw_{warp,hardware} and document the scope.

Verification

python -B tests/startup_gfx2hlsl_export_null_check.py
all ok

python -B tests/startup_gfx2hlsl_export_null_draw_check.py draw <dxc> <offscreen_check> warp
backend=warp ... adapter=Microsoft Basic Render Driver ...
null export draw: 16 pixels match; the writing-null control differs

python -B tests/startup_gfx2hlsl_export_null_draw_check.py draw <dxc> <offscreen_check> hardware
backend=hardware ... adapter=AMD Radeon RX 9060 XT driver=32.0.32029.2010 ...
null export draw: 16 pixels match; the writing-null control differs

The hardware case ran on Windows 11 build 26300 with the D3D12 debug layer unavailable. tests/docs_links_check.py passes (19 files, 498 links), tests/bidi_controls_check.py passes, and git diff --check is clean.

Evidence

Every instruction is built from the documented EXP encoding; no archive bytes, game files, dumps or private logs are used. The pure check covers the null-only translation, null before and after mrt0, the vm discard outside entry EXEC, the three refusal shapes and the pixel/vertex classification controls.

Follow-up

  • The draw covers the mixed null-plus-colour case, where the no-op is observable; a null-only stage has no pixels to read back.
  • If @⁠tedin7 prefers, #2026 can be reopened and this draw commit cherry-picked; the first two commits here preserve his authorship.

Checklist

  • This pull request covers one reviewable behavior.
  • I included the exact command and result for every check I ran.
  • I considered a negative control or failure case for a new fixture.
  • I updated README/docs when a capability or build requirement changed.
  • I did not include game files, dumps, distribution links or secrets.

AI-assisted: the translation and first checks are @⁠tedin7's; the draw fixture and this description were prepared with a Codex subagent and reviewed locally.

**@⁠lambirou** on GitHub · 2026-11-25 23:20 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2612) `lambirou:startup/export-null-draw` → `main` · +212 −1 · 5 files · 3 commits · closed without merging ## Problem `exp null, off, off, off, off done vm` is a pixel shader that only discards: the null target writes no channel, while `vm` still kills the lanes outside the entry execution mask. The startup translator refused it as `export target null`, and a stage whose only export was null was classified as `other`. This PR revives the two commits from the closed #2026 by @⁠tedin7 and adds the missing draw coverage. #2026 was closed only to keep the Windows queue short; its branch is unchanged. ## Change - `tools/startup/gfx2hlsl.py`: accept the null target, keep the `vm` discard, add no `SV_Target` or write mask, and classify a null-only stage as a pixel stage. A null export with a source operand, a compressed mask or an `en:` field stays refused. - `tests/startup_gfx2hlsl_export_null_check.py`: the source-built translation, classification and refusal controls from #2026. - `tests/startup_gfx2hlsl_export_null_draw_check.py`: compile a colour export followed by `exp null` with DXC `ps_6_0`, draw 4x4 pixels through `offscreen_check --startup-pixel-words`, and compare all 64 words with the four constants. The negative control writes `mrt0 = 0` from the null site and must produce `pixel mismatch`. - `CMakeLists.txt` and `docs/experiments.md`: register the pure check plus `startup_gfx2hlsl_export_null_draw_{warp,hardware}` and document the scope. ## Verification ```text python -B tests/startup_gfx2hlsl_export_null_check.py all ok python -B tests/startup_gfx2hlsl_export_null_draw_check.py draw <dxc> <offscreen_check> warp backend=warp ... adapter=Microsoft Basic Render Driver ... null export draw: 16 pixels match; the writing-null control differs python -B tests/startup_gfx2hlsl_export_null_draw_check.py draw <dxc> <offscreen_check> hardware backend=hardware ... adapter=AMD Radeon RX 9060 XT driver=32.0.32029.2010 ... null export draw: 16 pixels match; the writing-null control differs ``` The hardware case ran on Windows 11 build 26300 with the D3D12 debug layer unavailable. `tests/docs_links_check.py` passes (19 files, 498 links), `tests/bidi_controls_check.py` passes, and `git diff --check` is clean. ## Evidence Every instruction is built from the documented EXP encoding; no archive bytes, game files, dumps or private logs are used. The pure check covers the null-only translation, null before and after `mrt0`, the `vm` discard outside entry EXEC, the three refusal shapes and the pixel/vertex classification controls. ## Follow-up - The draw covers the mixed null-plus-colour case, where the no-op is observable; a null-only stage has no pixels to read back. - If @⁠tedin7 prefers, #2026 can be reopened and this draw commit cherry-picked; the first two commits here preserve his authorship. ## Checklist - [x] This pull request covers one reviewable behavior. - [x] I included the exact command and result for every check I ran. - [x] I considered a negative control or failure case for a new fixture. - [x] I updated README/docs when a capability or build requirement changed. - [x] I did not include game files, dumps, distribution links or secrets. AI-assisted: the translation and first checks are @⁠tedin7's; the draw fixture and this description were prepared with a Codex subagent and reviewed locally.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 01:07:22 +00:00
github-bot closed this pull request 2026-11-27 01:07:22 +00:00
Author
Owner

@⁠lambirou on GitHub · 2026-11-25 23:22 UTC · original

@⁠tedin7 this PR revives the two commits from your closed #2026 and adds the draw fixture discussed there (7ee0b6d7). Your authorship is preserved on both commits.

If you prefer to reopen #2026 instead, I can close this PR and hand the draw commit over; otherwise this is the combined branch ready for review. CI is running on 7ee0b6d7.

**@⁠lambirou** on GitHub · 2026-11-25 23:22 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2612#issuecomment-7177472608) @⁠tedin7 this PR revives the two commits from your closed #2026 and adds the draw fixture discussed there (`7ee0b6d7`). Your authorship is preserved on both commits. If you prefer to reopen #2026 instead, I can close this PR and hand the draw commit over; otherwise this is the combined branch ready for review. CI is running on `7ee0b6d7`.
Author
Owner

@⁠lambirou on GitHub · 2026-11-25 23:24 UTC · original

#2026 was reopened and merged at 23:22 UTC (merge commit 66026a39). Its merge includes the draw fixture from 7ee0b6d7 and the documentation update, with Co-authored-by: Roland Edi.

This PR is now a duplicate of the merged #2026, so I am closing it. The useful draw coverage is already on main; no further change is needed here.

**@⁠lambirou** on GitHub · 2026-11-25 23:24 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2612#issuecomment-7177528963) #2026 was reopened and merged at 23:22 UTC (merge commit `66026a39`). Its merge includes the draw fixture from `7ee0b6d7` and the documentation update, with `Co-authored-by: Roland Edi`. This PR is now a duplicate of the merged #2026, so I am closing it. The useful draw coverage is already on `main`; no further change is needed here.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.