Shaders: structured access through a root SRV or UAV uses its raw view (stacked on #294) #709

Closed
itsRevela wants to merge 4 commits from upstream-pr/709 into main
itsRevela commented 2026-11-24 07:11:13 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by itsRevela on 2026-11-24T07:11:13Z.


Depends on: #294 (root UAVs). This branch is on top of it; only the last two commits are new.

What

An indexed (structured) buffer_load_*, buffer_store_* or buffer_atomic_* through a descriptor built around a root SRV or UAV now goes through the root view's raw handle, at byte index * stride + offset. The stride is the one the title declares for that root parameter (UsedResource::stride).

A root descriptor is a bare address on the host, with no stride of its own. These accesses used to ask handle for a structured view (12 | u), which root descriptors don't have, so they stopped with a typed root view. That message was misleading for them, since none is a typed (format) access.

A new Lower::structured holds the choice for all three access kinds. Structured buffers in tables and heaps are unchanged, as is their stride check.

Why

With the title, in the opening cutscene, compute programs that write through root UAVs declared with strides of 1 to 64 bytes stopped at a typed root view once #294 was in. Each dropped its dispatches.

I measured in a local build with #302, #489, #294 and some local work on addresses passed as root constants (#614), which those programs need first:

  • with this change, 5 of them translate;
  • the run logs no a typed root view failures left;
  • the host accepted all 5 pipelines. The run's other host pipeline refused lines (129 without this change) don't involve them.

Tested

Windows 11 Pro 10.0.26200, NVIDIA GeForce RTX 3070 Ti (driver 32.0.16.1088), Rust 1.98.1, on #294's head.

  • New GPU test. emit::valu_tests::structured_access_through_a_root_uav_reaches_index_times_stride declares a root UAV with a stride of 8. It does an indexed store (element 2, offset 4), an indexed atomic add (element 2, offset 0) and an indexed load, then checks the buffer the root UAV binds on the hardware GPU and on WARP. With #294's lower.rs, it fails at emit with a typed root view.
  • Crate checks:
    • cargo test -p victory-shader: 72 passed.
    • cargo clippy -p victory-shader --tests: nothing in the changed files.
    • cargo fmt -p victory-shader --check: clean.
    • cargo xtask policy: ok.

AI-assisted (Claude Code). The title runs used my own copy; no game data is in this PR.

🤖 Generated with Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:issue:6576614242 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/709). Originally posted by [itsRevela](https://github.com/itsRevela) on 2026-11-24T07:11:13Z. --- Depends on: #294 (root UAVs). This branch is on top of it; only the last two commits are new. ## What An indexed (structured) `buffer_load_*`, `buffer_store_*` or `buffer_atomic_*` through a descriptor built around a **root SRV or UAV** now goes through the root view's raw handle, at byte `index * stride + offset`. The stride is the one the title declares for that root parameter (`UsedResource::stride`). A root descriptor is a bare address on the host, with no stride of its own. These accesses used to ask `handle` for a structured view (`12 | u`), which root descriptors don't have, so they stopped with `a typed root view`. That message was misleading for them, since none is a typed (format) access. A new `Lower::structured` holds the choice for all three access kinds. Structured buffers in tables and heaps are unchanged, as is their stride check. ## Why With the title, in the opening cutscene, compute programs that write through root UAVs declared with strides of 1 to 64 bytes stopped at `a typed root view` once #294 was in. Each dropped its dispatches. I measured in a local build with #302, #489, #294 and some local work on addresses passed as root constants (#614), which those programs need first: - with this change, **5 of them translate**; - the run logs no `a typed root view` failures left; - the host accepted all 5 pipelines. The run's other `host pipeline refused` lines (129 without this change) don't involve them. ## Tested Windows 11 Pro 10.0.26200, NVIDIA GeForce RTX 3070 Ti (driver 32.0.16.1088), Rust 1.98.1, on #294's head. - **New GPU test.** `emit::valu_tests::structured_access_through_a_root_uav_reaches_index_times_stride` declares a root UAV with a stride of 8. It does an indexed store (element 2, offset 4), an indexed atomic add (element 2, offset 0) and an indexed load, then checks the buffer the root UAV binds on the hardware GPU and on WARP. With #294's `lower.rs`, it fails at emit with `a typed root view`. - **Crate checks:** - `cargo test -p victory-shader`: 72 passed. - `cargo clippy -p victory-shader --tests`: nothing in the changed files. - `cargo fmt -p victory-shader --check`: clean. - `cargo xtask policy`: ok. AI-assisted (Claude Code). The title runs used my own copy; no game data is in this PR. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
LAKSHYA-cmd-tech commented 2026-11-24 08:02:43 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by LAKSHYA-cmd-tech on 2026-11-24T07:42:51Z.

Review: APPROVED


Verified on Windows 11 MSVC (Rust 1.98.1). \structured_access_through_a_root_uav_reaches_index_times_stride\ passes on both hardware and WARP.

  • Structured accesses (loads, stores, atomics) across root UAVs/SRVs now cleanly compute the effective byte address as \index * stride + offset\ using raw buffer handles (11 | u, 0), properly reflecting that root descriptors are bare host virtual addresses rather than typed descriptors.
  • Resolves \ typed root view\ pipeline creation failures.
  • Fully compliant with asset policy (\cargo xtask policy\ clean).
<!-- greyfinch-sync:Marvisak/VIctory:review:6035409343 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/709#pullrequestreview-6035409343). Originally posted by [LAKSHYA-cmd-tech](https://github.com/LAKSHYA-cmd-tech) on 2026-11-24T07:42:51Z. **Review:** APPROVED --- Verified on Windows 11 MSVC (Rust 1.98.1). \structured_access_through_a_root_uav_reaches_index_times_stride\ passes on both hardware and WARP. - Structured accesses (loads, stores, atomics) across root UAVs/SRVs now cleanly compute the effective byte address as \index * stride + offset\ using raw buffer handles \(11 | u, 0)\, properly reflecting that root descriptors are bare host virtual addresses rather than typed descriptors. - Resolves \ typed root view\ pipeline creation failures. - Fully compliant with asset policy (\cargo xtask policy\ clean).
catminou4 commented 2026-11-24 09:06:03 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-24T08:05:39Z.

Review: COMMENTED


Heads-up: no longer merges cleanly with current main (7374bfb) — conflict in victory-shader/src/emit/valu_tests.rs. Needs a rebase.

Head's shader crate is green on macOS 26 arm64 / rustc 1.98.1 (cargo test -p victory-shader: 56 passed / 0 failed against its own base; its new coverage is Windows-gated). The structured-access-through-root-SRV/UAV change is mostly GPU-side, so the Windows shader+GPU run is the real check.

<!-- greyfinch-sync:Marvisak/VIctory:review:6035653879 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/709#pullrequestreview-6035653879). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-24T08:05:39Z. **Review:** COMMENTED --- Heads-up: no longer merges cleanly with current main (`7374bfb`) — conflict in `victory-shader/src/emit/valu_tests.rs`. Needs a rebase. Head's shader crate is green on macOS 26 arm64 / rustc 1.98.1 (`cargo test -p victory-shader`: 56 passed / 0 failed against its own base; its new coverage is Windows-gated). The structured-access-through-root-SRV/UAV change is mostly GPU-side, so the Windows shader+GPU run is the real check.
raffclar commented 2026-11-24 09:06:18 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by raffclar on 2026-11-24T08:59:54Z.


#294 has some issues but this branch on top is okay.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7126825410 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/709#issuecomment-7126825410). Originally posted by [raffclar](https://github.com/raffclar) on 2026-11-24T08:59:54Z. --- #294 has some issues but this branch on top is okay.
MartinIndra02 commented 2026-11-24 10:03:42 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by MartinIndra02 on 2026-11-24T09:19:47Z.


Independent Windows + NVIDIA Ampere verification for e50ed36:

  • Setup: Windows 11 Pro 26200, NVIDIA GeForce RTX 3080 (10 GB, driver 621.24), Ryzen 7 5800X3D, Rust 1.98.1 (x86_64-pc-windows-msvc).
  • cargo test -p victory-shader --lib -- --test-threads=1: 72 passed, 0 failed (including structured_access_through_a_root_uav_reaches_index_times_stride on both hardware D3D12 and WARP).

No game data used. AI-assisted; tests run on my machine.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7127262834 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/709#issuecomment-7127262834). Originally posted by [MartinIndra02](https://github.com/MartinIndra02) on 2026-11-24T09:19:47Z. --- Independent Windows + NVIDIA Ampere verification for `e50ed36`: - **Setup:** Windows 11 Pro 26200, NVIDIA GeForce RTX 3080 (10 GB, driver `621.24`), Ryzen 7 5800X3D, Rust 1.98.1 (`x86_64-pc-windows-msvc`). - `cargo test -p victory-shader --lib -- --test-threads=1`: **72 passed, 0 failed** (including `structured_access_through_a_root_uav_reaches_index_times_stride` on both hardware D3D12 and WARP). *No game data used. AI-assisted; tests run on my machine.*
erLCoder commented 2026-11-24 14:04:36 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by erLCoder on 2026-11-24T13:08:32Z.


Independent structured root UAV GPU readback on GTX 1660 Ti, NVIDIA 581.42, Windows 10 22H2 build 19045.6466, Ryzen 5 3600, Rust 1.98.1 MSVC and Agility SDK 1.620.2. PR e50ed36 includes #294 dependency 0050ce5. Local SDK exports were added to the test executable; the fixture was restricted to hardware and asserts NVIDIA LUID 00000000:00017c52.

cargo test --offline --locked -p victory-shader --features host --lib structured_access_through_a_root_uav_reaches_index_times_stride -- --nocapture --test-threads=1 — 1 passed, 0 failed, 0 ignored, 71 filtered out. The synthetic dispatch wrote the expected words at index times stride and read them back successfully. The number of recovered title dispatches and effects on lighting remain untested.

Codex prepared the worktree, ran the test and drafted this report.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7132407167 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/709#issuecomment-7132407167). Originally posted by [erLCoder](https://github.com/erLCoder) on 2026-11-24T13:08:32Z. --- Independent structured root UAV GPU readback on GTX 1660 Ti, NVIDIA 581.42, Windows 10 22H2 build 19045.6466, Ryzen 5 3600, Rust 1.98.1 MSVC and Agility SDK 1.620.2. PR e50ed36 includes #294 dependency 0050ce5. Local SDK exports were added to the test executable; the fixture was restricted to hardware and asserts NVIDIA LUID 00000000:00017c52. `cargo test --offline --locked -p victory-shader --features host --lib structured_access_through_a_root_uav_reaches_index_times_stride -- --nocapture --test-threads=1` — 1 passed, 0 failed, 0 ignored, 71 filtered out. The synthetic dispatch wrote the expected words at index times stride and read them back successfully. The number of recovered title dispatches and effects on lighting remain untested. Codex prepared the worktree, ran the test and drafted this report.
qntic commented 2026-11-24 14:04:43 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by qntic on 2026-11-24T13:25:09Z.


integrated this with the newer main ffe310e. the structured buffer access paths conflict with the stride table changes, so i merged both into a shared implementation.

tested on rx 6600 xt. 359 workspace tests passed after the root uav integration, with both clippy configurations clean.

integration:
https://github.com/qntic/VIctory/tree/exp4/main-stack

<!-- greyfinch-sync:Marvisak/VIctory:comment:7132801795 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/709#issuecomment-7132801795). Originally posted by [qntic](https://github.com/qntic) on 2026-11-24T13:25:09Z. --- integrated this with the newer main ffe310e. the structured buffer access paths conflict with the stride table changes, so i merged both into a shared implementation. tested on rx 6600 xt. 359 workspace tests passed after the root uav integration, with both clippy configurations clean. integration: https://github.com/qntic/VIctory/tree/exp4/main-stack
upstream-sync closed this pull request 2026-11-25 01:04:52 +00:00
Marvisak commented 2026-11-25 01:07:51 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T00:28:00Z.


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

Stacked on #294; main already indexes a descriptor built around a root view by its own stride into the raw root view (emit/lower.rs, 'A descriptor built around a root view has the stride...').

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.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7148538467 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/709#issuecomment-7148538467). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T00:28:00Z. --- Automated triage for the maintainers. Closing because this change is already in `main`, or `main` has since replaced the code it patches. Stacked on #294; main already indexes a descriptor built around a root view by its own stride into the raw root view (emit/lower.rs, 'A descriptor built around a root view has the stride...'). 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

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!709
No description provided.