GPU, Shaders: view structured buffers raw on host for NVIDIA heap reads (FIND-11) #2883

Open
jujumoneylol wants to merge 5 commits from upstream-pr/2885 into main
jujumoneylol commented 2026-11-25 23:03:13 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by jujumoneylol on 2026-11-25T23:03:13Z.


Summary

Fixes FIND-11 (tracked in #1633 / #1744): NVIDIA GPUs misread heap-indexed structured buffers when a DXIL raw handle (ByteAddressBuffer, resource kind 11) indexes into a host D3D12 structured buffer descriptor (DXGI_FORMAT_UNKNOWN, StructureByteStride > 0).

Root Cause

In DXIL, annotateHandle(createHandleFromHeap(idx), ResourceProperties) requires a compile-time constant resource kind and StructStrideInBytes. Because heap-indexed buffers have runtime-variable strides (loaded from VIEW_STRIDES), victory-shader lowers heap-indexed buffer accesses through raw handles ((11 | u, 0)) and computes byte = index * view_stride[idx] + offset.

Previously, victory-gpu created host D3D12 structured views (StructureByteStride = S) for structured buffers. On NVIDIA hardware (verified on Turing GTX 1650, matching the RTX 5070 report in #1744), rawBufferLoad(raw_handle, byte_offset, undef) against a structured descriptor divides byte_offset / 4 and uses that as the element index at inner offset 0 — reading [101, 104, 107, 110, ...] instead of [200, 201, 202, ...] for a 12-byte stride buffer with offset:4.

Changes

  • crates/victory-gpu/src/descriptor/host.rs:
    • Represent structured buffer SRVs and UAVs (StructureByteStride > 0, 4-byte-multiple byte length fitting in u32 dwords) as host raw views (DXGI_FORMAT_R32_TYPELESS, FirstElement = offset / 4, NumElements = total_bytes / 4, StructureByteStride = 0, D3D12_BUFFER_{SRV,UAV}_FLAG_RAW), respecting D3D12's 16-byte raw-view alignment (D3D12_RAW_UAV_SRV_BYTE_ALIGNMENT via shadow::for_view(..., 16) in both buffer_srv/buffer_uav and view_copy).
    • Keep the title's original element stride in VIEW_STRIDES via view_stride().
    • Add unit test structured_buffer_views_stay_raw_on_host_and_keep_stride_table verifying host view creation, VIEW_STRIDES preservation, and zero D3D12 debug-layer errors.
  • crates/victory-gpu/src/draw.rs:
    • Update structured_views_off_their_buffers_elements_get_their_own_copy for 16-byte raw-view alignment (2 * 456 = 912 uses the buffer's copy; 456 (8 mod 16) and 100 (4 mod 16) get exact copies).
  • crates/victory-shader/src/emit/lower.rs:
    • Lower table-bound structured buffer loads, stores, and atomics through raw handles ((11 | u, 0)) with explicit byte = index * stride + offset so descriptor kinds match the raw host views across both table-bound and heap-indexed paths.
    • Lower structured buffer getDimensions (Fields::Buffer and Fields::Smem) through raw handles ((11 | u, 0)) and divide the returned byte count by stride (UDiv) to recover the element record count.
  • crates/victory-shader/src/emit/host.rs & diff_tests.rs:
    • Update the test harness's Stride::Structured to create host raw SRVs matching victory-gpu, while adding Stride::PcStructured for DXC-compiled PC reference shaders in diff_tests.
  • crates/victory-shader/src/emit/stride_tests.rs:
    • Add heap_indexed_structured_buffers_with_distinct_strides (multiple distinct strides in one heap on hardware + WARP).
    • Add table_bound_structured_buffer_reads_by_element_and_dimensions (table-bound idxen + offset:4 + num_records via getDimensions on hardware + WARP).

Verification (NVIDIA GeForce GTX 1650 + WARP, Windows 11)

  • Before (on main f3578e3):
    • emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride FAILED on hardware: got [101, 104, 107, 110, 113, 116, 119, 122, 125, 128, 131, 0, ...] instead of [200..231].
  • After (rebased on main 842b0cb):
    • emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride: PASS on both hardware (GTX 1650) and warp.
    • emit::stride_tests::heap_indexed_structured_buffers_with_distinct_strides: PASS on both hardware and warp.
    • emit::stride_tests::table_bound_structured_buffer_reads_by_element_and_dimensions: PASS on both hardware and warp.
    • Full cargo test -p victory-shader --lib: 303 passed (only failure is the pre-existing FIND-9 NVIDIA 1M view-heap cap test a_heap_buffer_read_where_no_buffer_view_is_reads_zeros).
    • Full cargo test -p victory-gpu --lib: 227 passed including 20/20 draw::tests and structured_buffer_views_stay_raw_on_host_and_keep_stride_table with VICTORY_D3D12_DEBUG=1 (only failures are the 2 pre-existing FIND-9 1M view-heap cap tests).
    • cargo clippy -p victory-shader -p victory-gpu --all-targets -- -D warnings: 0 warnings/errors.
    • cargo check --workspace --all-targets: clean.
    • cargo xtask policy: pass (asset policy: 191 files ok).

Notes

  • Clean-room implementation and synthetic tests only; no game binaries or assets used.
  • AI-assisted (Claude/Gemini-assisted coding, reviewed and hardware-verified locally on GTX 1650 + WARP).
  • Claims coordination: FIND-11 in #1633.
<!-- greyfinch-sync:Marvisak/VIctory:issue:5500679854 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2885). Originally posted by [jujumoneylol](https://github.com/jujumoneylol) on 2026-11-25T23:03:13Z. --- ## Summary Fixes **FIND-11** (tracked in #1633 / #1744): NVIDIA GPUs misread heap-indexed structured buffers when a DXIL raw handle (`ByteAddressBuffer`, resource kind `11`) indexes into a host D3D12 structured buffer descriptor (`DXGI_FORMAT_UNKNOWN`, `StructureByteStride > 0`). ### Root Cause In DXIL, `annotateHandle(createHandleFromHeap(idx), ResourceProperties)` requires a compile-time constant resource kind and `StructStrideInBytes`. Because heap-indexed buffers have runtime-variable strides (loaded from `VIEW_STRIDES`), `victory-shader` lowers heap-indexed buffer accesses through raw handles (`(11 | u, 0)`) and computes `byte = index * view_stride[idx] + offset`. Previously, `victory-gpu` created host D3D12 **structured** views (`StructureByteStride = S`) for structured buffers. On NVIDIA hardware (verified on Turing GTX 1650, matching the RTX 5070 report in #1744), `rawBufferLoad(raw_handle, byte_offset, undef)` against a structured descriptor divides `byte_offset / 4` and uses that as the element index at inner offset 0 — reading `[101, 104, 107, 110, ...]` instead of `[200, 201, 202, ...]` for a 12-byte stride buffer with `offset:4`. ### Changes - **`crates/victory-gpu/src/descriptor/host.rs`**: - Represent structured buffer SRVs and UAVs (`StructureByteStride > 0`, 4-byte-multiple byte length fitting in `u32` dwords) as host **raw** views (`DXGI_FORMAT_R32_TYPELESS`, `FirstElement = offset / 4`, `NumElements = total_bytes / 4`, `StructureByteStride = 0`, `D3D12_BUFFER_{SRV,UAV}_FLAG_RAW`), respecting D3D12's 16-byte raw-view alignment (`D3D12_RAW_UAV_SRV_BYTE_ALIGNMENT` via `shadow::for_view(..., 16)` in both `buffer_srv`/`buffer_uav` and `view_copy`). - Keep the title's original element stride in `VIEW_STRIDES` via `view_stride()`. - Add unit test `structured_buffer_views_stay_raw_on_host_and_keep_stride_table` verifying host view creation, `VIEW_STRIDES` preservation, and zero D3D12 debug-layer errors. - **`crates/victory-gpu/src/draw.rs`**: - Update `structured_views_off_their_buffers_elements_get_their_own_copy` for 16-byte raw-view alignment (`2 * 456 = 912` uses the buffer's copy; `456` (8 mod 16) and `100` (4 mod 16) get exact copies). - **`crates/victory-shader/src/emit/lower.rs`**: - Lower table-bound structured buffer loads, stores, and atomics through raw handles (`(11 | u, 0)`) with explicit `byte = index * stride + offset` so descriptor kinds match the raw host views across both table-bound and heap-indexed paths. - Lower structured buffer `getDimensions` (`Fields::Buffer` and `Fields::Smem`) through raw handles (`(11 | u, 0)`) and divide the returned byte count by `stride` (`UDiv`) to recover the element record count. - **`crates/victory-shader/src/emit/host.rs` & `diff_tests.rs`**: - Update the test harness's `Stride::Structured` to create host raw SRVs matching `victory-gpu`, while adding `Stride::PcStructured` for DXC-compiled PC reference shaders in `diff_tests`. - **`crates/victory-shader/src/emit/stride_tests.rs`**: - Add `heap_indexed_structured_buffers_with_distinct_strides` (multiple distinct strides in one heap on hardware + WARP). - Add `table_bound_structured_buffer_reads_by_element_and_dimensions` (table-bound `idxen` + `offset:4` + `num_records` via `getDimensions` on hardware + WARP). ## Verification (NVIDIA GeForce GTX 1650 + WARP, Windows 11) - **Before (on `main` `f3578e3`)**: - `emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride` **FAILED** on `hardware`: got `[101, 104, 107, 110, 113, 116, 119, 122, 125, 128, 131, 0, ...]` instead of `[200..231]`. - **After (rebased on `main` `842b0cb`)**: - `emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride`: **PASS** on both `hardware` (GTX 1650) and `warp`. - `emit::stride_tests::heap_indexed_structured_buffers_with_distinct_strides`: **PASS** on both `hardware` and `warp`. - `emit::stride_tests::table_bound_structured_buffer_reads_by_element_and_dimensions`: **PASS** on both `hardware` and `warp`. - Full `cargo test -p victory-shader --lib`: **303 passed** (only failure is the pre-existing `FIND-9` NVIDIA 1M view-heap cap test `a_heap_buffer_read_where_no_buffer_view_is_reads_zeros`). - Full `cargo test -p victory-gpu --lib`: **227 passed** including 20/20 `draw::tests` and `structured_buffer_views_stay_raw_on_host_and_keep_stride_table` with `VICTORY_D3D12_DEBUG=1` (only failures are the 2 pre-existing `FIND-9` 1M view-heap cap tests). - `cargo clippy -p victory-shader -p victory-gpu --all-targets -- -D warnings`: **0 warnings/errors**. - `cargo check --workspace --all-targets`: **clean**. - `cargo xtask policy`: **pass** (`asset policy: 191 files ok`). ## Notes - Clean-room implementation and synthetic tests only; no game binaries or assets used. - AI-assisted (Claude/Gemini-assisted coding, reviewed and hardware-verified locally on GTX 1650 + WARP). - Claims coordination: `FIND-11` in #1633.
kotekompotek commented 2026-11-25 23:37:09 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-25T23:37:09Z.

Review: COMMENTED


Correct raw-view rules: R32_TYPELESS + FLAG_RAW is the only legal representation, gated on byte-length divisibility and u32 element count, with the 16-byte FirstElement alignment pushed down into view_align so for_view reserves a conforming copy. Complements #2873's format legalization. LGTM.

<!-- greyfinch-sync:Marvisak/VIctory:review:6066498147 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2885#pullrequestreview-6066498147). Originally posted by [kotekompotek](https://github.com/kotekompotek) on 2026-11-25T23:37:09Z. **Review:** COMMENTED --- Correct raw-view rules: R32_TYPELESS + FLAG_RAW is the only legal representation, gated on byte-length divisibility and u32 element count, with the 16-byte FirstElement alignment pushed down into view_align so for_view reserves a conforming copy. Complements #2873's format legalization. LGTM.
fuzeofficlal commented 2026-11-26 00:03:19 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-25T23:10:33Z.


Verified 41773eb8 on Windows 11 (NVIDIA RTX 5090 Blackwell + WARP + dxil.dll) against main (842b0cb):

Before / After on RTX 5090 (FIND-11 confirmed fixed!)

  • Baseline main (842b0cb): emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride fails deterministically on RTX 5090 (returns [101, 104, 107, ...] instead of [200, 201, ...]).
  • With #2885 (41773eb8): a_heap_buffer_read_by_element_takes_the_views_stride, heap_indexed_structured_buffers_with_distinct_strides, and table_bound_structured_buffer_reads_by_element_and_dimensions all pass on both RTX 5090 and WARP!
  • stride_tests: 9/10 passed on RTX 5090 (only the pre-existing baseline failure a_heap_buffer_read_where_no_buffer_view_is_reads_zeros, which also fails with E_INVALIDARG on 842b0cb on RTX 5090).

Suite & Audit Notes

  • victory-shader: emit::lower::tests 33/33, diff_tests 5/5 passed; victory-gpu: RTX 5090 descriptor::host::tests 15/15 (including structured_buffer_views_stay_raw_on_host_and_keep_stride_table) & draw::tests 20/20, WARP draw::tests 20/20 passed; cargo clippy (default & diagnostics) 0 warnings; cargo xtask policy (191 files ok; emit/lower.rs = 521,447 bytes, 2,841 bytes under 512 KiB).
  • Non-blocking notes: (1) if a table-bound structured view falls back to a native structured descriptor (total_bytes % 4 != 0), the shader side still emits a raw handle (rare in practice since structured strides/totals are almost always 4-byte multiples); (2) touches buffer_srv/buffer_uav in descriptor/host.rs alongside #2873, so landing order will need a small merge resolution.

Great fix for NVIDIA — looks ready to merge.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7177230215 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2885#issuecomment-7177230215). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-25T23:10:33Z. --- Verified `41773eb8` on Windows 11 (**NVIDIA RTX 5090 Blackwell** + WARP + `dxil.dll`) against `main` (`842b0cb`): ### Before / After on RTX 5090 (FIND-11 confirmed fixed!) - **Baseline `main` (`842b0cb`)**: `emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride` fails deterministically on RTX 5090 (returns `[101, 104, 107, ...]` instead of `[200, 201, ...]`). - **With `#2885` (`41773eb8`)**: `a_heap_buffer_read_by_element_takes_the_views_stride`, `heap_indexed_structured_buffers_with_distinct_strides`, and `table_bound_structured_buffer_reads_by_element_and_dimensions` **all pass on both RTX 5090 and WARP**! - `stride_tests`: 9/10 passed on RTX 5090 (only the pre-existing baseline failure `a_heap_buffer_read_where_no_buffer_view_is_reads_zeros`, which also fails with `E_INVALIDARG` on `842b0cb` on RTX 5090). ### Suite & Audit Notes - `victory-shader`: `emit::lower::tests` 33/33, `diff_tests` 5/5 passed; `victory-gpu`: RTX 5090 `descriptor::host::tests` 15/15 (including `structured_buffer_views_stay_raw_on_host_and_keep_stride_table`) & `draw::tests` 20/20, WARP `draw::tests` 20/20 passed; `cargo clippy` (default & `diagnostics`) 0 warnings; `cargo xtask policy` (`191 files ok`; `emit/lower.rs` = `521,447` bytes, `2,841` bytes under 512 KiB). - Non-blocking notes: (1) if a table-bound structured view falls back to a native structured descriptor (`total_bytes % 4 != 0`), the shader side still emits a raw handle (rare in practice since structured strides/totals are almost always 4-byte multiples); (2) touches `buffer_srv`/`buffer_uav` in `descriptor/host.rs` alongside `#2873`, so landing order will need a small merge resolution. Great fix for NVIDIA — looks ready to merge.
alonso49noob commented 2026-11-26 01:04:17 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by alonso49noob on 2026-11-26T00:52:50Z.


RTX 5060 8 GB (Blackwell), driver 621.01, Windows 11, Rust 1.98.1. I compared main 63bcca4 with main + this PR (41773eb), which merges cleanly. Each tree was built in its own target dir. The full shader runs skip the #2571 crash test.

main 63bcca4 + this PR
stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride (x3) fails, [101, 104, 107, …] passes 3 of 3
synthetic_tests::gathers_at_a_level_match_the_hardware (x3) fails, lane 0 [0, 1, 0, 0] passes 3 of 3
the PR's two new stride_tests n/a pass
cargo test -p victory-shader --lib 298 passed, 3 failed 302 passed, 1 failed
cargo test -p victory-gpu --lib 229 passed, 2 failed 230 passed, 2 failed

The gather test is the other fixture named when #2357 was closed, and the reports above don't cover it. It passes here, and this PR doesn't change synthetic_tests.rs. The failures left are the HEAP_VIEWS cap ones, the same as on main: a_heap_buffer_read_where_no_buffer_view_is_reads_zeros, dynamic_slots_are_held_until_released and lists_share_a_table_and_copies_keep_their_views. I saw no new failures.

Unrelated note: descriptor::host::tests::views_bound_while_another_slot_gets_its_texture_do_not_wait failed in 1 of 3 full victory-gpu runs on main. It passed 6 of 6 alone and in every other full run on both trees, so it looks intermittent and not tied to this PR.

Written with AI help (Claude Code); the numbers are from runs on my machine.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7179206632 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2885#issuecomment-7179206632). Originally posted by [alonso49noob](https://github.com/alonso49noob) on 2026-11-26T00:52:50Z. --- RTX 5060 8 GB (Blackwell), driver 621.01, Windows 11, Rust 1.98.1. I compared `main` `63bcca4` with `main` + this PR (`41773eb`), which merges cleanly. Each tree was built in its own target dir. The full shader runs skip the #2571 crash test. | | `main` `63bcca4` | + this PR | |---|---|---| | `stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride` (x3) | fails, `[101, 104, 107, …]` | **passes 3 of 3** | | `synthetic_tests::gathers_at_a_level_match_the_hardware` (x3) | fails, lane 0 `[0, 1, 0, 0]` | **passes 3 of 3** | | the PR's two new `stride_tests` | n/a | pass | | `cargo test -p victory-shader --lib` | 298 passed, 3 failed | **302 passed, 1 failed** | | `cargo test -p victory-gpu --lib` | 229 passed, 2 failed | 230 passed, 2 failed | The gather test is the other fixture named when #2357 was closed, and the reports above don't cover it. It passes here, and this PR doesn't change `synthetic_tests.rs`. The failures left are the `HEAP_VIEWS` cap ones, the same as on `main`: `a_heap_buffer_read_where_no_buffer_view_is_reads_zeros`, `dynamic_slots_are_held_until_released` and `lists_share_a_table_and_copies_keep_their_views`. I saw no new failures. Unrelated note: `descriptor::host::tests::views_bound_while_another_slot_gets_its_texture_do_not_wait` failed in 1 of 3 full `victory-gpu` runs on `main`. It passed 6 of 6 alone and in every other full run on both trees, so it looks intermittent and not tied to this PR. Written with AI help (Claude Code); the numbers are from runs on my machine.
fyernald commented 2026-11-26 02:21:28 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fyernald on 2026-11-26T02:21:28Z.

Review: APPROVED


Ampere data point: RTX 3080 (617.42), Windows 10 19045, main 63bcca4 + #486 (Agility runtime for the shader tests) + #2596 (#2571), --test-threads=1.

victory-shader --lib victory-gpu --lib
base 298 passed, 4 failed 226 passed, 5 failed
+ #2885 302 passed, 2 failed 227 passed, 5 failed
+ #2885 + #2461 303 passed, 1 failed 230 passed, 3 failed
  • With this PR: a_heap_buffer_read_by_element_takes_the_views_stride and gathers_at_a_level_match_the_hardware pass, along with the new stride tests and structured_buffer_views_stay_raw_on_host_and_keep_stride_table. Nothing new fails.
  • With #2461 as well: the two PRs merge cleanly onto main and with each other, and #2461 clears the heap-cap failures.
    • Shader suite: what's left is pops_wait_loop_exits_immediately_for_inactive_lanes, which needs an SM 6.6 WARP that Windows 10 doesn't have.
    • GPU suite: the three left are the Windows 10 in-box-runtime failures that an Agility opt-in for the GPU test binary removes (see #2878).

So on this card the two together leave no NVIDIA-specific failure.

One scope note: unlike the raw views in #2878, which only apply on NVIDIA, this views structured buffers raw on every host, and getDimensions divides by the stride everywhere. The runs so far are NVIDIA and WARP, so a run on AMD hardware would close that.

@alonso49noob: the intermittent views_bound_while_another_slot_gets_its_texture_do_not_wait on main is a race between tests over the shared WHILE_PREPARING hook from 42ea09f. It's unrelated to this PR, and #2585 fixes it.

<!-- greyfinch-sync:Marvisak/VIctory:review:6067711791 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2885#pullrequestreview-6067711791). Originally posted by [fyernald](https://github.com/fyernald) on 2026-11-26T02:21:28Z. **Review:** APPROVED --- Ampere data point: RTX 3080 (617.42), **Windows 10 19045**, `main` `63bcca4` + #486 (Agility runtime for the shader tests) + #2596 (#2571), `--test-threads=1`. | | `victory-shader --lib` | `victory-gpu --lib` | |---|---|---| | base | 298 passed, 4 failed | 226 passed, 5 failed | | + #2885 | 302 passed, 2 failed | 227 passed, 5 failed | | + #2885 + #2461 | **303 passed, 1 failed** | **230 passed, 3 failed** | - **With this PR:** `a_heap_buffer_read_by_element_takes_the_views_stride` and `gathers_at_a_level_match_the_hardware` pass, along with the new stride tests and `structured_buffer_views_stay_raw_on_host_and_keep_stride_table`. Nothing new fails. - **With #2461 as well:** the two PRs merge cleanly onto `main` and with each other, and #2461 clears the heap-cap failures. - Shader suite: what's left is `pops_wait_loop_exits_immediately_for_inactive_lanes`, which needs an SM 6.6 WARP that Windows 10 doesn't have. - GPU suite: the three left are the Windows 10 in-box-runtime failures that an Agility opt-in for the GPU test binary removes (see #2878). So on this card the two together leave no NVIDIA-specific failure. One scope note: unlike the raw views in #2878, which only apply on NVIDIA, this views structured buffers raw on every host, and `getDimensions` divides by the stride everywhere. The runs so far are NVIDIA and WARP, so a run on AMD hardware would close that. @alonso49noob: the intermittent `views_bound_while_another_slot_gets_its_texture_do_not_wait` on `main` is a race between tests over the shared `WHILE_PREPARING` hook from 42ea09f. It's unrelated to this PR, and #2585 fixes it.
steven-seagull27 commented 2026-11-26 04:06:28 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by steven-seagull27 on 2026-11-26T03:51:33Z.


@jujumoneylol I found a WARP regression when a shader writes through one structured view and another shader reads the same records through a view with a different starting offset. The NVIDIA fix for reading the untouched fields also showed up in this comparison.

Wrong words out of 2,400 GeForce RTX 5080, 621.40 Windows WARP, 10.0.26100.10068
Direct parent 842b0cb 2,375 0
This PR, 41773eb 544 544

On this PR, both adapters returned all 1,600 untouched fields and all 160 newly written values read through the writer's own origin. All 544 stale words were reads of a GPU-written field through a different origin. For example, a writer at byte 12 and a reader at byte 24 share 31 records. Reader lane 0 should see the 1 stored by writer lane 1. It saw the initial 0xa1700008. All 31 overlapping records were stale. The last, non-overlapping record kept its correct initial value.

The fixture places 32-element views at byte offsets 0, 12, 24, 36 and 48 in a 432-byte write-watched title GPU buffer. Every access is inside its declared view. Each writer and reader runs in a separate fence-waited submission and schedules the same heap refresh that draw::State::bind uses. There are no intervening CPU writes. Your existing descriptor/stride test still passed on both adapters. The same normal-submit comparison measured 544/2,400 wrong on each adapter on the current #2178 head 319749e. Related alignment and alias results on #2178

For the alignment fallback, the acceptance case I would keep is that the later SRV sees all 31 overlapping writes across differently aligned origins. The test-only commit directly on this PR can be run in a separate checkout with:

git fetch https://github.com/steven-seagull27/VIctory.git refs/heads/codex/pr2885-fenced-structured-readback
git switch --detach FETCH_HEAD
foreach ($adapter in '0', '1') {
    $env:VICTORY_D3D12_WARP = $adapter
    cargo test -p victory-gpu --all-features --lib --locked gpu_writes_visible_through_overlapping_views -- --ignored --nocapture --test-threads=1
}

Synthetic D3D12 readbacks on Windows. The game and AMD hardware remain untested here. AI-assisted with Codex.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7182084803 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2885#issuecomment-7182084803). Originally posted by [steven-seagull27](https://github.com/steven-seagull27) on 2026-11-26T03:51:33Z. --- @jujumoneylol I found a WARP regression when a shader writes through one structured view and another shader reads the same records through a view with a different starting offset. The NVIDIA fix for reading the untouched fields also showed up in this comparison. | Wrong words out of 2,400 | GeForce RTX 5080, 621.40 | Windows WARP, 10.0.26100.10068 | |---|---:|---:| | Direct parent `842b0cb` | 2,375 | 0 | | This PR, `41773eb` | 544 | 544 | On this PR, both adapters returned all 1,600 untouched fields and all 160 newly written values read through the writer's own origin. All 544 stale words were reads of a GPU-written field through a different origin. For example, a writer at byte 12 and a reader at byte 24 share 31 records. Reader lane 0 should see the `1` stored by writer lane 1. It saw the initial `0xa1700008`. All 31 overlapping records were stale. The last, non-overlapping record kept its correct initial value. The fixture places 32-element views at byte offsets 0, 12, 24, 36 and 48 in a 432-byte write-watched title GPU buffer. Every access is inside its declared view. Each writer and reader runs in a separate fence-waited submission and schedules the same heap refresh that `draw::State::bind` uses. There are no intervening CPU writes. Your existing descriptor/stride test still passed on both adapters. The same normal-submit comparison measured 544/2,400 wrong on each adapter on the current #2178 head `319749e`. [Related alignment and alias results on #2178](https://github.com/Marvisak/VIctory/pull/2178#issuecomment-7179707925) For the alignment fallback, the acceptance case I would keep is that the later SRV sees all 31 overlapping writes across differently aligned origins. The [test-only commit directly on this PR](https://github.com/steven-seagull27/VIctory/commit/8c474d5fcc3f914a67a0070ddc3ec39b6e4d6a47) can be run in a separate checkout with: ```powershell git fetch https://github.com/steven-seagull27/VIctory.git refs/heads/codex/pr2885-fenced-structured-readback git switch --detach FETCH_HEAD foreach ($adapter in '0', '1') { $env:VICTORY_D3D12_WARP = $adapter cargo test -p victory-gpu --all-features --lib --locked gpu_writes_visible_through_overlapping_views -- --ignored --nocapture --test-threads=1 } ``` Synthetic D3D12 readbacks on Windows. The game and AMD hardware remain untested here. AI-assisted with Codex.
fyernald commented 2026-11-26 04:25:20 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fyernald on 2026-11-26T04:25:20Z.

Review: CHANGES_REQUESTED


Changing my earlier approval. @steven-seagull27's fixture (8c474d5) reproduces exactly on the RTX 3080 (617.42) / Windows 10. Hardware adapter, with an Agility opt-in for the GPU test binary (Windows 10's WARP has no SM 6.6, so no WARP row here):

wrong words / 2,400 RTX 3080
main 63bcca4 + fixture 2,375
#2885 41773eb + fixture 544

All 18 failing reads on this PR are the GPU-written field read through a different origin, as they describe. The pattern also shows the cause. The five origins are bytes 0, 12, 24, 36 and 48. The two that are 16-byte aligned, 0 and 48, see each other's writes: writer 0 → reader 4 and writer 4 → reader 0 are both clean. Every pair involving an origin that isn't 16-byte aligned is stale (29-31 of 32).

That matches the fallback in this PR: a raw view whose start isn't 16-byte aligned gets "a copy of its own bytes", which draw.rs's updated test now asserts for 456 = 8 mod 16. A write through one such copy never reaches another view of the same records. On hosts where structured views read correctly today (WARP: 0 wrong on main, presumably AMD too), that's a regression.

Two shapes that would keep one copy:

  • View raw from the start rounded down to 16 bytes and add the remainder in the shader (the stride table already carries per-view data).
  • Keep the native structured view where the start isn't 16-byte aligned. That still leaves NVIDIA's structured-read problem for those views, but doesn't break the others.

The fixture is a good acceptance test to carry into the PR. All 31 overlapping writes should be visible across differently aligned origins.

<!-- greyfinch-sync:Marvisak/VIctory:review:6068537336 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2885#pullrequestreview-6068537336). Originally posted by [fyernald](https://github.com/fyernald) on 2026-11-26T04:25:20Z. **Review:** CHANGES_REQUESTED --- Changing my earlier approval. @steven-seagull27's fixture (`8c474d5`) reproduces exactly on the RTX 3080 (617.42) / Windows 10. Hardware adapter, with an Agility opt-in for the GPU test binary (Windows 10's WARP has no SM 6.6, so no WARP row here): | wrong words / 2,400 | RTX 3080 | |---|---| | `main` `63bcca4` + fixture | 2,375 | | #2885 `41773eb` + fixture | 544 | All 18 failing reads on this PR are the GPU-written field read through a different origin, as they describe. The pattern also shows the cause. The five origins are bytes 0, 12, 24, 36 and 48. The two that are 16-byte aligned, **0 and 48, see each other's writes**: writer 0 → reader 4 and writer 4 → reader 0 are both clean. Every pair involving an origin that isn't 16-byte aligned is stale (29-31 of 32). That matches the fallback in this PR: a raw view whose start isn't 16-byte aligned gets "a copy of its own bytes", which `draw.rs`'s updated test now asserts for `456` = 8 mod 16. A write through one such copy never reaches another view of the same records. On hosts where structured views read correctly today (WARP: 0 wrong on `main`, presumably AMD too), that's a regression. Two shapes that would keep one copy: - View raw from the start rounded down to 16 bytes and add the remainder in the shader (the stride table already carries per-view data). - Keep the native structured view where the start isn't 16-byte aligned. That still leaves NVIDIA's structured-read problem for those views, but doesn't break the others. The fixture is a good acceptance test to carry into the PR. All 31 overlapping writes should be visible across differently aligned origins.
Marvisak commented 2026-11-26 05:04:10 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-26T04:27:10Z.


Automated triage for the maintainers.

Thanks for e7250c5; both points are addressed. In descriptor/host.rs, buffer_srv/buffer_uav now view structured buffers raw from the preceding 16-byte boundary of the shared copy, with alignment RAW_WORD_ALIGN. The 0-12-byte remainder goes into VIEW_STRIDES bits 28-29, and the shader adds it back (view_raw_bias in emit/lower.rs), so overlapping views share one copy. The overlap fixture shows 0 of 2,400 words wrong on both adapters. Structured views that cannot be made raw are now refused instead of falling back to a structured descriptor. VIEW_STRIDE_BITS shrinks to 28 bits, which still leaves room for any real stride.

Notes for the maintainer: every buffer handle now reads the stride table (a small per-access cost), and lower.rs is about 1.5 KiB under the policy size cap. This replaces the approach in #2178 (open, global toggle, private copies), so only one should land.

CI: passing.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7182607857 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2885#issuecomment-7182607857). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-26T04:27:10Z. --- <!-- victory-triage v1 head=e7250c58df935b77f405159da10413c3f23afac4 verdict=merge-candidate at=2026-11-26T07:23:14Z --> Automated triage for the maintainers. Thanks for `e7250c5`; both points are addressed. In `descriptor/host.rs`, `buffer_srv`/`buffer_uav` now view structured buffers raw from the preceding 16-byte boundary of the shared copy, with alignment `RAW_WORD_ALIGN`. The 0-12-byte remainder goes into `VIEW_STRIDES` bits 28-29, and the shader adds it back (`view_raw_bias` in `emit/lower.rs`), so overlapping views share one copy. The overlap fixture shows 0 of 2,400 words wrong on both adapters. Structured views that cannot be made raw are now refused instead of falling back to a structured descriptor. `VIEW_STRIDE_BITS` shrinks to 28 bits, which still leaves room for any real stride. Notes for the maintainer: every buffer handle now reads the stride table (a small per-access cost), and `lower.rs` is about 1.5 KiB under the policy size cap. This replaces the approach in #2178 (open, global toggle, private copies), so only one should land. CI: passing. --- _Generated by [Claude Code](https://claude.ai/code)_
jujumoneylol commented 2026-11-26 07:01:52 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by jujumoneylol on 2026-11-26T06:42:48Z.


Thanks @steven-seagull27, @fyernald, and the triage review — pushed e7250c5 addressing both findings:

1. Overlapping structured views now share one host copy (no private copies for 4-byte-aligned starts)

  • victory-gpu (descriptor/host.rs): Structured buffer SRVs/UAVs now use 4-byte alignment (RAW_WORD_ALIGN = 4) in shadow::for_view and view_align instead of forcing 16-byte private copies. When shadow.offset(start) is 4-byte aligned (not 16-byte aligned), buffer_srv/buffer_uav round FirstElement down to the preceding 16-byte boundary (aligned = offset - bias, NumElements = (total_bytes + bias) / 4), adjust MARK to shadow.mark_entry(start - bias), and store the 0..12-byte start remainder in VIEW_STRIDES bits 28..29 (VIEW_RAW_OFFSET_SHIFT = 28, 2 bits for 0..=3 dwords; VIEW_STRIDE_BITS = (1 << 28) - 1).
  • victory-shader (emit/shader.rs, emit/lower.rs): Record all buffer handles (kinds 10..=12, SRV and UAV) in view_index, add view_raw_bias(h) ((word >> 26) & 0xC) to raw_view offsets for heap-direct and table-bound structured buffers, and subtract it before UDiv in getDimensions so element counts remain exact.
  • Carried @steven-seagull27's overlapping-views fixture (crates/victory-gpu/src/descriptor/overlap_test.rs) directly into the default test suite (skipping cleanly on hosts without SM 6.6).

2. No native structured descriptor fallback behind raw shader handles

  • buffer_srv and buffer_uav now refuse structured views whose byte length is 0, not a multiple of 4, not 4-byte aligned on the host copy, or whose raw dword count overflows u32, rather than falling back to creating a native D3D12 structured descriptor. Covered in structured_buffer_views_stay_raw_on_host_and_keep_stride_table.

Verification (e7250c5, Windows 11, VICTORY_D3D12_DEBUG=1)

Test / Check GeForce GTX 1650 Windows WARP
overlap_test::gpu_writes_visible_through_overlapping_views 0 / 2,400 wrong (PASS, 0 D3D12 errors) 0 / 2,400 wrong (PASS, 0 D3D12 errors)
stride_tests::table_bound_structured_buffer_reads_by_element_and_dimensions (bias=0 & bias=12) PASS PASS
stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride + heap_indexed_structured_buffers_with_distinct_strides PASS PASS
victory-gpu descriptor::host::* + draw::tests (--test-threads=1) 36/37 PASS (only pre-existing FIND-9 dynamic_slots_are_held_until_released) 36/37 PASS (only FIND-9)
victory-shader (stride_tests, diff_tests, lower::tests, waterfall_tests, synthetic_tests) 63/64 PASS (only pre-existing FIND-9 a_heap_buffer_read_where_no_buffer_view_is_reads_zeros) —
cargo clippy -p victory-shader -p victory-gpu --all-targets -- -D warnings (default & --all-features) 0 warnings —
cargo xtask policy pass (192 files ok, lower.rs = 522,717 bytes) —
<!-- greyfinch-sync:Marvisak/VIctory:comment:7184706946 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2885#issuecomment-7184706946). Originally posted by [jujumoneylol](https://github.com/jujumoneylol) on 2026-11-26T06:42:48Z. --- Thanks @steven-seagull27, @fyernald, and the triage review — pushed `e7250c5` addressing both findings: ### 1. Overlapping structured views now share one host copy (no private copies for 4-byte-aligned starts) - **`victory-gpu` (`descriptor/host.rs`)**: Structured buffer SRVs/UAVs now use 4-byte alignment (`RAW_WORD_ALIGN = 4`) in `shadow::for_view` and `view_align` instead of forcing 16-byte private copies. When `shadow.offset(start)` is 4-byte aligned (not 16-byte aligned), `buffer_srv`/`buffer_uav` round `FirstElement` down to the preceding 16-byte boundary (`aligned = offset - bias`, `NumElements = (total_bytes + bias) / 4`), adjust `MARK` to `shadow.mark_entry(start - bias)`, and store the `0..12`-byte start remainder in `VIEW_STRIDES` bits `28..29` (`VIEW_RAW_OFFSET_SHIFT = 28`, 2 bits for `0..=3` dwords; `VIEW_STRIDE_BITS = (1 << 28) - 1`). - **`victory-shader` (`emit/shader.rs`, `emit/lower.rs`)**: Record all buffer handles (kinds `10..=12`, SRV and UAV) in `view_index`, add `view_raw_bias(h)` (`(word >> 26) & 0xC`) to `raw_view` offsets for heap-direct and table-bound structured buffers, and subtract it before `UDiv` in `getDimensions` so element counts remain exact. - Carried @steven-seagull27's overlapping-views fixture (`crates/victory-gpu/src/descriptor/overlap_test.rs`) directly into the default test suite (skipping cleanly on hosts without SM 6.6). ### 2. No native structured descriptor fallback behind raw shader handles - `buffer_srv` and `buffer_uav` now refuse structured views whose byte length is `0`, not a multiple of 4, not 4-byte aligned on the host copy, or whose raw dword count overflows `u32`, rather than falling back to creating a native D3D12 structured descriptor. Covered in `structured_buffer_views_stay_raw_on_host_and_keep_stride_table`. ### Verification (`e7250c5`, Windows 11, `VICTORY_D3D12_DEBUG=1`) | Test / Check | GeForce GTX 1650 | Windows WARP | |---|---|---| | `overlap_test::gpu_writes_visible_through_overlapping_views` | **0 / 2,400 wrong** (PASS, 0 D3D12 errors) | **0 / 2,400 wrong** (PASS, 0 D3D12 errors) | | `stride_tests::table_bound_structured_buffer_reads_by_element_and_dimensions` (`bias=0` & `bias=12`) | **PASS** | **PASS** | | `stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride` + `heap_indexed_structured_buffers_with_distinct_strides` | **PASS** | **PASS** | | `victory-gpu` `descriptor::host::*` + `draw::tests` (`--test-threads=1`) | **36/37 PASS** (only pre-existing `FIND-9` `dynamic_slots_are_held_until_released`) | **36/37 PASS** (only `FIND-9`) | | `victory-shader` (`stride_tests`, `diff_tests`, `lower::tests`, `waterfall_tests`, `synthetic_tests`) | **63/64 PASS** (only pre-existing `FIND-9` `a_heap_buffer_read_where_no_buffer_view_is_reads_zeros`) | — | | `cargo clippy -p victory-shader -p victory-gpu --all-targets -- -D warnings` (default & `--all-features`) | **0 warnings** | — | | `cargo xtask policy` | **pass** (`192 files ok`, `lower.rs` = 522,717 bytes) | — |
jujumoneylol commented 2026-11-26 09:11:59 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by jujumoneylol on 2026-11-26T09:11:59Z.


Pushed one small cleanup/fix (767f228):

  • Lower::view_raw_bias now reuses the VIEW_STRIDES dword already loaded by Lower::buffer_guard (guarded_stride) instead of reloading VIEW_STRIDES[index] via self.s.view_index.
  • This avoids a redundant root-SRV load on every heap-direct buffer access and prevents an out-of-bounds VIEW_STRIDES[null_buffer_view()] read when buffer_guard redirects a non-buffer slot to the null buffer view on a small VIEW_STRIDES table (caught when testing #2885 stacked with #2461 on GTX 1650 in a_heap_buffer_read_where_no_buffer_view_is_reads_zeros, which now passes cleanly).
  • Verified cargo xtask policy (lower.rs 523,185 bytes < 512 KiB), cargo clippy -p victory-shader -p victory-gpu --all-targets -- -D warnings, and overlap_test + structured-buffer descriptor tests on GTX 1650 (VICTORY_D3D12_DEBUG=1).
<!-- greyfinch-sync:Marvisak/VIctory:comment:7187580294 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2885#issuecomment-7187580294). Originally posted by [jujumoneylol](https://github.com/jujumoneylol) on 2026-11-26T09:11:59Z. --- Pushed one small cleanup/fix (`767f228`): - `Lower::view_raw_bias` now reuses the `VIEW_STRIDES` dword already loaded by `Lower::buffer_guard` (`guarded_stride`) instead of reloading `VIEW_STRIDES[index]` via `self.s.view_index`. - This avoids a redundant root-SRV load on every heap-direct buffer access **and** prevents an out-of-bounds `VIEW_STRIDES[null_buffer_view()]` read when `buffer_guard` redirects a non-buffer slot to the null buffer view on a small `VIEW_STRIDES` table (caught when testing `#2885` stacked with `#2461` on GTX 1650 in `a_heap_buffer_read_where_no_buffer_view_is_reads_zeros`, which now passes cleanly). - Verified `cargo xtask policy` (`lower.rs` 523,185 bytes < 512 KiB), `cargo clippy -p victory-shader -p victory-gpu --all-targets -- -D warnings`, and `overlap_test` + structured-buffer descriptor tests on GTX 1650 (`VICTORY_D3D12_DEBUG=1`).
Dukestar69 commented 2026-11-26 09:48:26 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T09:48:26Z.

Review: APPROVED


Verified on RTX 5090 against origin/main (63bcca4):

  • cargo test -p victory-shader --lib emit::stride_tests:: -- --test-threads=1: 9/10 passed on RTX 5090 — notably a_heap_buffer_read_by_element_takes_the_views_stride now passes on RTX 5090 (fails on clean origin/main), along with both new tests (heap_indexed_structured_buffers_with_distinct_strides and table_bound_structured_buffer_reads_by_element_and_dimensions). The single remaining failure (a_heap_buffer_read_where_no_buffer_view_is_reads_zeros) reproduces identically on clean origin/main.
  • cargo test -p victory-gpu --lib descriptor::host:: -- --test-threads=1 --skip dynamic_slots_are_held_until_released: 16/16 passed (including overlap_test::gpu_writes_visible_through_overlapping_views and structured_buffer_views_stay_raw_on_host_and_keep_stride_table).
  • cargo test -p victory-gpu --lib draw:: -- --test-threads=1: 20/20 passed.
  • cargo clippy -p victory-shader -p victory-gpu --all-targets -- -D warnings: clean.
  • cargo xtask policy: 192 files ok.

Great NVIDIA fix (FIND-11): viewing structured buffers raw on the host makes heap-indexed structured buffer reads work cleanly on RTX 5090.

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

<!-- greyfinch-sync:Marvisak/VIctory:review:6071828823 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2885#pullrequestreview-6071828823). Originally posted by [Dukestar69](https://github.com/Dukestar69) on 2026-11-26T09:48:26Z. **Review:** APPROVED --- Verified on RTX 5090 against `origin/main` (`63bcca4`): - `cargo test -p victory-shader --lib emit::stride_tests:: -- --test-threads=1`: **9/10 passed** on RTX 5090 — notably **`a_heap_buffer_read_by_element_takes_the_views_stride` now passes on RTX 5090** (fails on clean `origin/main`), along with both new tests (`heap_indexed_structured_buffers_with_distinct_strides` and `table_bound_structured_buffer_reads_by_element_and_dimensions`). The single remaining failure (`a_heap_buffer_read_where_no_buffer_view_is_reads_zeros`) reproduces identically on clean `origin/main`. - `cargo test -p victory-gpu --lib descriptor::host:: -- --test-threads=1 --skip dynamic_slots_are_held_until_released`: 16/16 passed (including `overlap_test::gpu_writes_visible_through_overlapping_views` and `structured_buffer_views_stay_raw_on_host_and_keep_stride_table`). - `cargo test -p victory-gpu --lib draw:: -- --test-threads=1`: 20/20 passed. - `cargo clippy -p victory-shader -p victory-gpu --all-targets -- -D warnings`: clean. - `cargo xtask policy`: 192 files ok. Great NVIDIA fix (FIND-11): viewing structured buffers raw on the host makes heap-indexed structured buffer reads work cleanly on RTX 5090. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
fuzeofficlal commented 2026-11-26 09:51:08 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T09:51:08Z.

Review: CHANGES_REQUESTED


The raw-view + VIEW_STRIDES 0..12-byte bias approach works cleanly on NVIDIA hardware — verified locally on Windows 11 with an RTX 5090 and WARP (git merge-tree against 63bcca43 clean, cargo clippy --workspace --all-targets [--all-features] -- -D warnings clean, cargo xtask policy 192 files ok):

  • descriptor::host::overlap_test::gpu_writes_visible_through_overlapping_views: passed (0/2400 mismatches) on RTX 5090, RTX 5090 + VICTORY_D3D12_DEBUG=1, and WARP + VICTORY_D3D12_DEBUG=1
  • structured_buffer_views_stay_raw_on_host_and_keep_stride_table and structured_views_off_their_buffers_elements_get_their_own_copy: passed on RTX 5090, RTX 5090 Debug, and WARP Debug
  • victory-shader stride_tests:: + diff_tests:: + waterfall_tests::: 19/20 passed on RTX 5090 + WARP (including both new structured-buffer tests; the lone a_heap_buffer_read_where_no_buffer_view_is_reads_zeros failure reproduces identically on origin/main 63bcca43 due to NVIDIA's 1M heap cap in emit::host).

Two correctness bugs should be fixed before merge:

1. Out-of-bounds VIEW_STRIDES root-SRV read and silently dropped raw_bias for dynamic-slot tables (crates/victory-gpu/src/descriptor/host.rs:129-143, 511-519)

Before this PR, table-bound structured buffers used native structured handles (12 | u, stride) and did not read VIEW_STRIDES. Now every table-bound structured buffer (u.stride >= 4) loads VIEW_STRIDES[index] via view_raw_bias(h) -> view_word(index) (lower.rs:1808-1815, 4646-4652) using the unclamped heap slot index from entry_heap_index/heap_index.

However, HostHeap::new allocates self.strides for only count.max(HEAP_VIEWS) dwords (host.rs:130), and write_stride drops any write with index >= self.count.max(HEAP_VIEWS) (host.rs:513). On uncapped heaps where count + extra > count.max(HEAP_VIEWS) (e.g. a title heap with count = 1_245_184 + DYNAMIC = 262_144, or count = 900_000 + 262_144 > HEAP_VIEWS), any fresh descriptor table placed in dynamic slots at index >= count.max(HEAP_VIEWS) has its raw_bias write silently dropped and causes the shader to read past the end of the VIEW_STRIDES root SRV (no hardware bounds check — garbage bias or GPU page fault / device removal).

Allocating strides (and marks symmetrically at lines 135 & 531) after (heap, count, extra) is resolved with (count + extra).max(views) entries, and checking index >= (self.count + self.dynamic).max(HEAP_VIEWS) in write_stride / set_mark, fixes this cleanly.

2. ClearUnorderedAccessViewUint/Float on a biased (bias = 4/8/12) structured UAV clobbers 4..12 preceding bytes in the shared host copy (descriptor/host.rs:1393-1415, draw.rs:1056-1085)

buffer_uav rounds FirstElement down by bias = offset & 15 (aligned = offset - bias) and sets NumElements = (total_bytes + bias) / 4, relying on translated shaders to skip the leading bias bytes via VIEW_STRIDES.

draw.rs::clear_unordered invokes ClearUnorderedAccessViewUint/Float directly on that biased raw host UAV without shader execution (and with unshifted rects). When bias > 0, D3D12 clears [aligned, aligned + raw_count * 4), overwriting the 4..12 bytes immediately preceding start inside the shared Shadow buffer — bytes outside buffer_range(&view) that readable did not even snapshot.

For bias > 0 structured UAVs, clear_unordered needs to restrict the clear to [bias / 4 .. raw_count) (via shifted/clamped D3D12_RECTs on the raw buffer UAV, or an exact 16-byte-aligned clear path) so preceding neighbor bytes in the shared copy are never overwritten.

3. Minor: getDimensions (num_records) with idxen == false on a table-bound structured buffer (crates/victory-shader/src/emit/lower.rs:4442-4455)

When a table-bound buffer with used.stride >= 4 is accessed via buffer_load with idxen == false (div_stride == None, !is_heap_direct), line 4445 skips subtracting view_raw_bias(h), returning total_bytes + bias instead of total_bytes. Including || used.is_some_and(|u| u.stride >= 4) in that condition handles it consistently.

<!-- greyfinch-sync:Marvisak/VIctory:review:6071873593 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2885#pullrequestreview-6071873593). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-26T09:51:08Z. **Review:** CHANGES_REQUESTED --- The raw-view + `VIEW_STRIDES` 0..12-byte bias approach works cleanly on NVIDIA hardware — verified locally on Windows 11 with an RTX 5090 and WARP (`git merge-tree` against `63bcca43` clean, `cargo clippy --workspace --all-targets [--all-features] -- -D warnings` clean, `cargo xtask policy` `192 files ok`): - `descriptor::host::overlap_test::gpu_writes_visible_through_overlapping_views`: **passed (0/2400 mismatches)** on RTX 5090, RTX 5090 + `VICTORY_D3D12_DEBUG=1`, and WARP + `VICTORY_D3D12_DEBUG=1` - `structured_buffer_views_stay_raw_on_host_and_keep_stride_table` and `structured_views_off_their_buffers_elements_get_their_own_copy`: passed on RTX 5090, RTX 5090 Debug, and WARP Debug - `victory-shader` `stride_tests::` + `diff_tests::` + `waterfall_tests::`: 19/20 passed on RTX 5090 + WARP (including both new structured-buffer tests; the lone `a_heap_buffer_read_where_no_buffer_view_is_reads_zeros` failure reproduces identically on `origin/main` `63bcca43` due to NVIDIA's 1M heap cap in `emit::host`). Two correctness bugs should be fixed before merge: ### 1. Out-of-bounds `VIEW_STRIDES` root-SRV read and silently dropped `raw_bias` for dynamic-slot tables (`crates/victory-gpu/src/descriptor/host.rs:129-143, 511-519`) Before this PR, table-bound structured buffers used native structured handles `(12 | u, stride)` and did not read `VIEW_STRIDES`. Now every table-bound structured buffer (`u.stride >= 4`) loads `VIEW_STRIDES[index]` via `view_raw_bias(h)` -> `view_word(index)` (`lower.rs:1808-1815, 4646-4652`) using the unclamped heap slot `index` from `entry_heap_index`/`heap_index`. However, `HostHeap::new` allocates `self.strides` for only `count.max(HEAP_VIEWS)` dwords (`host.rs:130`), and `write_stride` drops any write with `index >= self.count.max(HEAP_VIEWS)` (`host.rs:513`). On uncapped heaps where `count + extra > count.max(HEAP_VIEWS)` (e.g. a title heap with `count = 1_245_184` + `DYNAMIC = 262_144`, or `count = 900_000` + `262_144 > HEAP_VIEWS`), any fresh descriptor table placed in dynamic slots at `index >= count.max(HEAP_VIEWS)` has its `raw_bias` write silently dropped and causes the shader to read **past the end of the `VIEW_STRIDES` root SRV** (no hardware bounds check — garbage bias or GPU page fault / device removal). Allocating `strides` (and `marks` symmetrically at lines 135 & 531) *after* `(heap, count, extra)` is resolved with `(count + extra).max(views)` entries, and checking `index >= (self.count + self.dynamic).max(HEAP_VIEWS)` in `write_stride` / `set_mark`, fixes this cleanly. ### 2. `ClearUnorderedAccessViewUint`/`Float` on a biased (`bias = 4/8/12`) structured UAV clobbers `4..12` preceding bytes in the shared host copy (`descriptor/host.rs:1393-1415`, `draw.rs:1056-1085`) `buffer_uav` rounds `FirstElement` down by `bias = offset & 15` (`aligned = offset - bias`) and sets `NumElements = (total_bytes + bias) / 4`, relying on translated shaders to skip the leading `bias` bytes via `VIEW_STRIDES`. `draw.rs::clear_unordered` invokes `ClearUnorderedAccessViewUint`/`Float` directly on that biased raw host UAV without shader execution (and with unshifted `rects`). When `bias > 0`, D3D12 clears `[aligned, aligned + raw_count * 4)`, overwriting the `4..12` bytes immediately preceding `start` inside the shared `Shadow` buffer — bytes outside `buffer_range(&view)` that `readable` did not even snapshot. For `bias > 0` structured UAVs, `clear_unordered` needs to restrict the clear to `[bias / 4 .. raw_count)` (via shifted/clamped `D3D12_RECT`s on the raw buffer UAV, or an exact 16-byte-aligned clear path) so preceding neighbor bytes in the shared copy are never overwritten. ### 3. Minor: `getDimensions` (`num_records`) with `idxen == false` on a table-bound structured buffer (`crates/victory-shader/src/emit/lower.rs:4442-4455`) When a table-bound buffer with `used.stride >= 4` is accessed via `buffer_load` with `idxen == false` (`div_stride == None`, `!is_heap_direct`), line 4445 skips subtracting `view_raw_bias(h)`, returning `total_bytes + bias` instead of `total_bytes`. Including `|| used.is_some_and(|u| u.stride >= 4)` in that condition handles it consistently.
frenziedcoder commented 2026-11-26 10:05:03 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by frenziedcoder on 2026-11-26T09:13:31Z.


RTX 5080 (Blackwell), driver 621.40, title runs: with this PR in place of #2464 in the NVIDIA stack, the interior shots draw a character that #2464's tree draws as broken spikes, with no other change in what translates and no device removal in 600 s. For the choice between this PR and #2464 the triage mentions, measured in the title rather than synthetically.

Trees: main 842b0cb + #1906, #2098, #2626, #2628, #2176 (fb99078), #2118 + the local wave32_approx change and BVH-builder hold-back from #2176's thread, and then either #2464 (b9dc4b0) or this PR (e7250c5; #2464 reverted cleanly, this PR merged cleanly). Diag build, VICTORY_D3D12_DRED=1, scripted Enter, 600 s, one run each.

with #2464 with this PR
programs refused (translate --cache) 426 426
pipelines skipped, compute / pixel shader does not translate 219 / 1 219 / 1
programs whose draws were dropped in the run 85 85
host pipelines refused 0 0
device removed in 600 s no no
world's first frame frame 1,268 (52 s) frame 1,346 (56 s)
frame 2,048 reached at 528 s 548 s
interior shot (frames ~1,500–2,048) window and room; where the character stands, spiky dark shards (frames 1,508, 1,748, 2,048) the character drawn whole in front of the window (head, hair, shoulders), room less broken (frames 1,586, 2,048)

The translation counts are identical, so the difference is in how the views are made. My guess is the unaligned structured origins this PR copies to aligned ones and #2464 leaves structured (steven-seagull27's 12/24/36-byte case), but I haven't traced which buffer the character reads.

Synthetic, same tree: emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride passes (it fails on main on this card); a_heap_buffer_read_where_no_buffer_view_is_reads_zeros still fails with dispatch failed: The parameter is incorrect, as on main (the view-heap cap of #1835). victory-gpu overlap tests: 2 passed.

Not tested: 767f228 (pushed after these runs; the view_raw_bias stride-reuse cleanup); more than one run per tree; this PR without the rest of the stack; AMD.

AI use: Claude Code (Claude Opus 5.5) built the trees, ran the title on my machine (sandboxed at Low integrity, game folder read-only), read the logs and frame captures, and wrote this report.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7187619353 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2885#issuecomment-7187619353). Originally posted by [frenziedcoder](https://github.com/frenziedcoder) on 2026-11-26T09:13:31Z. --- **RTX 5080 (Blackwell), driver 621.40, title runs: with this PR in place of #2464 in the NVIDIA stack, the interior shots draw a character that #2464's tree draws as broken spikes, with no other change in what translates and no device removal in 600 s.** For the choice between this PR and #2464 the triage mentions, measured in the title rather than synthetically. **Trees:** `main` `842b0cb` + #1906, #2098, #2626, #2628, #2176 (`fb99078`), #2118 + the local `wave32_approx` change and BVH-builder hold-back from #2176's thread, and then either #2464 (`b9dc4b0`) or this PR (`e7250c5`; #2464 reverted cleanly, this PR merged cleanly). Diag build, `VICTORY_D3D12_DRED=1`, scripted `Enter`, 600 s, one run each. | | with #2464 | with this PR | |---|---|---| | programs refused (`translate --cache`) | 426 | 426 | | pipelines skipped, compute / pixel shader does not translate | 219 / 1 | 219 / 1 | | programs whose draws were dropped in the run | 85 | 85 | | host pipelines refused | 0 | 0 | | device removed in 600 s | no | no | | world's first frame | frame 1,268 (52 s) | frame 1,346 (56 s) | | frame 2,048 reached at | 528 s | 548 s | | interior shot (frames ~1,500–2,048) | window and room; where the character stands, spiky dark shards (frames 1,508, 1,748, 2,048) | **the character drawn whole in front of the window** (head, hair, shoulders), room less broken (frames 1,586, 2,048) | The translation counts are identical, so the difference is in how the views are made. My guess is the unaligned structured origins this PR copies to aligned ones and #2464 leaves structured (steven-seagull27's 12/24/36-byte case), but I haven't traced which buffer the character reads. Synthetic, same tree: `emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride` passes (it fails on `main` on this card); `a_heap_buffer_read_where_no_buffer_view_is_reads_zeros` still fails with `dispatch failed: The parameter is incorrect`, as on `main` (the view-heap cap of #1835). `victory-gpu` `overlap` tests: 2 passed. **Not tested:** `767f228` (pushed after these runs; the `view_raw_bias` stride-reuse cleanup); more than one run per tree; this PR without the rest of the stack; AMD. *AI use: Claude Code (Claude Opus 5.5) built the trees, ran the title on my machine (sandboxed at Low integrity, game folder read-only), read the logs and frame captures, and wrote this report.*
qtLkz commented 2026-11-26 10:05:10 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by qtLkz on 2026-11-26T10:03:46Z.


Tested on NVIDIA Ada (the description has Turing): RTX 4070 Ti, driver 621.01, Windows 11 Pro 26300, Rust 1.98.1, this PR (767f228) on main 63bcca4, together with #2596 / #2683 / #2633 (clean merges), fixtures untouched.

cargo test -p victory-shader --lib --locked -- --test-threads=1: 313 passed, 0 failed, including the two that fail on NVIDIA on main because of raw reads through structured views:

  • stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride ... ok (on main: left: [101, 104, 107, ...], right: [200, 201, ...], the stride applied twice)
  • synthetic_tests::gathers_at_a_level_match_the_hardware ... ok

victory-gpu: 233 passed, 0 failed. Full workspace green. Details in #2317.

AI-assisted (Claude).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7188857014 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2885#issuecomment-7188857014). Originally posted by [qtLkz](https://github.com/qtLkz) on 2026-11-26T10:03:46Z. --- Tested on NVIDIA Ada (the description has Turing): RTX 4070 Ti, driver 621.01, Windows 11 Pro 26300, Rust 1.98.1, this PR (`767f228`) on main `63bcca4`, together with #2596 / #2683 / #2633 (clean merges), fixtures untouched. `cargo test -p victory-shader --lib --locked -- --test-threads=1`: **313 passed, 0 failed**, including the two that fail on NVIDIA on main because of raw reads through structured views: - `stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride ... ok` (on main: `left: [101, 104, 107, ...]`, `right: [200, 201, ...]`, the stride applied twice) - `synthetic_tests::gathers_at_a_level_match_the_hardware ... ok` victory-gpu: 233 passed, 0 failed. Full workspace green. Details in #2317. AI-assisted (Claude).
qtLkz commented 2026-11-26 11:03:58 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by qtLkz on 2026-11-26T10:07:04Z.


Tested on NVIDIA Ada (the description has Turing): RTX 4070 Ti, driver 621.01, Windows 11 Pro 26300, Rust 1.98.1, this PR (767f228) on main 63bcca4, together with #2596 / #2683 / #2633 (clean merges), fixtures untouched.

cargo test -p victory-shader --lib --locked -- --test-threads=1: 313 passed, 0 failed, including the two that fail on NVIDIA on main because of raw reads through structured views:

  • stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride ... ok (on main: left: [101, 104, 107, ...], right: [200, 201, ...], the stride applied twice)
  • synthetic_tests::gathers_at_a_level_match_the_hardware ... ok

victory-gpu: 233 passed, 0 failed. Full workspace green. Details in #2317.

AI-assisted (Claude).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7188930381 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2885#issuecomment-7188930381). Originally posted by [qtLkz](https://github.com/qtLkz) on 2026-11-26T10:07:04Z. --- Tested on NVIDIA Ada (the description has Turing): RTX 4070 Ti, driver 621.01, Windows 11 Pro 26300, Rust 1.98.1, this PR (`767f228`) on main `63bcca4`, together with #2596 / #2683 / #2633 (clean merges), fixtures untouched. `cargo test -p victory-shader --lib --locked -- --test-threads=1`: **313 passed, 0 failed**, including the two that fail on NVIDIA on main because of raw reads through structured views: - `stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride ... ok` (on main: `left: [101, 104, 107, ...]`, `right: [200, 201, ...]`, the stride applied twice) - `synthetic_tests::gathers_at_a_level_match_the_hardware ... ok` victory-gpu: 233 passed, 0 failed. Full workspace green. Details in #2317. AI-assisted (Claude).
steven-seagull27 commented 2026-11-26 11:04:04 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by steven-seagull27 on 2026-11-26T10:49:09Z.


@jujumoneylol @fuzeofficlal I reproduced the structured UAV clear in review item 2 on native Windows. Both the RTX 5080 and inbox WARP gave the following results in two fresh runs per adapter and revision.

Revision Cases matching both readbacks Wrong words in shared GPU buffer Wrong words in title copy
PR head 767f228 4/16 36/512 22/512
With 22f19d9 16/16 0/512 0/512

Each case starts with 32 distinct guard words in one allocated buffer. A six-record view with a 12-byte stride starts at a 0, 4, 8, or 12-byte bias. The test clears either the whole view or the relative word rectangle [2,6), with both Uint and Float. On the PR head the whole clear changed exactly one, two, or three preceding words at the respective nonzero biases. The title copy hid those changes because it only copied the logical view back. At bias 12, the rectangle was shifted three words toward the start of the buffer, giving six wrong GPU words.

The fix uses an exact R32_UINT view with zero structure stride and no RAW flag for the biased native clear, and copies that CPU descriptor into the shader-visible slot. The clear itself produced no D3D12 InfoQueue warnings or errors on either adapter, measured after heap setup through execution. Four existing overlap, structured-view and clear-slot tests also passed on each. This covers the clear item. The stride-table and getDimensions review items remain separate.

The commit applies directly to 767f228. Fork commit · Downloadable patch

git fetch https://github.com/steven-seagull27/VIctory.git codex/pr2885-structured-clear-range
git cherry-pick 22f19d9
$env:VICTORY_D3D12_DEBUG = '1'
$env:VICTORY_D3D12_WARP = '0'
cargo test -p victory-gpu --features diagnostics --lib structured_clears_preserve_neighbor_words -- --nocapture
$env:VICTORY_D3D12_WARP = '1'
cargo test -p victory-gpu --features diagnostics --lib structured_clears_preserve_neighbor_words -- --nocapture

AI-assisted patch and tests, run locally.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7189878332 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2885#issuecomment-7189878332). Originally posted by [steven-seagull27](https://github.com/steven-seagull27) on 2026-11-26T10:49:09Z. --- @jujumoneylol @fuzeofficlal I reproduced the structured UAV clear in [review item 2](https://github.com/Marvisak/VIctory/pull/2885#pullrequestreview-6071873593) on native Windows. Both the RTX 5080 and inbox WARP gave the following results in two fresh runs per adapter and revision. | Revision | Cases matching both readbacks | Wrong words in shared GPU buffer | Wrong words in title copy | |---|---:|---:|---:| | PR head `767f228` | 4/16 | 36/512 | 22/512 | | With `22f19d9` | 16/16 | 0/512 | 0/512 | Each case starts with 32 distinct guard words in one allocated buffer. A six-record view with a 12-byte stride starts at a 0, 4, 8, or 12-byte bias. The test clears either the whole view or the relative word rectangle `[2,6)`, with both Uint and Float. On the PR head the whole clear changed exactly one, two, or three preceding words at the respective nonzero biases. The title copy hid those changes because it only copied the logical view back. At bias 12, the rectangle was shifted three words toward the start of the buffer, giving six wrong GPU words. The fix uses an exact `R32_UINT` view with zero structure stride and no RAW flag for the biased native clear, and copies that CPU descriptor into the shader-visible slot. The clear itself produced no D3D12 InfoQueue warnings or errors on either adapter, measured after heap setup through execution. Four existing overlap, structured-view and clear-slot tests also passed on each. This covers the clear item. The stride-table and `getDimensions` review items remain separate. The commit applies directly to `767f228`. [Fork commit](https://github.com/steven-seagull27/VIctory/commit/22f19d9ac966fe0deaa7f1b1a31451c51821fac6) · [Downloadable patch](https://github.com/steven-seagull27/VIctory/commit/22f19d9ac966fe0deaa7f1b1a31451c51821fac6.patch) ```powershell git fetch https://github.com/steven-seagull27/VIctory.git codex/pr2885-structured-clear-range git cherry-pick 22f19d9 $env:VICTORY_D3D12_DEBUG = '1' $env:VICTORY_D3D12_WARP = '0' cargo test -p victory-gpu --features diagnostics --lib structured_clears_preserve_neighbor_words -- --nocapture $env:VICTORY_D3D12_WARP = '1' cargo test -p victory-gpu --features diagnostics --lib structured_clears_preserve_neighbor_words -- --nocapture ``` AI-assisted patch and tests, run locally.
ThomasHFWright commented 2026-11-26 13:04:36 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by ThomasHFWright on 2026-11-26T13:00:50Z.


Proton data point for 767f228. I ported the shared raw-view approach to LinVxtory’s PR995-based renderer and tested it on CachyOS with an RTX 5090 (NVIDIA 620.73.04) and GE-Proton 11-14.

  • Buffer correctness: 9 focused GPU-crate tests and 6 shader tests passed. This included 1,536 readback values through overlapping SRV/UAV views with byte prefixes 0, 4, 8 and 12, plus per-lane descriptor selection, stores and atomics. The title log also recorded a live structured buffer bound as raw with an 8-byte prefix and 100-byte stride.
  • Room replay: One cold run per build from the same checkpoint, using the same preset and scripted camera route. In matched side and near-frontal views the hair still looked bundled, and the bunk rail was still visible through the cheek gap. The +180 to +330 second world interval measured 2.95 FPS on the control and 3.03 FPS with the port. The launch harness ended by signal after about 572 seconds, after both camera turns. The candidate log showed no device loss.
  • Review scope: The port uses a fixed stride table covering its view-heap range, clamps metadata lookups and subtracts the prefix on the dimensions path. Those are source checks. This renderer has no direct native ClearUnorderedAccessView call, so this run adds no coverage for the upstream clear issue.

Source-only faces-hair branch · Reproduction notes and results

AI-assisted port and validation. The measurements are from my machine.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7192756649 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2885#issuecomment-7192756649). Originally posted by [ThomasHFWright](https://github.com/ThomasHFWright) on 2026-11-26T13:00:50Z. --- Proton data point for `767f228`. I ported the shared raw-view approach to LinVxtory’s PR995-based renderer and tested it on CachyOS with an RTX 5090 (NVIDIA 620.73.04) and GE-Proton 11-14. - **Buffer correctness:** 9 focused GPU-crate tests and 6 shader tests passed. This included 1,536 readback values through overlapping SRV/UAV views with byte prefixes 0, 4, 8 and 12, plus per-lane descriptor selection, stores and atomics. The title log also recorded a live structured buffer bound as raw with an 8-byte prefix and 100-byte stride. - **Room replay:** One cold run per build from the same checkpoint, using the same preset and scripted camera route. In matched side and near-frontal views the hair still looked bundled, and the bunk rail was still visible through the cheek gap. The +180 to +330 second world interval measured 2.95 FPS on the control and 3.03 FPS with the port. The launch harness ended by signal after about 572 seconds, after both camera turns. The candidate log showed no device loss. - **Review scope:** The port uses a fixed stride table covering its view-heap range, clamps metadata lookups and subtracts the prefix on the dimensions path. Those are source checks. This renderer has no direct native `ClearUnorderedAccessView` call, so this run adds no coverage for the upstream clear issue. [Source-only faces-hair branch](https://github.com/ThomasHFWright/LinVxtory/tree/faces-hair) · [Reproduction notes and results](https://github.com/ThomasHFWright/LinVxtory/blob/0ee527c40a89f8c6d16fc30492780ecdffabe327/docs/pr995-candidate/validation.md#room-comparison-for-victory-pr2885) AI-assisted port and validation. The measurements are from my machine.
potatoe0100 commented 2026-11-26 14:40:49 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by potatoe0100 on 2026-11-26T14:40:49Z.

Review: COMMENTED


RTX 4060 8 GB (Ada), driver 621.14, Windows 11 Pro 26300. --test-threads=1, skipping only heap_direct_texture_reads_mark_their_heap_index (#2571).

With #2461: main 63bcca4 + this PR (767f228) + #2461 (6544a52). The only conflict is the pub use shader::{...} list in emit/mod.rs: keep both sides and drop NULL_BUFFER_VIEW. Results: victory-gpu --lib 234 passed, 0 failed, and victory-shader --lib 303 passed, 0 failed. main fails 5 on this card, so the two PRs together clear every NVIDIA unit-test failure here.

Clear item (review 2): I ran @steven-seagull27's fixture from 22f19d9 against this head. 12 of 16 cases are wrong, with 36 wrong words in the shared GPU buffer and 22 in the title copy. That matches the RTX 5080 numbers exactly. With 22f19d9 cherry-picked on top, all 16 cases are correct with 0 and 0 wrong words, and the full suites still pass (235 / 303, 0 failed). Folding 22f19d9 in would close that item.

Item 1 of the same review (out-of-bounds VIEW_STRIDES read): this doesn't look reachable to me. Shader::heap_handle clamps the index to HEAP_VIEWS - 1 before it stores it in view_index, and view_raw_bias / view_word read through that clamped index. The stride table has count.max(HEAP_VIEWS) entries, so the read stays inside it. Dynamic slots at or past HEAP_VIEWS only exist when count > HEAP_VIEWS - DYNAMIC (1,835,008), and the retail heap is 1,245,184. Shaders on main can't address those slots either, because of the same clamp. So I don't think it should block this PR.

AI-assisted (Claude). Unit tests only, no game data.

<!-- greyfinch-sync:Marvisak/VIctory:review:6076016205 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2885#pullrequestreview-6076016205). Originally posted by [potatoe0100](https://github.com/potatoe0100) on 2026-11-26T14:40:49Z. **Review:** COMMENTED --- RTX 4060 8 GB (Ada), driver 621.14, Windows 11 Pro 26300. `--test-threads=1`, skipping only `heap_direct_texture_reads_mark_their_heap_index` (#2571). **With #2461:** `main` `63bcca4` + this PR (`767f228`) + #2461 (`6544a52`). The only conflict is the `pub use shader::{...}` list in `emit/mod.rs`: keep both sides and drop `NULL_BUFFER_VIEW`. Results: `victory-gpu --lib` 234 passed, 0 failed, and `victory-shader --lib` 303 passed, 0 failed. `main` fails 5 on this card, so the two PRs together clear every NVIDIA unit-test failure here. **Clear item (review 2):** I ran @steven-seagull27's fixture from `22f19d9` against this head. 12 of 16 cases are wrong, with 36 wrong words in the shared GPU buffer and 22 in the title copy. That matches the RTX 5080 numbers exactly. With `22f19d9` cherry-picked on top, all 16 cases are correct with 0 and 0 wrong words, and the full suites still pass (235 / 303, 0 failed). Folding `22f19d9` in would close that item. **Item 1 of the same review (out-of-bounds `VIEW_STRIDES` read):** this doesn't look reachable to me. `Shader::heap_handle` clamps the index to `HEAP_VIEWS - 1` before it stores it in `view_index`, and `view_raw_bias` / `view_word` read through that clamped index. The stride table has `count.max(HEAP_VIEWS)` entries, so the read stays inside it. Dynamic slots at or past `HEAP_VIEWS` only exist when `count > HEAP_VIEWS - DYNAMIC` (1,835,008), and the retail heap is 1,245,184. Shaders on `main` can't address those slots either, because of the same clamp. So I don't think it should block this PR. AI-assisted (Claude). Unit tests only, no game data.
qtLkz commented 2026-11-26 16:05:04 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by qtLkz on 2026-11-26T15:21:37Z.


@steven-seagull27 @jujumoneylol I reproduced the structured UAV clear result for 22f19d9 on NVIDIA Ada. Setup: RTX 4070 Ti, driver 621.01, Windows 11 Pro 26300, Rust 1.98.1. Both trees were built from the PR alone, without the rest of the NVIDIA stack.

structured_clears_preserve_neighbor_words_in_the_shared_buffer (--features diagnostics, VICTORY_D3D12_DEBUG=1, one run per adapter and tree):

Tree Adapter Cases matching both readbacks Wrong words in shared GPU buffer Wrong words in title copy
767f228 + test file only RTX 4070 Ti 4/16 36/512 22/512
767f228 + test file only WARP 4/16 36/512 22/512
767f228 + 22f19d9 RTX 4070 Ti 16/16 0/512 0/512
767f228 + 22f19d9 WARP 16/16 0/512 0/512

The per-case counts on the PR head match yours exactly. Whole-view clears overwrite 1, 2 and 3 GPU words at biases 4, 8 and 12, and the title copy does not show them. The [2,6) rectangle gives 2, 4 and 6 wrong GPU words. Bias 0 is clean on every case.

Full suites (cargo test -p <crate> --lib --locked -- --test-threads=1):

767f228 767f228 + 22f19d9
victory-shader 302 passed, 1 failed 302 passed, 1 failed
victory-gpu 231 passed, 2 failed 232 passed (+ the new clear test), 2 failed

The same three tests fail on both trees, and all three come from the NVIDIA 1M view-heap cap (FIND-9, addressed by #2683), not from this PR:

  • emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros: dispatch failed: The parameter is incorrect
  • descriptor::host::tests::dynamic_slots_are_held_until_released: NumDescriptors >= HEAP_VIEWS
  • memory::tests::lists_share_a_table_and_copies_keep_their_views: past the dynamic slots

emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index was skipped on both trees, because it crashes the NVIDIA driver and stops the shader run (#2571, fixed by #2596/#2587). 22f19d9 introduces no new failures on Ada.

AI-assisted (Claude).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7196156021 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2885#issuecomment-7196156021). Originally posted by [qtLkz](https://github.com/qtLkz) on 2026-11-26T15:21:37Z. --- @steven-seagull27 @jujumoneylol I reproduced the structured UAV clear result for `22f19d9` on NVIDIA Ada. Setup: RTX 4070 Ti, driver 621.01, Windows 11 Pro 26300, Rust 1.98.1. Both trees were built from the PR alone, without the rest of the NVIDIA stack. **`structured_clears_preserve_neighbor_words_in_the_shared_buffer`** (`--features diagnostics`, `VICTORY_D3D12_DEBUG=1`, one run per adapter and tree): | Tree | Adapter | Cases matching both readbacks | Wrong words in shared GPU buffer | Wrong words in title copy | |---|---|---:|---:|---:| | `767f228` + test file only | RTX 4070 Ti | 4/16 | 36/512 | 22/512 | | `767f228` + test file only | WARP | 4/16 | 36/512 | 22/512 | | `767f228` + `22f19d9` | RTX 4070 Ti | 16/16 | 0/512 | 0/512 | | `767f228` + `22f19d9` | WARP | 16/16 | 0/512 | 0/512 | The per-case counts on the PR head match yours exactly. Whole-view clears overwrite 1, 2 and 3 GPU words at biases 4, 8 and 12, and the title copy does not show them. The `[2,6)` rectangle gives 2, 4 and 6 wrong GPU words. Bias 0 is clean on every case. **Full suites** (`cargo test -p <crate> --lib --locked -- --test-threads=1`): | | `767f228` | `767f228` + `22f19d9` | |---|---|---| | victory-shader | 302 passed, 1 failed | 302 passed, 1 failed | | victory-gpu | 231 passed, 2 failed | 232 passed (+ the new clear test), 2 failed | The same three tests fail on both trees, and all three come from the NVIDIA 1M view-heap cap (FIND-9, addressed by #2683), not from this PR: - `emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros`: `dispatch failed: The parameter is incorrect` - `descriptor::host::tests::dynamic_slots_are_held_until_released`: `NumDescriptors >= HEAP_VIEWS` - `memory::tests::lists_share_a_table_and_copies_keep_their_views`: `past the dynamic slots` `emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index` was skipped on both trees, because it crashes the NVIDIA driver and stops the shader run (#2571, fixed by #2596/#2587). `22f19d9` introduces no new failures on Ada. AI-assisted (Claude).
upipibi commented 2026-11-26 17:18:09 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by upipibi on 2026-11-26T17:18:09Z.


NVIDIA Ampere check of 767f228: RTX 3070 8 GB, driver 616.56, Windows 11, rustc 1.100.0, hardware adapter. main 63bcca4 as control, each tree in its own target dir, --locked -- --test-threads=1. Synthetic tests only.

test main 63bcca4 PR 767f228
emit::stride_tests:: 6 pass, 2 fail 9 pass, 1 fail
gathers_at_a_level_match_the_hardware, 3 runs fails 3/3 (lane 0 [0,1,0,0], want [0,0,0,0]) passes 3/3
descriptor::host::, 3 runs 14 pass, 1 fail each 16 pass, 1 fail each; overlap_test::gpu_writes_visible_through_overlapping_views passes 3/3
victory-shader --lib (skipping the #2571 test) 298 pass, 3 fail 302 pass, 1 fail
victory-gpu --lib 229 pass, 2 fail 231 pass, 2 fail
  • On main, a_heap_buffer_read_by_element_takes_the_views_stride reads [101,104,…,131,0,…] where [200..231] is wanted. It passes with the PR.
  • These still fail on both trees:
    • a_heap_buffer_read_where_no_buffer_view_is_reads_zeros. On the PR it fails with "dispatch failed: The parameter is incorrect" (stride_tests.rs:533). Searched: the test name in VIctory issues and PRs. It is the null-buffer read on a capped heap from #1835; #3235, #1943 and #2177 propose fixes.
    • dynamic_slots_are_held_until_released and lists_share_a_table_and_copies_keep_their_views (the HEAP_VIEWS cap; tracked in #1744 and #3178).
  • No driver resets during the runs.
  • Not tested: the nonzero-offset structured UAV clear (22f19d9, not in this PR).

AI-assisted (Claude Code, Claude Sonnet 5.5 ran the tests; Claude Opus 5.5 checked and posted).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7198796380 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2885#issuecomment-7198796380). Originally posted by [upipibi](https://github.com/upipibi) on 2026-11-26T17:18:09Z. --- NVIDIA Ampere check of `767f228`: RTX 3070 8 GB, driver 616.56, Windows 11, rustc 1.100.0, hardware adapter. `main` `63bcca4` as control, each tree in its own target dir, `--locked -- --test-threads=1`. Synthetic tests only. | test | main `63bcca4` | PR `767f228` | |---|---|---| | `emit::stride_tests::` | 6 pass, 2 fail | 9 pass, 1 fail | | `gathers_at_a_level_match_the_hardware`, 3 runs | fails 3/3 (lane 0 `[0,1,0,0]`, want `[0,0,0,0]`) | passes 3/3 | | `descriptor::host::`, 3 runs | 14 pass, 1 fail each | 16 pass, 1 fail each; `overlap_test::gpu_writes_visible_through_overlapping_views` passes 3/3 | | `victory-shader --lib` (skipping the #2571 test) | 298 pass, 3 fail | 302 pass, 1 fail | | `victory-gpu --lib` | 229 pass, 2 fail | 231 pass, 2 fail | - On `main`, `a_heap_buffer_read_by_element_takes_the_views_stride` reads `[101,104,…,131,0,…]` where `[200..231]` is wanted. It passes with the PR. - These still fail on both trees: - `a_heap_buffer_read_where_no_buffer_view_is_reads_zeros`. On the PR it fails with "dispatch failed: The parameter is incorrect" (`stride_tests.rs:533`). Searched: the test name in VIctory issues and PRs. It is the null-buffer read on a capped heap from #1835; #3235, #1943 and #2177 propose fixes. - `dynamic_slots_are_held_until_released` and `lists_share_a_table_and_copies_keep_their_views` (the `HEAP_VIEWS` cap; tracked in #1744 and #3178). - No driver resets during the runs. - Not tested: the nonzero-offset structured UAV clear (`22f19d9`, not in this PR). AI-assisted (Claude Code, Claude Sonnet 5.5 ran the tests; Claude Opus 5.5 checked and posted).
Jineggegg commented 2026-11-26 19:42:54 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Jineggegg on 2026-11-26T19:42:54Z.


jujumoneylol, item 3 of the review above (the size of a table-bound structured buffer read without idxen) reproduces on 767f228, on an RTX 5090 and on WARP. 3214c40 on top of 767f228 fixes it and extends the existing test. It changes one condition in emit/lower.rs and the test in emit/stride_tests.rs, and applies with or without 22f19d9.

What happens. For a table-bound buffer the program declares with a structured stride, raw_view adds the raw start bias when the handle is heap-direct or used.stride >= 4. The size read subtracted it only when the count is divided by the stride (div_stride, an idxen access) or the handle is heap-direct. A program that reads the same view by byte (offen) gets the view's size plus the bias: 396 instead of 384 bytes for 32 records of 12 bytes that start 12 bytes past a 16-byte boundary. The commit uses the loads' condition. div_stride is only Some when used.stride >= 4, so the idxen case is unchanged.

Test. table_bound_structured_buffer_reads_by_element_and_dimensions also runs the same program with buffer_load_dword v2, v1, s[8:11], 0 offen offset:4 in place of the idxen load, at bias 0 and 12, and expects the 32 dwords after the view's start, with 32 * 12 in lane 31.

cargo test -p victory-shader --lib --locked emit::stride_tests::table_bound_structured_buffer_reads_by_element_and_dimensions:

Tree RTX 5090 VICTORY_WARP=1
767f228 + the test change only fails at bias-12, by byte: lane 31 is 396, expected 384 same failure (with VICTORY_WARP=1 the first pass also runs on WARP but is labelled hardware)
767f228 + the commit passes passes

cargo test --workspace --locked --no-fail-fast, once on the RTX 5090 (skipping heap_direct_texture_reads_mark_their_heap_index, which ends the shader test process on NVIDIA, #2571) and once with VICTORY_WARP=1 VICTORY_D3D12_WARP=1. In that second run victory-shader runs on WARP. victory-gpu still runs on the RTX 5090, because its WARP switch only exists in diagnostics builds.

RTX 5090 VICTORY_WARP=1
767f228 872 passed, 3 failed (run in two parts: four slow shader tests and two small test binaries separately) 870 passed, 6 failed
+ the commit 872 passed, 3 failed 870 passed, 6 failed

On the RTX 5090 the three failures are the view-heap cap tests (a_heap_buffer_read_where_no_buffer_view_is_reads_zeros, dynamic_slots_are_held_until_released, lists_share_a_table_and_copies_keep_their_views). 767f228 fails the same three, as do the Ada runs above. With VICTORY_WARP=1 both trees fail the same six: the two victory-gpu cap tests, plus four shader tests (gathers_at_a_level_match_the_hardware (#3267), the two permutes_* tests, a_mask_joined_with_data_at_a_uniform_loop_is_its_number). Clippy, default and --all-features (as in ci.yml): clean. cargo xtask policy: 192 files ok.

Item 1 (stride table size). I agree with potatoe0100 that it can't be reached. Shader::heap_handle clamps every index below HEAP_VIEWS, and table-bound buffer handles go through it too (guarded_heap_handle). The stride and mark tables have count.max(HEAP_VIEWS) entries. Writes are only dropped for dynamic slots at or past count.max(HEAP_VIEWS), which no shader can address, so they don't change what shaders read. The same holds with #2121's paged heap, which caps title slots so that title and dynamic slots stay below the null buffer views. I didn't find a fixture that observes a difference, so the commit doesn't change it.

RTX 5090, driver 621.14, Windows 11 build 26300, in-box WARP 10.0.26100.9818, dxil.dll 1.9.2609.5, Rust 1.98.1.

Synthetic tests only, no game data. AI-assisted (Claude Code); the runs are from my machine.

🤖 Generated with Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7201884345 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2885#issuecomment-7201884345). Originally posted by [Jineggegg](https://github.com/Jineggegg) on 2026-11-26T19:42:54Z. --- jujumoneylol, item 3 of [the review above](https://github.com/Marvisak/VIctory/pull/2885#pullrequestreview-6071873593) (the size of a table-bound structured buffer read without `idxen`) reproduces on `767f228`, on an RTX 5090 and on WARP. [`3214c40`](https://github.com/Jineggegg/VIctory/commit/3214c404dc7bfac5ca648c36cd1a121be87be53a) on top of `767f228` fixes it and extends the existing test. It changes one condition in `emit/lower.rs` and the test in `emit/stride_tests.rs`, and applies with or without `22f19d9`. **What happens.** For a table-bound buffer the program declares with a structured stride, `raw_view` adds the raw start bias when the handle is heap-direct or `used.stride >= 4`. The size read subtracted it only when the count is divided by the stride (`div_stride`, an `idxen` access) or the handle is heap-direct. A program that reads the same view by byte (`offen`) gets the view's size plus the bias: 396 instead of 384 bytes for 32 records of 12 bytes that start 12 bytes past a 16-byte boundary. The commit uses the loads' condition. `div_stride` is only `Some` when `used.stride >= 4`, so the `idxen` case is unchanged. **Test.** `table_bound_structured_buffer_reads_by_element_and_dimensions` also runs the same program with `buffer_load_dword v2, v1, s[8:11], 0 offen offset:4` in place of the `idxen` load, at bias 0 and 12, and expects the 32 dwords after the view's start, with `32 * 12` in lane 31. `cargo test -p victory-shader --lib --locked emit::stride_tests::table_bound_structured_buffer_reads_by_element_and_dimensions`: | Tree | RTX 5090 | `VICTORY_WARP=1` | |---|---|---| | `767f228` + the test change only | fails at `bias-12, by byte`: lane 31 is 396, expected 384 | same failure (with `VICTORY_WARP=1` the first pass also runs on WARP but is labelled `hardware`) | | `767f228` + the commit | passes | passes | `cargo test --workspace --locked --no-fail-fast`, once on the RTX 5090 (skipping `heap_direct_texture_reads_mark_their_heap_index`, which ends the shader test process on NVIDIA, #2571) and once with `VICTORY_WARP=1 VICTORY_D3D12_WARP=1`. In that second run `victory-shader` runs on WARP. `victory-gpu` still runs on the RTX 5090, because its WARP switch only exists in `diagnostics` builds. | | RTX 5090 | `VICTORY_WARP=1` | |---|---|---| | `767f228` | 872 passed, 3 failed (run in two parts: four slow shader tests and two small test binaries separately) | 870 passed, 6 failed | | + the commit | 872 passed, 3 failed | 870 passed, 6 failed | On the RTX 5090 the three failures are the view-heap cap tests (`a_heap_buffer_read_where_no_buffer_view_is_reads_zeros`, `dynamic_slots_are_held_until_released`, `lists_share_a_table_and_copies_keep_their_views`). `767f228` fails the same three, as do the Ada runs above. With `VICTORY_WARP=1` both trees fail the same six: the two `victory-gpu` cap tests, plus four shader tests (`gathers_at_a_level_match_the_hardware` (#3267), the two `permutes_*` tests, `a_mask_joined_with_data_at_a_uniform_loop_is_its_number`). Clippy, default and `--all-features` (as in `ci.yml`): clean. `cargo xtask policy`: 192 files ok. **Item 1 (stride table size).** I agree with potatoe0100 that it can't be reached. `Shader::heap_handle` clamps every index below `HEAP_VIEWS`, and table-bound buffer handles go through it too (`guarded_heap_handle`). The stride and mark tables have `count.max(HEAP_VIEWS)` entries. Writes are only dropped for dynamic slots at or past `count.max(HEAP_VIEWS)`, which no shader can address, so they don't change what shaders read. The same holds with #2121's paged heap, which caps title slots so that title and dynamic slots stay below the null buffer views. I didn't find a fixture that observes a difference, so the commit doesn't change it. RTX 5090, driver 621.14, Windows 11 build 26300, in-box WARP 10.0.26100.9818, `dxil.dll` 1.9.2609.5, Rust 1.98.1. Synthetic tests only, no game data. AI-assisted (Claude Code); the runs are from my machine. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
jujumoneylol commented 2026-11-27 00:59:17 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by jujumoneylol on 2026-11-27T00:59:17Z.


Folded both reviewer fixes onto fix/find-11-raw-structured-buffers (preserving authorship):

  • 4ea6a86 (from @steven-seagull27's 22f19d9): addresses review item 2 from @fuzeofficlal — native ClearUnorderedAccessViewUint/Float on biased (4/8/12-byte) structured UAVs now uses an exact R32_UINT non-RAW view so preceding neighbor words in the shared buffer are untouched and clear rects stay aligned (structured_clears_preserve_neighbor_words_in_the_shared_buffer).
  • 76a13e1 (from @Jineggegg's 3214c40): addresses review item 3 from @fuzeofficlal — getDimensions (num_records) on a table-bound structured buffer read by byte (offen) now subtracts view_raw_bias under the same is_heap_direct || used.stride >= 4 condition as loads, with the byte-read test cases added to table_bound_structured_buffer_reads_by_element_and_dimensions.
  • Review item 1 (VIEW_STRIDES bounds on dynamic slots): as @potatoe0100 and @Jineggegg verified, Shader::heap_handle clamps every index below HEAP_VIEWS while strides is sized to count.max(HEAP_VIEWS), so the OOB read is not reachable.

Re-verified on Windows 11 / GTX 1650 + WARP (VICTORY_D3D12_DEBUG=1):

  • cargo xtask policy: 193 files ok
  • cargo clippy -p victory-shader -p victory-gpu --all-targets (default & --all-features, -D warnings): clean
  • victory-shader stride_tests (heap-indexed, element & byte table-bound dimensions at bias 0 and 12): 3/3 passed (GTX 1650 + WARP)
  • victory-gpu --features diagnostics overlap_test + structured_clears_preserve_neighbor_words_in_the_shared_buffer: 2/2 passed on GTX 1650 (WARP=0) and 2/2 passed on WARP (WARP=1).

Thanks @fuzeofficlal, @steven-seagull27, @Jineggegg, and @potatoe0100 for the catches and fixes!

<!-- greyfinch-sync:Marvisak/VIctory:comment:7206916308 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2885#issuecomment-7206916308). Originally posted by [jujumoneylol](https://github.com/jujumoneylol) on 2026-11-27T00:59:17Z. --- Folded both reviewer fixes onto `fix/find-11-raw-structured-buffers` (preserving authorship): - `4ea6a86` (from @steven-seagull27's `22f19d9`): addresses review item 2 from @fuzeofficlal — native `ClearUnorderedAccessViewUint`/`Float` on biased (`4/8/12`-byte) structured UAVs now uses an exact `R32_UINT` non-RAW view so preceding neighbor words in the shared buffer are untouched and clear rects stay aligned (`structured_clears_preserve_neighbor_words_in_the_shared_buffer`). - `76a13e1` (from @Jineggegg's `3214c40`): addresses review item 3 from @fuzeofficlal — `getDimensions` (`num_records`) on a table-bound structured buffer read by byte (`offen`) now subtracts `view_raw_bias` under the same `is_heap_direct || used.stride >= 4` condition as loads, with the byte-read test cases added to `table_bound_structured_buffer_reads_by_element_and_dimensions`. - Review item 1 (`VIEW_STRIDES` bounds on dynamic slots): as @potatoe0100 and @Jineggegg verified, `Shader::heap_handle` clamps every index below `HEAP_VIEWS` while `strides` is sized to `count.max(HEAP_VIEWS)`, so the OOB read is not reachable. Re-verified on Windows 11 / GTX 1650 + WARP (`VICTORY_D3D12_DEBUG=1`): - `cargo xtask policy`: 193 files ok - `cargo clippy -p victory-shader -p victory-gpu --all-targets` (default & `--all-features`, `-D warnings`): clean - `victory-shader` `stride_tests` (heap-indexed, element & byte table-bound dimensions at bias 0 and 12): 3/3 passed (GTX 1650 + WARP) - `victory-gpu --features diagnostics` `overlap_test` + `structured_clears_preserve_neighbor_words_in_the_shared_buffer`: 2/2 passed on GTX 1650 (`WARP=0`) and 2/2 passed on WARP (`WARP=1`). Thanks @fuzeofficlal, @steven-seagull27, @Jineggegg, and @potatoe0100 for the catches and fixes!
potatoe0100 commented 2026-11-27 03:08:21 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by potatoe0100 on 2026-11-27T03:08:21Z.


Retest of 76a13e1 on NVIDIA RTX 4060, driver 621.14, Windows 11. cargo test -p victory-gpu -p victory-shader --lib --locked -- --test-threads=1, skipping only heap_direct_texture_reads_mark_their_heap_index (#2571).

  • This head alone: victory-gpu 232 passed, 2 failed; victory-shader 302 passed, 1 failed. All three are the known view-heap cap failures (#1835): dynamic_slots_are_held_until_released, lists_share_a_table_and_copies_keep_their_views and a_heap_buffer_read_where_no_buffer_view_is_reads_zeros.
  • main 63bcca4 + this head + #2461 (6544a52), with the same emit/mod.rs import conflict as before: 235 passed, 0 failed and 303 passed, 0 failed.
  • The clear issue I reported at 767f228 is fixed: structured_clears_preserve_neighbor_words_in_the_shared_buffer passes. The new byte-read cases in table_bound_structured_buffer_reads_by_element_and_dimensions and gpu_writes_visible_through_overlapping_views also pass.

Unit tests only, no game data.

AI-assisted (Claude)

<!-- greyfinch-sync:Marvisak/VIctory:comment:7208737345 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2885#issuecomment-7208737345). Originally posted by [potatoe0100](https://github.com/potatoe0100) on 2026-11-27T03:08:21Z. --- Retest of `76a13e1` on NVIDIA RTX 4060, driver 621.14, Windows 11. `cargo test -p victory-gpu -p victory-shader --lib --locked -- --test-threads=1`, skipping only `heap_direct_texture_reads_mark_their_heap_index` (#2571). - **This head alone:** `victory-gpu` 232 passed, 2 failed; `victory-shader` 302 passed, 1 failed. All three are the known view-heap cap failures (#1835): `dynamic_slots_are_held_until_released`, `lists_share_a_table_and_copies_keep_their_views` and `a_heap_buffer_read_where_no_buffer_view_is_reads_zeros`. - **`main` `63bcca4` + this head + #2461 (`6544a52`),** with the same `emit/mod.rs` import conflict as before: 235 passed, 0 failed and 303 passed, 0 failed. - The clear issue I reported at `767f228` is fixed: `structured_clears_preserve_neighbor_words_in_the_shared_buffer` passes. The new byte-read cases in `table_bound_structured_buffer_reads_by_element_and_dimensions` and `gpu_writes_visible_through_overlapping_views` also pass. Unit tests only, no game data. AI-assisted (Claude)
neonbyte1 commented 2026-11-28 05:25:17 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by neonbyte1 on 2026-11-28T05:25:17Z.


In-game confirmation on Linux to go with @DieQuelle's Windows result above: RTX 5090 (driver 620.73.04), GE-Proton11-14 Wine with its vkd3d-proton, merged onto our integration tree (main plus ~320 open PRs). vkd3d-proton doesn't misread the structured-view divisors, so there's nothing to speed up here; the point was cost and correctness: one clean A/B pair, 420 s, yard: 188.8 vs 195.9 ms/frame (no cost), pictures equal (0.4-0.5 % of pixels differ by more than 32/255).

One thing for the PR itself: this PR's own device test structured_clear fails on its head 76a13e1 under vkd3d-proton: with bias=0 float=true the clear leaves the buffer untouched. ClearUnorderedAccessViewFloat of a raw R32_TYPELESS UAV is a no-op there. On our tree a clear's private view is typed instead (R32_FLOAT for a float clear, R32_UINT otherwise, no bias; views in slots stay raw), and the test passes: 515f232. It doesn't cherry-pick onto your head as is (our base moved buffer_uav), but it's ~30 lines in descriptor/host.rs; happy to rebase it onto your branch if you want it.

AI-assisted (Claude); measured on my machine, no game data shared.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7234658521 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2885#issuecomment-7234658521). Originally posted by [neonbyte1](https://github.com/neonbyte1) on 2026-11-28T05:25:17Z. --- In-game confirmation on Linux to go with @DieQuelle's Windows result above: RTX 5090 (driver 620.73.04), GE-Proton11-14 Wine with its vkd3d-proton, merged onto our integration tree (`main` plus ~320 open PRs). vkd3d-proton doesn't misread the structured-view divisors, so there's nothing to speed up here; the point was cost and correctness: one clean A/B pair, 420 s, yard: 188.8 vs 195.9 ms/frame (no cost), pictures equal (0.4-0.5 % of pixels differ by more than 32/255). One thing for the PR itself: this PR's own device test `structured_clear` fails on its head `76a13e1` under vkd3d-proton: with `bias=0 float=true` the clear leaves the buffer untouched. `ClearUnorderedAccessViewFloat` of a raw `R32_TYPELESS` UAV is a no-op there. On our tree a clear's private view is typed instead (`R32_FLOAT` for a float clear, `R32_UINT` otherwise, no bias; views in slots stay raw), and the test passes: [`515f232`](https://github.com/neonbyte1/VIctory/commit/515f2328f). It doesn't cherry-pick onto your head as is (our base moved `buffer_uav`), but it's ~30 lines in `descriptor/host.rs`; happy to rebase it onto your branch if you want it. _AI-assisted (Claude); measured on my machine, no game data shared._
artor410 commented 2026-11-28 08:19:14 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by artor410 on 2026-11-28T08:19:14Z.


NVIDIA Ampere check of 76a13e1, merged cleanly onto main 63bcca4 (tree 03528ae). RTX 3070 Ti 8 GB (Ampere, 32-lane waves, heap capped at 1,000,000), driver 610.88, Windows 11, rustc 1.98.1, hardware adapter. Synthetic tests only.

test main this PR
stride_tests + gathers_at_a_level 3 fail 11 pass / 1 fail: a_heap_buffer_read_where_no_buffer_view_is_reads_zeros (it fails on main and on #2178 and #2464 too)
overlap_test::gpu_writes_visible_through_overlapping_views 2375 / 2400 mismatches (test copied onto main) pass, 0 mismatches
victory-gpu lib 229 / 2 fail 232 / same 2 (the heap-cap pair, #3178)

I ran the same overlap test on #2178 (544 mismatches) and #2464 (1425 mismatches). This is the only one of the three that passes it. Side by side in #1744.

(Claude Code, Claude Opus 5.5.)

<!-- greyfinch-sync:Marvisak/VIctory:comment:7236506124 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2885#issuecomment-7236506124). Originally posted by [artor410](https://github.com/artor410) on 2026-11-28T08:19:14Z. --- NVIDIA Ampere check of `76a13e1`, merged cleanly onto `main` `63bcca4` (tree `03528ae`). RTX 3070 Ti 8 GB (Ampere, 32-lane waves, heap capped at 1,000,000), driver 610.88, Windows 11, rustc 1.98.1, hardware adapter. Synthetic tests only. | test | main | this PR | |---|---|---| | `stride_tests` + `gathers_at_a_level` | 3 fail | 11 pass / 1 fail: `a_heap_buffer_read_where_no_buffer_view_is_reads_zeros` (it fails on main and on #2178 and #2464 too) | | `overlap_test::gpu_writes_visible_through_overlapping_views` | 2375 / 2400 mismatches (test copied onto main) | **pass, 0 mismatches** | | victory-gpu lib | 229 / 2 fail | 232 / same 2 (the heap-cap pair, #3178) | I ran the same overlap test on #2178 (544 mismatches) and #2464 (1425 mismatches). This is the only one of the three that passes it. Side by side in #1744. (Claude Code, Claude Opus 5.5.)
hxpeerr commented 2026-11-28 21:01:41 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by hxpeerr on 2026-11-28T21:01:41Z.


In-game head-to-head with #2464 on a Blackwell card (RTX 5060 Ti, driver 621.40), each alone on main: https://github.com/Marvisak/VIctory/pull/2464#issuecomment-7245718270

<!-- greyfinch-sync:Marvisak/VIctory:comment:7245718446 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2885#issuecomment-7245718446). Originally posted by [hxpeerr](https://github.com/hxpeerr) on 2026-11-28T21:01:41Z. --- In-game head-to-head with #2464 on a Blackwell card (RTX 5060 Ti, driver 621.40), each alone on `main`: https://github.com/Marvisak/VIctory/pull/2464#issuecomment-7245718270
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/2885:upstream-pr/2885'
git switch 'upstream-pr/2885'

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