shader: gather opaque coverage as unsigned bits for stencil SRVs #1519

Open
faycalbaklouti wants to merge 1 commit from upstream-pr/1519 into main
faycalbaklouti commented 2026-11-28 17:54:57 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by faycalbaklouti on 2026-11-28T17:54:57Z.


Problem

The 80x45 opaque tile classifier gathers a green-channel coverage quad from a stencil-plane SRV (guest format 120 -> host DXGI_FORMAT_X24_TYPELESS_G8_UINT) and tests its integer stencil bits. Previously view_stride_and_kind() returned (None, 0) for all non-buffer views, so lower.rs always emitted textureGather.f32 instead of textureGather.i32 for unsigned integer stencil SRVs.

Solution

  • In crates/victory-gpu/src/descriptor/host.rs, teach view_stride_and_kind() to propagate VIEW_INTEGER for stencil-plane texture SRVs (pc_format(format) in 22 | 47, i.e., X24_TYPELESS_G8_UINT / X32_TYPELESS_G8X24_UINT), with unit test stencil_view_kind_follows_the_view_not_the_depth_resource.
  • In crates/victory-shader/src/emit/lower.rs, branch on the runtime view kind (integer_view) for the image_gather4_lz opaque coverage gather so stencil SRVs execute textureGather.i32 (uint4 handle) while float views retain textureGather.f32.

Verification

  • Verified with cargo test -p victory-shader --lib and cargo test -p victory-gpu --lib (0 failures).
  • Verified on Linux + NVIDIA RTX 5090 (595.112.07) and Blackwell (620.70.06) against initialized D24S8 stencil fixtures and live dorm/walk-around/cafeteria scenes.

About our fork & censorship-resistant preservation effort:
This fix comes from our open-source Linux (GE-Proton) + NVIDIA porting effort (gta6-vi-port) and censorship-resistant peer-to-peer Radicle archival hub (234+ community porting repos mirrored & seeded on P2P Radicle so community research survives takedowns):

<!-- greyfinch-sync:fxceless/victory-fork:issue:5543035841 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/1519). Originally posted by [faycalbaklouti](https://github.com/faycalbaklouti) on 2026-11-28T17:54:57Z. --- ## Problem The 80x45 opaque tile classifier gathers a green-channel coverage quad from a stencil-plane SRV (guest format `120` -> host `DXGI_FORMAT_X24_TYPELESS_G8_UINT`) and tests its integer stencil bits. Previously `view_stride_and_kind()` returned `(None, 0)` for all non-buffer views, so `lower.rs` always emitted `textureGather.f32` instead of `textureGather.i32` for unsigned integer stencil SRVs. ## Solution - In `crates/victory-gpu/src/descriptor/host.rs`, teach `view_stride_and_kind()` to propagate `VIEW_INTEGER` for stencil-plane texture SRVs (`pc_format(format)` in `22 | 47`, i.e., `X24_TYPELESS_G8_UINT` / `X32_TYPELESS_G8X24_UINT`), with unit test `stencil_view_kind_follows_the_view_not_the_depth_resource`. - In `crates/victory-shader/src/emit/lower.rs`, branch on the runtime view kind (`integer_view`) for the `image_gather4_lz` opaque coverage gather so stencil SRVs execute `textureGather.i32` (`uint4` handle) while float views retain `textureGather.f32`. ## Verification - Verified with `cargo test -p victory-shader --lib` and `cargo test -p victory-gpu --lib` (0 failures). - Verified on Linux + NVIDIA RTX 5090 (`595.112.07`) and Blackwell (`620.70.06`) against initialized `D24S8` stencil fixtures and live dorm/walk-around/cafeteria scenes. --- **About our fork & censorship-resistant preservation effort:** This fix comes from our open-source Linux (GE-Proton) + NVIDIA porting effort (`gta6-vi-port`) and censorship-resistant peer-to-peer Radicle archival hub (**234+ community porting repos mirrored & seeded on P2P Radicle** so community research survives takedowns): - **Radicle Project Hub (README, forks, bring-up issues & 234+ P2P mirrors):** https://radicle.network/nodes/rosa.radicle.network/rad:z3rqQw7796wMbgj8RszExtWR4wMSE - **Live 1080p60 Open-Source Development Stream:** linked in the Radicle Project Hub README above.
Filip722 commented 2026-11-28 19:43:51 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by Filip722 on 2026-11-28T19:43:51Z.


I independently checked the descriptor metadata on 368967f8 and this PR at f6da9fc8, using Rust 1.98.1 in a Windows MSVC build under GE-Proton11-14 on Bazzite.

A local synthetic fixture checks 2D and 2D-array stencil SRVs for the two native stencil formats and the guest format that maps to X24/G8. It covers object and placed views and verifies the packed table word. The fixture failed on main and passed on this PR. The existing integer typed-buffer fixture passed on both. Float and depth-only views kept their original metadata on the patched run.

This verifies the descriptor half of the change. GPU gather execution and title rendering are still unmeasured here.

Assisted by Codex (GPT-6.2-Sol High).

<!-- greyfinch-sync:fxceless/victory-fork:comment:7244762939 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/1519#issuecomment-7244762939). Originally posted by [Filip722](https://github.com/Filip722) on 2026-11-28T19:43:51Z. --- I independently checked the descriptor metadata on `368967f8` and this PR at `f6da9fc8`, using Rust 1.98.1 in a Windows MSVC build under GE-Proton11-14 on Bazzite. A local synthetic fixture checks 2D and 2D-array stencil SRVs for the two native stencil formats and the guest format that maps to X24/G8. It covers object and placed views and verifies the packed table word. The fixture failed on main and passed on this PR. The existing integer typed-buffer fixture passed on both. Float and depth-only views kept their original metadata on the patched run. This verifies the descriptor half of the change. GPU gather execution and title rendering are still unmeasured here. Assisted by Codex (GPT-6.2-Sol High).
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/1519:upstream-pr/1519'
git switch 'upstream-pr/1519'

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/1519'
git switch 'upstream-pr/1519'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1519'
git switch 'upstream-pr/1519'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1519'
git switch 'main'
git merge --squash 'upstream-pr/1519'
git switch 'main'
git merge --ff-only 'upstream-pr/1519'
git switch 'main'
git merge 'upstream-pr/1519'
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
fxceless/victory-fork!1519
No description provided.