Skip to content

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

Merged
R0Y00 merged 1 commit into
R0Y00:mainfrom
Not-Saii:native/raw-depth-export
Nov 30, 2026
Merged

R0Y00 merged 1 commit into
R0Y00:mainfrom
Not-Saii:native/raw-depth-export

Conversation

@Not-Saii

Copy link
Copy Markdown
Contributor

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:

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

A raw fixed VS/PS pair whose pixel stage ends in an uncompressed MRTZ
export of depth alone was refused with "raw graphics varying or system
export requires a stage interface". The raw reader now treats that export
as the pixel stage's output and adds one SV_Depth row, which the existing
emitter already lowers.

Stencil and coverage channels and a compressed export keep the refusal.
Depth next to a color export is refused by name, because a raw color
target is typed without a signature. The mesh pixel caller is unchanged.

Refs R0Y00#3541

Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com>

@R0Y00 R0Y00 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@R0Y00
R0Y00 merged commit d597085 into R0Y00:main Nov 30, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants