Shader tests: bind raw SRVs in the waterfall buffer test #102

Open
github-bot wants to merge 1 commit from github-bot/gh-102 into main AGit
Owner

@⁠vicennpacheco on GitHub · 2026-11-24 21:29 UTC · original
vicennpacheco:fix/waterfall-raw-buffer-views → main · +6 −2 · 1 files · 1 commits · open

Problem

emit::waterfall_tests::lanes_load_from_the_buffer_their_nested_arms_chose fails on AMD GCN 5 hardware (Vega 8 / gfx90c):

  • Expected: [100..115, 216..223, 0..0]
  • Got: [100..107, 0..0]

Root cause

WATERFALL_JOINED_BUFFER_WAVE32 lowers its untyped buffer_load_dword ... offen to a ByteAddressBuffer handle (dx.op.annotateHandle with ResourceProperties { i32 11, i32 0 }, dx.op.rawBufferLoad.f32, verified with dxc -dumpbin), matching victory-gpu's raw_window contract that binds structured views as raw (DXGI_FORMAT_R32_TYPELESS, D3D12_BUFFER_SRV_FLAG_RAW).

However, the test created Stride::Structured(4) SRVs (DXGI_FORMAT_UNKNOWN, NumElements = 32, StructureByteStride = 4, Flags = NONE). On GCN 5, structured V# descriptors store NUM_RECORDS in elements (32) rather than bytes (unlike RDNA / GFX10+), so raw byte-offset loads (lane * 4) pass bounds checks only for lanes 0..7 (0..28 < 32) and return 0 for lanes 8..23 (32..92 >= 32). (Doubling first/second to 64 elements with Stride::Structured(4) confirmed this directly: lanes 0..15 succeeded and lanes 16..23 returned 0.)

Fix

Bind Stride::Raw for both buffer SRVs in lanes_load_from_the_buffer_their_nested_arms_chose, matching the emitted ByteAddressBuffer handle and victory-gpu's raw_window host views.

Verification

Tested on Windows 11, AMD Radeon Vega 8 iGPU (Ryzen 7 5825U, GCN 5 / gfx90c, PCI 1002:15E7, AMD driver 31.0.21921.13001), Rust 1.98.1 (x86_64-pc-windows-msvc), without game files:

  • cargo test -p victory-shader --lib -- waterfall_tests: 5 passed, 0 failed (both Vega 8 hardware and WARP)
  • VICTORY_D3D12_DEBUG=1 cargo test -p victory-shader --lib -- waterfall_tests: 5 passed, 0 failed, no debug-layer errors
  • cargo clippy -p victory-shader --tests -- -D warnings: clean

(AI-assisted investigation and patch.)

**@⁠vicennpacheco** on GitHub · 2026-11-24 21:29 UTC · [original](https://github.com/fxceless/victory-fork/pull/102) `vicennpacheco:fix/waterfall-raw-buffer-views` → `main` · +6 −2 · 1 files · 1 commits · open ### Problem `emit::waterfall_tests::lanes_load_from_the_buffer_their_nested_arms_chose` fails on AMD GCN 5 hardware (Vega 8 / `gfx90c`): - Expected: `[100..115, 216..223, 0..0]` - Got: `[100..107, 0..0]` ### Root cause `WATERFALL_JOINED_BUFFER_WAVE32` lowers its untyped `buffer_load_dword ... offen` to a `ByteAddressBuffer` handle (`dx.op.annotateHandle` with `ResourceProperties { i32 11, i32 0 }`, `dx.op.rawBufferLoad.f32`, verified with `dxc -dumpbin`), matching `victory-gpu`'s `raw_window` contract that binds structured views as raw (`DXGI_FORMAT_R32_TYPELESS`, `D3D12_BUFFER_SRV_FLAG_RAW`). However, the test created `Stride::Structured(4)` SRVs (`DXGI_FORMAT_UNKNOWN`, `NumElements = 32`, `StructureByteStride = 4`, `Flags = NONE`). On GCN 5, structured `V#` descriptors store `NUM_RECORDS` in elements (32) rather than bytes (unlike RDNA / GFX10+), so raw byte-offset loads (`lane * 4`) pass bounds checks only for lanes `0..7` (`0..28 < 32`) and return `0` for lanes `8..23` (`32..92 >= 32`). (Doubling `first`/`second` to 64 elements with `Stride::Structured(4)` confirmed this directly: lanes `0..15` succeeded and lanes `16..23` returned `0`.) ### Fix Bind `Stride::Raw` for both buffer SRVs in `lanes_load_from_the_buffer_their_nested_arms_chose`, matching the emitted `ByteAddressBuffer` handle and `victory-gpu`'s `raw_window` host views. ### Verification Tested on Windows 11, AMD Radeon Vega 8 iGPU (Ryzen 7 5825U, GCN 5 / `gfx90c`, PCI `1002:15E7`, AMD driver `31.0.21921.13001`), Rust `1.98.1` (`x86_64-pc-windows-msvc`), without game files: - `cargo test -p victory-shader --lib -- waterfall_tests`: 5 passed, 0 failed (both Vega 8 hardware and WARP) - `VICTORY_D3D12_DEBUG=1 cargo test -p victory-shader --lib -- waterfall_tests`: 5 passed, 0 failed, no debug-layer errors - `cargo clippy -p victory-shader --tests -- -D warnings`: clean *(AI-assisted investigation and patch.)*
`lower` annotates untyped buffer loads as `ByteAddressBuffer`
(`ResourceProperties { 11, 0 }`), matching `victory-gpu`'s `raw_window`
host views. `lanes_load_from_the_buffer_their_nested_arms_chose` bound
`Stride::Structured(4)` instead, which on AMD GCN 5 (Vega 8, gfx90c)
truncates raw byte offsets against `NumElements` (32), returning zeros
from lane 8 onward.

Bind `Stride::Raw` so the test views match the emitted DXIL handle.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:36:11 +00:00
Author
Owner

@⁠HAL9000RELOADED on GitHub · 2026-11-25 19:29 UTC · original

RX 7900 XTX (RDNA3), Windows 10 + #402, main d510ee4: lanes_load_from_the_buffer_their_nested_arms_chose passes with this PR and also on main without it, so the GCN 5 failure doesn't reproduce on RDNA3. No regression. Run table: #129 (#129).

**@⁠HAL9000RELOADED** on GitHub · 2026-11-25 19:29 UTC · [original](https://github.com/fxceless/victory-fork/pull/102#issuecomment-7172372097) RX 7900 XTX (RDNA3), Windows 10 + #402, main `d510ee4`: `lanes_load_from_the_buffer_their_nested_arms_chose` passes with this PR and also on main without it, so the GCN 5 failure doesn't reproduce on RDNA3. No regression. Run table: #129 (https://git.gtahub.st/github/fxceless--victory-fork/pulls/129).
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/102/head:github-bot/gh-102'
git switch 'github-bot/gh-102'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-102'
git switch 'github-bot/gh-102'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-102'
git switch 'github-bot/gh-102'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-102'
git switch 'main'
git merge --squash 'github-bot/gh-102'
git switch 'main'
git merge --ff-only 'github-bot/gh-102'
git switch 'main'
git merge 'github-bot/gh-102'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.