Shaders: gather stencil coverage as unsigned texels #3918

Open
faycalbaklouti wants to merge 1 commit from upstream-pr/3918 into main
faycalbaklouti commented 2026-11-30 23:02:42 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by faycalbaklouti on 2026-11-30T23:02:42Z.


What

Mark 2D and 2D-array stencil SRVs as unsigned without assigning a buffer stride. A full-width green level-zero gather dispatches on the bound view’s kind and returns unsigned coverage bits for stencil, while ordinary float views retain the float gather. The raw-buffer guard masks off view-kind bits before checking stride. The regressions cover shader and placed descriptors, non-stencil controls, and synthetic shader lowering.

How it was tested

Windows MSVC target under Wine: cargo xwin test --locked --target x86_64-pc-windows-msvc -p <package> --lib --no-fail-fast for each suite, adding -- --exact <name> --nocapture --test-threads=1 for the regressions. Compared 45dc09fd79 with clean base 63bcca43c6.

victory-shader library suite:
Head (exit 101):
test result: FAILED. 215 passed; 88 failed; 3 ignored; 0 measured; 0 filtered out; finished in 1.32s
Clean base (exit 101):
test result: FAILED. 214 passed; 88 failed; 3 ignored; 0 measured; 0 filtered out; finished in 1.32s
Exact test: emit::synthetic_tests::green_gather_requests_view_metadata
Head (exit 0):
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 305 filtered out; finished in 0.00s
Clean base (exit 0):
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 305 filtered out; finished in 0.00s
Base with only the test applied (exit 101):
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 305 filtered out; finished in 0.00s

victory-gpu library suite:
Head (exit 0):
test result: ok. 232 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in 0.55s
Clean base (exit 0):
test result: ok. 231 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in 0.55s
Exact test: descriptor::host::tests::stencil_texture_metadata_has_kind_but_no_buffer_stride
Head (exit 0):
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 232 filtered out; finished in 0.00s
Clean base (exit 0):
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 232 filtered out; finished in 0.00s
Base with only the test applied (exit 101):
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 232 filtered out; finished in 0.00s

The same 88 shader tests failed by name and diagnostic on head and base: the CPU-only Wine runner has no D3D12 Shader Model 6.6 device or WARP fallback. The exact green-gather test passed, and a Wine loader trace shows native dxil.dll loaded during the test. The test does not execute the shader on a GPU. Zero matches on the clean base are expected for newly added tests. With only the test hunks applied to base, the regression assertions failed as expected.

Both workspace Clippy modes (default and all features, with -D warnings) exited 0 on head and base. The Windows-target workspace test under Wine exited 101 on both, stopping in victory-hle: modules::net::tests::only_loopback_is_reachable hit a missing WSAConnectByList export on the isolated runner, and modules::xgamesave::tests::a_kept_blob_past_the_link_limit_is_copied did not observe the expected NTFS hard-link limit. Native Windows CI remains the final gate.


Radicle project hub (open-source porting and preservation history): https://radicle.network/nodes/rosa.radicle.network/rad:z3rqQw7796wMbgj8RszExtWR4wMSE
Live development stream: https://vdo.ninja/?view=gta6rtx4090live1080p60

<!-- greyfinch-sync:Marvisak/VIctory:issue:5575370077 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3918). Originally posted by [faycalbaklouti](https://github.com/faycalbaklouti) on 2026-11-30T23:02:42Z. --- ## What Mark 2D and 2D-array stencil SRVs as unsigned without assigning a buffer stride. A full-width green level-zero gather dispatches on the bound view’s kind and returns unsigned coverage bits for stencil, while ordinary float views retain the float gather. The raw-buffer guard masks off view-kind bits before checking stride. The regressions cover shader and placed descriptors, non-stencil controls, and synthetic shader lowering. ## How it was tested Windows MSVC target under Wine: `cargo xwin test --locked --target x86_64-pc-windows-msvc -p <package> --lib --no-fail-fast` for each suite, adding `-- --exact <name> --nocapture --test-threads=1` for the regressions. Compared `45dc09fd79` with clean base `63bcca43c6`. ```text victory-shader library suite: Head (exit 101): test result: FAILED. 215 passed; 88 failed; 3 ignored; 0 measured; 0 filtered out; finished in 1.32s Clean base (exit 101): test result: FAILED. 214 passed; 88 failed; 3 ignored; 0 measured; 0 filtered out; finished in 1.32s Exact test: emit::synthetic_tests::green_gather_requests_view_metadata Head (exit 0): test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 305 filtered out; finished in 0.00s Clean base (exit 0): test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 305 filtered out; finished in 0.00s Base with only the test applied (exit 101): test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 305 filtered out; finished in 0.00s victory-gpu library suite: Head (exit 0): test result: ok. 232 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in 0.55s Clean base (exit 0): test result: ok. 231 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in 0.55s Exact test: descriptor::host::tests::stencil_texture_metadata_has_kind_but_no_buffer_stride Head (exit 0): test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 232 filtered out; finished in 0.00s Clean base (exit 0): test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 232 filtered out; finished in 0.00s Base with only the test applied (exit 101): test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 232 filtered out; finished in 0.00s ``` The same 88 shader tests failed by name and diagnostic on head and base: the CPU-only Wine runner has no D3D12 Shader Model 6.6 device or WARP fallback. The exact green-gather test passed, and a Wine loader trace shows native `dxil.dll` loaded during the test. The test does not execute the shader on a GPU. Zero matches on the clean base are expected for newly added tests. With only the test hunks applied to base, the regression assertions failed as expected. Both workspace Clippy modes (default and all features, with `-D warnings`) exited 0 on head and base. The Windows-target workspace test under Wine exited 101 on both, stopping in `victory-hle`: `modules::net::tests::only_loopback_is_reachable` hit a missing `WSAConnectByList` export on the isolated runner, and `modules::xgamesave::tests::a_kept_blob_past_the_link_limit_is_copied` did not observe the expected NTFS hard-link limit. Native Windows CI remains the final gate. --- **Radicle project hub (open-source porting and preservation history):** https://radicle.network/nodes/rosa.radicle.network/rad:z3rqQw7796wMbgj8RszExtWR4wMSE **Live development stream:** https://vdo.ninja/?view=gta6rtx4090live1080p60
cloph-dsp commented 2026-12-01 12:24:00 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by cloph-dsp on 2026-12-01T12:24:00Z.


Verification of this PR (AI-assisted: Hy4 flash), source only, no game data.

Windows / rustc 1.100.0 / MSVC. Worktree at head 45dc09fd, dedicated per-worktree CARGO_TARGET_DIR (D:\Victory-Contrib\target-3918), nothing shared.

Negative control on base 63bcca43:

  • git grep -F stencil_texture_metadata_has_kind_but_no_buffer_stride 63bcca43 -- . -> exit 1 (new)
  • git grep -F green_gather_requests_view_metadata 63bcca43 -- . -> exit 1 (new)
    Whitespace: git diff --check 63bcca43..45dc09fd -> exit 0, clean.
cargo test --locked -p victory-gpu --lib -- descriptor::host::tests::stencil_texture_metadata_has_kind_but_no_buffer_stride --exact --test-threads=1 --quiet

-> test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 232 filtered out, exit 0.

cargo test --locked -p victory-shader --lib -- emit::synthetic_tests::green_gather_requests_view_metadata --exact --test-threads=1 --quiet

-> test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 305 filtered out, exit 0.

Both are synthetic: the gpu test runs the descriptor metadata path with a made-up view, and the shader test checks the emitted gather kind; neither opens a D3D12 device.

GPU/driver: N/A.

Verdict: PASS for both new tests on this host.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7311075787 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3918#issuecomment-7311075787). Originally posted by [cloph-dsp](https://github.com/cloph-dsp) on 2026-12-01T12:24:00Z. --- Verification of this PR (AI-assisted: Hy4 flash), source only, no game data. Windows / rustc 1.100.0 / MSVC. Worktree at head 45dc09fd, dedicated per-worktree CARGO_TARGET_DIR (D:\Victory-Contrib\target-3918), nothing shared. Negative control on base 63bcca43: - `git grep -F stencil_texture_metadata_has_kind_but_no_buffer_stride 63bcca43 -- .` -> exit 1 (new) - `git grep -F green_gather_requests_view_metadata 63bcca43 -- .` -> exit 1 (new) Whitespace: `git diff --check 63bcca43..45dc09fd` -> exit 0, clean. ``` cargo test --locked -p victory-gpu --lib -- descriptor::host::tests::stencil_texture_metadata_has_kind_but_no_buffer_stride --exact --test-threads=1 --quiet ``` -> `test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 232 filtered out`, exit 0. ``` cargo test --locked -p victory-shader --lib -- emit::synthetic_tests::green_gather_requests_view_metadata --exact --test-threads=1 --quiet ``` -> `test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 305 filtered out`, exit 0. Both are synthetic: the gpu test runs the descriptor metadata path with a made-up view, and the shader test checks the emitted gather kind; neither opens a D3D12 device. GPU/driver: N/A. Verdict: PASS for both new tests on this host.
passerbyyhx commented 2026-12-01 12:32:52 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by passerbyyhx on 2026-12-01T12:32:52Z.


Executed the translated shader on RTX 4090 Laptop and WARP at 45dc09fd and its parent. The two stencil formats were tested as actual stencil-plane SRVs, both 2D and array slice 1, alongside a float control. All 32 lanes returned four ordered values matching the oracle for all five bindings on both revisions. The emitted DXIL on the PR contained both i32 and f32 gather paths where the parent contained only f32; the production descriptor metadata check failed on the parent and passed on the PR. Neither revision produced a GPU-based validation error on the 4090. These devices showed the metadata and DXIL change with identical correct pixel data.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7311290870 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3918#issuecomment-7311290870). Originally posted by [passerbyyhx](https://github.com/passerbyyhx) on 2026-12-01T12:32:52Z. --- Executed the translated shader on RTX 4090 Laptop and WARP at 45dc09fd and its parent. The two stencil formats were tested as actual stencil-plane SRVs, both 2D and array slice 1, alongside a float control. All 32 lanes returned four ordered values matching the oracle for all five bindings on both revisions. The emitted DXIL on the PR contained both i32 and f32 gather paths where the parent contained only f32; the production descriptor metadata check failed on the parent and passed on the PR. Neither revision produced a GPU-based validation error on the 4090. These devices showed the metadata and DXIL change with identical correct pixel data.
faycalbaklouti commented 2026-12-01 15:13:32 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by faycalbaklouti on 2026-12-01T15:13:32Z.


Thanks to @cloph-dsp for the independent source and test check, and to @passerbyyhx for the independent RTX 4090 Laptop and WARP runs on #3918.

Project hub README on Radicle

<!-- greyfinch-sync:Marvisak/VIctory:comment:7315554768 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3918#issuecomment-7315554768). Originally posted by [faycalbaklouti](https://github.com/faycalbaklouti) on 2026-12-01T15:13:32Z. --- Thanks to @cloph-dsp for the independent source and test check, and to @passerbyyhx for the independent RTX 4090 Laptop and WARP runs on #3918. [Project hub README on Radicle](https://radicle.network/nodes/rosa.radicle.network/rad:z3rqQw7796wMbgj8RszExtWR4wMSE)
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/3918:upstream-pr/3918'
git switch 'upstream-pr/3918'

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/3918'
git switch 'upstream-pr/3918'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/3918'
git switch 'upstream-pr/3918'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/3918'
git switch 'main'
git merge --squash 'upstream-pr/3918'
git switch 'main'
git merge --ff-only 'upstream-pr/3918'
git switch 'main'
git merge 'upstream-pr/3918'
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
Marvisak/VIctory!3918
No description provided.