Shaders: guard conditional exports #655

Closed
github-bot wants to merge 1 commit from gh-pr/655/head into gh-pr/655/base
Owner

@⁠Halfect on GitHub · 2026-11-24 06:16 UTC · original
Halfect:fix/pixel-conditional-export → main · +76 −4 · 2 files · 1 commits · closed without merging

What

Non-final exports under an EXEC mask now use the existing guarded-block lowering, so disabled lanes do not overwrite their previous output. The final pixel done export keeps its existing discard behavior, and mesh exports are unchanged.

Adds a synthetic pixel regression that narrows EXEC around a non-final MRT0 export. The old lowering rejects it with a conditional export; the new lowering emits DXIL that passes the validator.

Offline title measurement

Compared 25,889 matched program labels from the local shader archive with translate --validate --list --jobs 4:

  • All 8 a conditional export blockers are gone.
  • 0 DXIL-validation regressions; previously validated programs are unchanged.
  • Those eight programs then reach other pre-existing limitations (six at scalar memory reads as data, two at packed-input handling), so this is an enabling correctness fix rather than a claim of additional fully validated title programs on main.

A local compatibility run combined with #621 also removed all eight blockers with no validation regressions. This branch itself is based directly on main and does not include #621.

Checks

  • cargo test --locked -p victory-shader --lib -- --test-threads=1: 70 passed, 0 failed.
  • cargo clippy --locked -p victory-shader --lib --tests -- -D warnings: clean.
  • cargo xtask policy: 151 files ok.

Offline translation and DXIL validation only; no title executable or world run, and no shader contents or extracted data included. AI-assisted (Kimi).

**@⁠Halfect** on GitHub · 2026-11-24 06:16 UTC · [original](https://github.com/Marvisak/VIctory/pull/655) `Halfect:fix/pixel-conditional-export` → `main` · +76 −4 · 2 files · 1 commits · closed without merging ## What Non-final exports under an EXEC mask now use the existing guarded-block lowering, so disabled lanes do not overwrite their previous output. The final pixel `done` export keeps its existing `discard` behavior, and mesh exports are unchanged. Adds a synthetic pixel regression that narrows EXEC around a non-final MRT0 export. The old lowering rejects it with `a conditional export`; the new lowering emits DXIL that passes the validator. ## Offline title measurement Compared 25,889 matched program labels from the local shader archive with `translate --validate --list --jobs 4`: - All **8** `a conditional export` blockers are gone. - **0 DXIL-validation regressions**; previously validated programs are unchanged. - Those eight programs then reach other pre-existing limitations (six at scalar memory reads as data, two at packed-input handling), so this is an enabling correctness fix rather than a claim of additional fully validated title programs on main. A local compatibility run combined with #621 also removed all eight blockers with no validation regressions. This branch itself is based directly on main and does not include #621. ## Checks - `cargo test --locked -p victory-shader --lib -- --test-threads=1`: **70 passed, 0 failed**. - `cargo clippy --locked -p victory-shader --lib --tests -- -D warnings`: clean. - `cargo xtask policy`: **151 files ok**. Offline translation and DXIL validation only; no title executable or world run, and no shader contents or extracted data included. AI-assisted (Kimi).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:11:44 +00:00
github-bot closed this pull request 2026-11-26 04:11:44 +00:00
Author
Owner

@⁠justr4mzi on GitHub · 2026-11-24 09:38 UTC · original

Independently measured PR #655 (b9c7699c) merged cleanly onto main (8e79c80) on Windows 11 with an AMD Radeon RX 6700 XT (RDNA2), Rust 1.98.1 (x86_64-pc-windows-msvc), and dxil.dll from Windows SDK 10.0.26100.0, against main (02f404e) baseline.

victory translate --validate (26,599 containers / 26,148 programs)

  • emit: a conditional export: 8 -> 0 (all 8 cleared).
  • Downstream shift matches the PR description:
    • emit: a scalar memory read as data: 604 -> 610 (+6)
    • emit: a packed input half no element holds: 166 -> 168 (+2)
  • Emitted / validated totals unchanged with 0 DXIL validation regressions:
    • VS/PS: 12,236 emitted / 12,160 validated
    • CS: 1,440 emitted / 1,417 validated
    • MS: 8,163 emitted / 8,101 validated

Build and checks

  • Clean merge onto 8e79c80 (crates/victory-shader/src/emit/lower.rs, emit/mod.rs).
  • cargo clippy -p victory-shader --lib -- -D warnings: clean.
  • cargo xtask policy: 153 files ok.
  • cargo build --release -p victory: succeeded.
  • No game data included; the title itself was not launched.

AI-assisted test execution and comparison (reviewed locally).

**@⁠justr4mzi** on GitHub · 2026-11-24 09:38 UTC · [original](https://github.com/Marvisak/VIctory/pull/655#issuecomment-7127691429) Independently measured PR #655 (`b9c7699c`) merged cleanly onto `main` (`8e79c80`) on Windows 11 with an AMD Radeon RX 6700 XT (RDNA2), Rust 1.98.1 (`x86_64-pc-windows-msvc`), and `dxil.dll` from Windows SDK `10.0.26100.0`, against `main` (`02f404e`) baseline. ### `victory translate --validate` (26,599 containers / 26,148 programs) - `emit: a conditional export`: **8 -> 0** (all 8 cleared). - Downstream shift matches the PR description: - `emit: a scalar memory read as data`: 604 -> 610 (+6) - `emit: a packed input half no element holds`: 166 -> 168 (+2) - Emitted / validated totals unchanged with **0 DXIL validation regressions**: - VS/PS: 12,236 emitted / 12,160 validated - CS: 1,440 emitted / 1,417 validated - MS: 8,163 emitted / 8,101 validated ### Build and checks - Clean merge onto `8e79c80` (`crates/victory-shader/src/emit/lower.rs`, `emit/mod.rs`). - `cargo clippy -p victory-shader --lib -- -D warnings`: clean. - `cargo xtask policy`: `153 files ok`. - `cargo build --release -p victory`: succeeded. - No game data included; the title itself was not launched. *AI-assisted test execution and comparison (reviewed locally).*
Author
Owner

@⁠Halfect on GitHub · 2026-11-24 13:23 UTC · original

Rebased onto current main ffe310e and fixed the call flagged in #801: the new regression now passes the fourth resource::track argument as None (the test has no per-lane descriptors, so this keeps the old behavior). Head is now 1bd52dc.

Validation on Windows:

  • a_conditional_pixel_export_is_guarded: passed, including its Windows DXIL validation (dxil.dll 10.0.26100.0).
  • cargo check --locked -p victory-shader --tests: passed.
  • CPU-only library suite, explicitly skipping diff_tests, valu_tests, waterfall_tests, and stub_pipeline_is_created: 98 passed, 0 failed, 1 ignored.
  • cargo clippy --locked -p victory-shader --lib --tests -- -D warnings: clean.
  • cargo xtask policy: 154 files ok.

No GPU execution was used for this validation.

**@⁠Halfect** on GitHub · 2026-11-24 13:23 UTC · [original](https://github.com/Marvisak/VIctory/pull/655#issuecomment-7132763330) Rebased onto current main `ffe310e` and fixed the call flagged in #801: the new regression now passes the fourth `resource::track` argument as `None` (the test has no per-lane descriptors, so this keeps the old behavior). Head is now `1bd52dc`. Validation on Windows: - `a_conditional_pixel_export_is_guarded`: passed, including its Windows DXIL validation (dxil.dll 10.0.26100.0). - `cargo check --locked -p victory-shader --tests`: passed. - CPU-only library suite, explicitly skipping `diff_tests`, `valu_tests`, `waterfall_tests`, and `stub_pipeline_is_created`: **98 passed, 0 failed, 1 ignored**. - `cargo clippy --locked -p victory-shader --lib --tests -- -D warnings`: clean. - `cargo xtask policy`: **154 files ok**. No GPU execution was used for this validation.
Author
Owner

@⁠DeerSilver on GitHub · 2026-11-24 14:04 UTC · original

Re-tested head 1bd52dc merged onto main ffe310e (clean merge) on NVIDIA GeForce RTX 5060 Laptop GPU (Blackwell), driver 621.24, Windows 11 26300, Rust 1.98.1. No game files: the test suite only. Pass, with no local change: the resource::track call from #801 now builds.

  • a_conditional_pixel_export_is_guarded passes. It doesn't use the GPU, but its DXIL check did run: the Windows SDK 10.0.26100.0\x64\dxil.dll is installed here, so Validator::load found it.
  • cargo test --workspace --locked, the full workspace including the VALU and waterfall GPU groups (which ran on the RTX 5060): 343 passed, 0 failed, 6 ignored, against 342 / 6 on main.
  • cargo clippy --workspace --all-targets --locked -- -D warnings: clean.

AI-assisted (Claude Code).

**@⁠DeerSilver** on GitHub · 2026-11-24 14:04 UTC · [original](https://github.com/Marvisak/VIctory/pull/655#issuecomment-7133795306) Re-tested head `1bd52dc` merged onto `main` `ffe310e` (clean merge) on **NVIDIA GeForce RTX 5060 Laptop GPU** (Blackwell), driver 621.24, Windows 11 26300, Rust 1.98.1. No game files: the test suite only. **Pass**, with no local change: the `resource::track` call from #801 now builds. - `a_conditional_pixel_export_is_guarded` passes. It doesn't use the GPU, but its DXIL check did run: the Windows SDK `10.0.26100.0\x64\dxil.dll` is installed here, so `Validator::load` found it. - `cargo test --workspace --locked`, the full workspace including the VALU and waterfall GPU groups (which ran on the RTX 5060): **343 passed, 0 failed, 6 ignored**, against 342 / 6 on `main`. - `cargo clippy --workspace --all-targets --locked -- -D warnings`: clean. AI-assisted (Claude Code).
Author
Owner

@⁠molodayamama on GitHub · 2026-11-24 14:04 UTC · original

Independent Windows check of 1bd52dcc9e4d2f863123f32a944c7ee4412c6852 (Windows 10 22H2 19045, Rust 1.98.1, MSVC x64).

  • cargo test -p victory-shader --locked --lib a_conditional_pixel_export_is_guarded -- --test-threads=1 --nocapture: 1 passed.

The synthetic pixel shader fixture verified that a conditional export is emitted with a guard. This was a lowering check without rendering.

Only source-built synthetic fixtures were used. AI-assisted verification.

**@⁠molodayamama** on GitHub · 2026-11-24 14:04 UTC · [original](https://github.com/Marvisak/VIctory/pull/655#issuecomment-7133799226) Independent Windows check of `1bd52dcc9e4d2f863123f32a944c7ee4412c6852` (Windows 10 22H2 19045, Rust 1.98.1, MSVC x64). - `cargo test -p victory-shader --locked --lib a_conditional_pixel_export_is_guarded -- --test-threads=1 --nocapture`: 1 passed. The synthetic pixel shader fixture verified that a conditional export is emitted with a guard. This was a lowering check without rendering. Only source-built synthetic fixtures were used. AI-assisted verification.
Author
Owner

@⁠Halfect on GitHub · 2026-11-24 14:22 UTC · original

Thanks @⁠DeerSilver and @⁠molodayamama for the quick re-tests of 1bd52dc — good to have the full workspace suite green on the RTX 5060 and the guarded-export fixture confirmed on a second Windows setup. Nothing further from my side on this head; ready for review.

**@⁠Halfect** on GitHub · 2026-11-24 14:22 UTC · [original](https://github.com/Marvisak/VIctory/pull/655#issuecomment-7134261387) Thanks @⁠DeerSilver and @⁠molodayamama for the quick re-tests of `1bd52dc` — good to have the full workspace suite green on the RTX 5060 and the guarded-export fixture confirmed on a second Windows setup. Nothing further from my side on this head; ready for review.
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-24 14:31 UTC · original

I ran a synthetic raster comparison on 1bd52dc. A 4×2 full-screen triangle uses complementary EXEC masks for two non-final exports to MRT0, then restores EXEC and exports to MRT1. On the Windows default hardware adapter and explicit WARP, MRT0 was red in the left two columns and green in the right two. All eight pixels in MRT1 were blue. Both images matched an independent DXC HLSL reference pixel for pixel.

In a local control with the non-final export guard removed, the shader still passed DXIL validation, but the second MRT0 export painted all eight pixels green on the hardware adapter. MRT1 still read back blue.

Test commit adds the dual-target readback to the test harness and keeps the original lowering test. victory-shader --lib passed 122 tests with one benchmark ignored. Clippy and the asset check passed.

**@⁠fuzeofficlal** on GitHub · 2026-11-24 14:31 UTC · [original](https://github.com/Marvisak/VIctory/pull/655#issuecomment-7134518787) I ran a synthetic raster comparison on `1bd52dc`. A 4×2 full-screen triangle uses complementary EXEC masks for two non-final exports to MRT0, then restores EXEC and exports to MRT1. On the Windows default hardware adapter and explicit WARP, MRT0 was red in the left two columns and green in the right two. All eight pixels in MRT1 were blue. Both images matched an independent DXC HLSL reference pixel for pixel. In a local control with the non-final export guard removed, the shader still passed DXIL validation, but the second MRT0 export painted all eight pixels green on the hardware adapter. MRT1 still read back blue. [Test commit](https://github.com/fuzeofficlal/VIctory/commit/7ea90bf916909a258ba7cbd3907b65fec2df7580) adds the dual-target readback to the test harness and keeps the original lowering test. `victory-shader --lib` passed 122 tests with one benchmark ignored. Clippy and the asset check passed.
Author
Owner

@⁠Halfect on GitHub · 2026-11-24 14:48 UTC · original

Thanks @⁠fuzeofficlal for the raster cross-check on 1bd52dc. The result matches the intended semantics exactly: with complementary EXEC masks, the guarded non-final exports leave the disabled lanes' previous MRT0 values untouched (red/green split), and your control without the guard painting all eight pixels green confirms the guard is what carries the behavior. Pixel-for-pixel agreement with the independent DXC HLSL reference on both hardware and WARP is a strong signal.

I'll keep this branch as-is: its synthetic regression covers the lowering plus DXIL validation, and your dual-target readback harness is a useful external check on top of it. Nothing further from my side on this head; ready for review.

**@⁠Halfect** on GitHub · 2026-11-24 14:48 UTC · [original](https://github.com/Marvisak/VIctory/pull/655#issuecomment-7134968419) Thanks @⁠fuzeofficlal for the raster cross-check on `1bd52dc`. The result matches the intended semantics exactly: with complementary EXEC masks, the guarded non-final exports leave the disabled lanes' previous MRT0 values untouched (red/green split), and your control without the guard painting all eight pixels green confirms the guard is what carries the behavior. Pixel-for-pixel agreement with the independent DXC HLSL reference on both hardware and WARP is a strong signal. I'll keep this branch as-is: its synthetic regression covers the lowering plus DXIL validation, and your dual-target readback harness is a useful external check on top of it. Nothing further from my side on this head; ready for review.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 00:27 UTC · original

Automated triage for the maintainers. Closing because this change is already in main, or main has since replaced the code it patches.

Main handles the title's 8 conditional exports (13091f6e: a non-done pixel export stores in every lane when the done export discards the lanes its guard leaves out; emit/lower.rs export()).

If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.

**@⁠Marvisak** on GitHub · 2026-11-25 00:27 UTC · [original](https://github.com/Marvisak/VIctory/pull/655#issuecomment-7148522032) Automated triage for the maintainers. Closing because this change is already in `main`, or `main` has since replaced the code it patches. Main handles the title's 8 conditional exports (13091f6e: a non-done pixel export stores in every lane when the done export discards the lanes its guard leaves out; emit/lower.rs export()). If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!655
No description provided.