shader: admit a depth-only export in the raw graphics front end #3612

Merged
Not-Saii merged 1 commit from upstream-pr/3612 into main 2026-11-30 20:03:39 +00:00
Not-Saii commented 2026-11-30 14:07:39 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Not-Saii on 2026-11-30T14:07:39Z.


Change

A raw fixed VS/PS pair whose pixel stage ends in an uncompressed MRTZ export of depth alone, with no colour export, was refused by the raw graphics front end with raw graphics varying or system export requires a stage interface. read_raw_graphics now treats that export as the pixel stage's output and adds one SV_Depth signature row, which the existing emitter already lowers for reviewed containers.

What stays refused:

  • stencil or coverage channels in the MRTZ export, and a compressed export: same refusal as before;
  • depth next to a colour export: refused by name (raw depth export next to a color export requires a stage interface), because a raw colour target is typed without a signature and would otherwise fail later as color target absent from pixel signature;
  • the mesh pixel caller (translate_mesh_pixel_program): unchanged, the new case is gated on !mesh_pixel.

Refs #3541. This is the first refusal of the depth-only fixed slot 57 pass reported there (comment). It does not make that pass translate on its own: with this change its next refusal is graphics branch on a wave mask.

Shared interface: read_raw_graphics in src/gfx1013_compute_native.cpp. Open PR #3527 edits the same function in different lines, so a small merge conflict is possible whichever lands second.

Verification

Commit 5a2d2799 on main 077bff3a. Windows 11 build 26300, MSVC 19.44, Windows SDK 10.0.26100 (DXC from the SDK), release preset. No GPU is involved; the checks compile and inspect bytecode.

cmake --build --preset release --target compile_dxil
ctest --preset release --no-tests=error -R '^native_(raw_depth_export|fixed_graphics_psi1|direct_container|graphics_interface_library|direct_mesh|compile_dxil_refusals|compile_dxil_watch|compile_dxil_rekey)$'
Test Result
native_raw_depth_export (new) passed
native_fixed_graphics_psi1 passed
native_direct_container passed
native_graphics_interface_library passed
native_compile_dxil_refusals passed
native_compile_dxil_rekey passed
native_compile_dxil_watch passed
native_direct_mesh failed, also on unmodified main

native_direct_mesh fails at its too-many-primitives case (the compiler accepts a program the test expects it to refuse with exceeds declared range). I rebuilt compile_dxil from unmodified main 077bff3a and got the same assertion, so this change does not cause it. I have not bisected it.

Before and after for the new fixture, run directly:

python -B tests\native_raw_depth_export_check.py out\build\release\compile_dxil.exe <DXC directory>
main 077bff3a this commit
first case (depth alone) native compute +0x20: raw graphics varying or system export requires a stage interface compiles; the pixel stage's only output is SV_Depth
whole check fails at the first case exit 0

Not run: tests driven by other executables (the draw consumer, d3d12_xs.dll), because only compile_dxil was rebuilt. The pull request check does not run the native_* tests.

Evidence and follow-up

The fixture is source-built: raw gfx1013 words assembled in the test, reusing the vertex program, root and helpers of tests/native_fixed_graphics_psi1_check.py. MIT, no external inputs.

Cases:

  • depth alone compiles; dxc -dumpbin shows SV_Depth, a storeOutput.f32, and no SV_Target;
  • a second process compiles the same request with frontend_cache_hit=1 and byte-identical pixel bytecode, so the depth row survives the front-end pair cache;
  • control: the same program exporting colour compiles and has no depth output;
  • negative controls: MRTZ enable masks 3, 5 and 2, a compressed MRTZ export, and colour plus depth are each refused, with no bytecode published.

Assumptions and limits:

  • The fixture takes the no-sidecar raw path. The pass in #3541 reaches the same reader through an interface-library match that is not byte-exact; that route is not exercised here.
  • Nothing here draws. The check covers the compiled stage's interface, not a depth value landing in a depth target.
  • Local-data result, for context only: the request for the pass in #3541 moves from the refusal above to graphics branch on a wave mask with this change. The public fixture verifies the depth export case, not that request.

Follow-up another contributor can pick up: the next refusal for that pass is a per-pixel discard written as a compare that writes EXEC, then s_cbranch_execz to a null export, with descriptor and buffer loads on the surviving path before the depth export.

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. (No README row or documented command changes; the test is registered in tests/cmake/native_raw_depth_export.cmake.)
  • I did not include game files, dumps, distribution links or secrets.

This change was AI-assisted.

🤖 Generated with Claude Code

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:5566878706 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3612). Originally posted by [Not-Saii](https://github.com/Not-Saii) on 2026-11-30T14:07:39Z. --- ## Change A raw fixed VS/PS pair whose pixel stage ends in an uncompressed MRTZ export of depth alone, with no colour export, was refused by the raw graphics front end with `raw graphics varying or system export requires a stage interface`. `read_raw_graphics` now treats that export as the pixel stage's output and adds one `SV_Depth` signature row, which the existing emitter already lowers for reviewed containers. What stays refused: - stencil or coverage channels in the MRTZ export, and a compressed export: same refusal as before; - depth next to a colour export: refused by name (`raw depth export next to a color export requires a stage interface`), because a raw colour target is typed without a signature and would otherwise fail later as `color target absent from pixel signature`; - the mesh pixel caller (`translate_mesh_pixel_program`): unchanged, the new case is gated on `!mesh_pixel`. Refs #3541. This is the first refusal of the depth-only fixed slot 57 pass reported there ([comment](https://github.com/R0Y00/Xbox2Windows/issues/3541#issuecomment-7280029923)). **It does not make that pass translate on its own:** with this change its next refusal is `graphics branch on a wave mask`. Shared interface: `read_raw_graphics` in `src/gfx1013_compute_native.cpp`. Open PR #3527 edits the same function in different lines, so a small merge conflict is possible whichever lands second. ## Verification Commit `5a2d2799` on `main` `077bff3a`. Windows 11 build 26300, MSVC 19.44, Windows SDK 10.0.26100 (DXC from the SDK), release preset. No GPU is involved; the checks compile and inspect bytecode. ```powershell cmake --build --preset release --target compile_dxil ctest --preset release --no-tests=error -R '^native_(raw_depth_export|fixed_graphics_psi1|direct_container|graphics_interface_library|direct_mesh|compile_dxil_refusals|compile_dxil_watch|compile_dxil_rekey)$' ``` | Test | Result | |---|---| | `native_raw_depth_export` (new) | passed | | `native_fixed_graphics_psi1` | passed | | `native_direct_container` | passed | | `native_graphics_interface_library` | passed | | `native_compile_dxil_refusals` | passed | | `native_compile_dxil_rekey` | passed | | `native_compile_dxil_watch` | passed | | `native_direct_mesh` | **failed, also on unmodified `main`** | `native_direct_mesh` fails at its `too-many-primitives` case (the compiler accepts a program the test expects it to refuse with `exceeds declared range`). I rebuilt `compile_dxil` from unmodified `main` `077bff3a` and got the same assertion, so this change does not cause it. I have not bisected it. Before and after for the new fixture, run directly: ```powershell python -B tests\native_raw_depth_export_check.py out\build\release\compile_dxil.exe <DXC directory> ``` | | `main` `077bff3a` | this commit | |---|---|---| | first case (depth alone) | `native compute +0x20: raw graphics varying or system export requires a stage interface` | compiles; the pixel stage's only output is `SV_Depth` | | whole check | fails at the first case | exit 0 | Not run: tests driven by other executables (the draw consumer, `d3d12_xs.dll`), because only `compile_dxil` was rebuilt. The pull request check does not run the `native_*` tests. ## Evidence and follow-up The fixture is source-built: raw gfx1013 words assembled in the test, reusing the vertex program, root and helpers of `tests/native_fixed_graphics_psi1_check.py`. MIT, no external inputs. Cases: - depth alone compiles; `dxc -dumpbin` shows `SV_Depth`, a `storeOutput.f32`, and no `SV_Target`; - a second process compiles the same request with `frontend_cache_hit=1` and byte-identical pixel bytecode, so the depth row survives the front-end pair cache; - control: the same program exporting colour compiles and has no depth output; - negative controls: MRTZ enable masks 3, 5 and 2, a compressed MRTZ export, and colour plus depth are each refused, with no bytecode published. Assumptions and limits: - The fixture takes the no-sidecar raw path. The pass in #3541 reaches the same reader through an interface-library match that is not byte-exact; that route is not exercised here. - Nothing here draws. The check covers the compiled stage's interface, not a depth value landing in a depth target. - Local-data result, for context only: the request for the pass in #3541 moves from the refusal above to `graphics branch on a wave mask` with this change. The public fixture verifies the depth export case, not that request. Follow-up another contributor can pick up: the next refusal for that pass is a per-pixel discard written as a compare that writes EXEC, then `s_cbranch_execz` to a null export, with descriptor and buffer loads on the surviving path before the depth export. ## 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. - [ ] I updated README/docs when a capability or build requirement changed. (No README row or documented command changes; the test is registered in `tests/cmake/native_raw_depth_export.cmake`.) - [x] I did not include game files, dumps, distribution links or secrets. This change was AI-assisted. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
R0Y00 commented 2026-11-30 20:02:41 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-30T20:02:41Z.

Review: APPROVED


Reviewed 5a2d27993840146534d43d64347bd41c3dd793bc. The raw fixed-pair reader admits uncompressed depth-only MRTZ and emits SV_Depth. The fixture checks the cold compile, frontend cache round trip, color control, and the stencil, coverage, compressed, and mixed-export refusals.

On Windows with SDK/DXC 10.0.26100.0, ctest --test-dir <build> --no-tests=error -j1 -R '^native_raw_depth_export$' --output-on-failure passed. I temporarily disabled the new SV_Depth signature insertion locally. The build succeeded and the test failed on the positive control with unmapped depth, stencil or coverage export. I restored the source after the check.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6119593881 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3612#pullrequestreview-6119593881). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-30T20:02:41Z. **Review:** APPROVED --- Reviewed `5a2d27993840146534d43d64347bd41c3dd793bc`. The raw fixed-pair reader admits uncompressed depth-only MRTZ and emits `SV_Depth`. The fixture checks the cold compile, frontend cache round trip, color control, and the stencil, coverage, compressed, and mixed-export refusals. On Windows with SDK/DXC 10.0.26100.0, `ctest --test-dir <build> --no-tests=error -j1 -R '^native_raw_depth_export$' --output-on-failure` passed. I temporarily disabled the new `SV_Depth` signature insertion locally. The build succeeded and the test failed on the positive control with `unmapped depth, stencil or coverage export`. I restored the source after the check.
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!3612
No description provided.