GPU: structured buffer views are raw views of the same bytes on the host (NVIDIA reads 0 through raw loads of structured views) #1762
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!1762
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1762/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@claude-GTA6 on GitHub · 2026-11-24 22:09 UTC · original
claude-GTA6:pr-raw-views→main· +1101 −65 · 9 files · 8 commits · closed without mergingFrom a tester working with Claude (AI-assisted); measured on my own machine.
This is the fix from @fxceless's fork fxceless/victory-gta6 (GPL-3.0, commit
578d459c,raw_windowincrates/victory-gpu/src/descriptor/host.rs), ported onto currentmain's view code. The diagnosis is theirs as well. Their fork renders the world lit on an RTX 4070.Why
Translated shaders read untyped buffers as raw bytes: scalar loads at a byte address, and raw loads at
element * stride + offset. When the title's view is structured (formatUNKNOWN, a stride), the host view is structured too. On NVIDIA, raw reads through it return zeros. On an RTX 5090, byte 20 of a 16-byte-stride view read 0 instead of 86. GTA VI hits this twice:t103, 16-byte structured, byte 4) reads 0, so the lit colour is multiplied by 0 and HDR is exactly 0.t13, 128-byte structured, byte 16) read 0, so every prepass pixel is discarded.The result is a black world.
What
buffer_srv/buffer_uavindescriptor/host.rs: a structured view becomes a raw view of the same bytes of its host copy (DXGI_FORMAT_R32_TYPELESS+D3D12_BUFFER_SRV_FLAG_RAW/D3D12_BUFFER_UAV_FLAG_RAW, first element and count in dwords). This only happens when those bytes start on 16 bytes (the raw view alignment), are whole dwords, and are at most 2^27 dwords. Otherwise the view stays structured.main's own steps: the copy fromshadow::for_view(including a view's own copy), the first element counted from that copy, and thein_bufferrefusal of empty and overlong views. The refusal and null behaviour don't change.element * strideare unchanged.v2 (head
4eb5d1ed, onmain940d32f6)v1 is commit
550cac2babove. v2 adds:c43e934c(descriptor/host.rs): a structured view whose bytes do not start on 16 bytes is made raw over a host copy that does (raw_window,copy_align,view_align); views still left structured are logged.57aa0549(emit/lower.rs,emit/host.rs): the translator reads heap and table structured buffers through raw handles atindex * stride + offset(structured_raw), and a structured buffer's record count is its raw size over the stride (descriptor_datainbindless.rs).f6999942: the record count is in records however the code addresses it; the test host makes raw views for translated programs, so the native reference reads structured views the same way (emit/stride_tests.rs, new). This test-host part overlaps #1887.4eb5d1ed: merge ofmain940d32f6, no conflicts.The DXIL of about 22,000 programs changes with v2. Measured only on NVIDIA (RTX 5090; RTX 4070 SUPER and RTX 3080 by other testers, below) and WARP: AMD and Intel at this head are still untested.
Tested (RTX 5090, Windows 11)
bindless::tests::raw_reads_of_structured_views_are_right. It makes title descriptors for a structured shader resource view and a structured unordered access view (16 elements of 16 bytes), then runs a compute shader that does raw loads and stores through them (ByteAddressBuffer/RWByteAddressBuffer). The test passes. With the shader resource view conversion turned off, it fails: raw loads through the structured view read 0 from dword 16 on.cargo test --release -p victory-gpu, with and without--features diagnostics: everything passes exceptdescriptor::host::tests::dynamic_slots_are_held_until_releasedandmemory::tests::lists_share_a_table_and_copies_keep_their_views. Both fail the same way on plainmainon this machine (the heap size check, and "past the dynamic slots").cargo clippy --release --workspace --all-targets --locked -- -D warningsandcargo xtask policypass.Not covered
mainplus only this commit. I haven't checked that auto-exposure settles after the change; the overexposure may be a separate issue.No game data attached.
🤖 Generated with Claude Code
940d32f6) into pr-raw-views 4eb5d1ed32@DesertGamer on GitHub · 2026-11-24 22:14 UTC · original
VIctory V2: community PRs, merged and tested
Open PRs sitting in the queue? V2 pulls them into one build, screens each one (binaries, build scripts, hooks, new deps) and runs tests after every batch.
Where it stands today: launches, runs the menu at 30 fps, plays the intro video, reaches the start screen and loads the world (~50 s). Entering the world is the current blocker: rendering fails with a GPU "device removed" error (tracked in issue #1).
⚠️ Entering the world on a real GPU can hang it and make Windows reset the driver. Try it at your own risk.
Not playable yet, but every batch of merged fixes moves it closer. If you have a PR that's stuck, or a GPU to test on, I'd love your help:
https://DesertGamer/VIctory-V2
Unofficial community fork of Marvisak/VIctory, GPL-3.0.
@giacbiologicbomb on GitHub · 2026-11-24 22:39 UTC · original
Windows 11 / RTX 5070 / 15 GB RAM report: on a local stack based on fxceless/victory-gta6 commit
578d459, with additional shader/wave and DXC-fallback changes, I have seen sky and previously characters in the world. This is a combined build, not an isolated A/B test of this PR, so I cannot attribute the image to this change alone.Performance remains very limited: in a recent world-stage sample 0.3-0.9 FPS, roughly 826 pipelines still being made, and hundreds to thousands of draws reported without a host pipeline. Available physical memory was often below 1 GB; the process had over 20 GB of private committed memory and the pagefile was in use. These figures are individual samples, not a benchmark or proof of a specific bottleneck.
Given the reported NVIDIA structured-buffer issue and the fxceless-based result, this raw-view change looks worth prioritizing for review and possible merge after targeted correctness tests and a reproducible NVIDIA comparison. Further work on shader/pipeline readiness, texture streaming and memory pressure looks important; please do not treat this report as an isolated validation of the PR.
@Vedoxdev123 on GitHub · 2026-11-24 22:46 UTC · original
Tested on Windows with AMD Ryzen 5 5600X + NVIDIA GeForce RTX 4060:
cargo test -p victory-gpu --lib-> 77 passed; 2 failed; 1 ignored (up from 76 passed onmain; new testbindless::tests::raw_reads_of_structured_views_are_rightpasses; the 2 failures are the known 1,000,000 view heap cap tests from #1744)cargo test -p victory-shader-> 206 passed; 3 failed; 2 ignored (same 3 failures asmain)@marquezinii on GitHub · 2026-11-24 22:53 UTC · original
Ran this on an RTX 5070 (driver 621.40, Windows 11, Rust 1.98.1 MSVC, its own target directory), head
550cac2. Two gaps, both NVIDIA:1.
victory-shader's own test host still makes structured views. Soemit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stridefrom #1744 still fails here with this PR, at the same[101, 104, 107, …, 131, 0, …].victory-gpugives 77 passed with the same two heap-cap failures asmain. The pattern is lanelreading byte36l + 12, that is(12l + 4) / 4 * 12: NVIDIA divides the raw byte offset by 4 and multiplies it by the view's stride. I also tried a structured read at that call site (rawBufferLoad(h, l, 4)with annotated stride 4). Lanelthen read byte12(l + 1), so the annotated stride is what is compiled in, and only the view's own stride matches. That agrees with @kappalegoat's measurement above, and it means only raw views read right from a shader that learns the stride at run time.2. Views not on 16 bytes of their copy stay structured.
raw_windowfalls back to the structured view, and those are the views NVIDIA reads wrong. Common cases: element 1, 2 or 3 of a 12-byte-stride buffer, or element 1 of the 456-byte culling constants (start + 456instructured_views_off_their_buffers_elements_get_their_own_copy).A version that closes both is on
marquezinii:gpu/structured-views-raw-aligned, one commit on70564ae. Take whatever helps:raw_srv/raw_uavconvert beforeshadow::for_viewis asked for the copy, and ask it to start on 16 bytes (D3D12_RAW_UAV_SRV_BYTE_ALIGNMENT) instead of on an element. A structured view not on 16 bytes then gets a copy of its own bytes, as views off their elements already do, and is made raw too.view_copyuses the same rule (view_align), so draws find and refresh the copy the slot shows.Stride::Structuredinemit/host.rsmakes a raw view, as the runtime does.structured_views_off_their_buffers_elements_get_their_own_copygains thestart + 456case (own copy) next tostart + 4 * 456(the buffer's copy).On the RTX 5070 that branch gives:
victory-gpu: 77 passed, with only the two heap-cap failures.victory-shader: 208 passed, with onlya_heap_buffer_read_where_no_buffer_view_is_reads_zerosfailing, which is the heap cap again.a_heap_buffer_read_by_element_takes_the_views_stridepasses, and so do the table-structured tests with strides 4 and 16, now through raw views.diagnostics) andxtask policyare clean.Not tested: the title.
@AlanQiang0418 on GitHub · 2026-11-24 23:00 UTC · original
RTX 5080 comparison. The change restores raw loads through a structured SRV on this card. It also changes the element count returned to shaders that query a structured view. Could you preserve the title’s element count when converting the host view?
I tested the descriptor implementation from
70564aeand550cac2against the same synthetic buffers (16 elements × 16 bytes). I confirmed the D3D12 adapter through its LUID: GeForce RTX 5080, driver 621.14. The results below agreed with both the PR’s FXCcs_5_1path and DXCcs_6_6.StructuredBuffer<uint4>.GetDimensions(count, stride)RWStructuredBuffer<uint4>.GetDimensions(count, stride)This matters to VIctory’s translator:
descriptor_datarequests structured dimensions for a known stride and uses the first field as the title buffer’s record count. A shader using that count to choose its last element can therefore select a different index. I used synthetic descriptors and did not run the game. Descriptor reconstruction on main · Record-count fieldI put a minimal failing test on top of this PR. Run
cargo test --locked -p victory-gpu --lib bindless::tests::structured_views_report_their_element_count -- --exact. It returns[64,16,256,16]here and passes with the descriptor implementation from main. The original raw-load test shows the opposite result. Reproduction commit@rminzao on GitHub · 2026-11-24 23:09 UTC · original
Possible mismatch: structured reads through the new raw views
The translator still declares some heap buffers as
StructuredBuffer:emit/mod.rs:58-62says indexed accesses are "structured with the used-resource entry's stride", andemit/lower.rsemits(12 | u, stride)handles for indexed loads (~4011, ~4030) and indexed atomics (~8477, 8593, 8692).With this PR,
buffer_srv/buffer_uavhand those handles a rawR32_TYPELESSview. A structured handle reading a raw view is the same kind of view/declaration mismatch this PR fixes in the other direction, and D3D12 leaves it undefined. It may happen to work on NVIDIA, but AMD, Intel and vkd3d-proton aren't covered, and GPU-based validation would likely flag it.The new test
raw_reads_of_structured_views_are_rightonly does raw loads and stores, so the kind-12 path (indexed load / atomic through a converted view) isn't exercised. Would it be safer to convert only views that no structured handle reads, or to add a test for that path?Minor: when
raw_windowrejects a view (base not 16-byte aligned) it silently stays structured, so raw reads of it still return 0 on NVIDIA with nothing in the log.Static review (AI-assisted), read against
mainat70564ae; nothing was run on a GPU.@welisonzika14-jpg on GitHub · 2026-11-24 23:17 UTC · original
RTX 5070 (driver 621.24, Windows 11, Rust 1.98.1 MSVC), on
70564ae. I ran #1751 and #1762 alone and together.victory-gpuvictory-shaderThey merge cleanly. #1762 does not change the 3
victory-shaderfailures, because the test host there still makes structured views (same as @marquezinii said above).I wrote a small test-only patch on top of both. With it,
victory-shaderis 209 passed, 0 failed, andclippy -D warningsis clean:emit/host.rs,Stride::Structured(_)creates a raw view of the same bytes (R32_TYPELESS,D3D12_BUFFER_SRV_FLAG_RAW, stride 0), like this PR does in the runtime. This fixesa_heap_buffer_read_by_element_takes_the_views_strideandgathers_at_a_level_match_the_hardware.Host::takes_view_heap(n)tries to create a view heap ofnslots.a_heap_buffer_read_where_no_buffer_view_is_reads_zerosskips with a message when the device refusesHEAP_VIEWSslots. This skips the test on NVIDIA, it does not fix it. The real fix for that one is the heap clamp work (#1777).About 31 lines added, 5 removed. It only makes sense after #1762, so it would be stacked on it.
Limits: these are unit tests only, no game files. The stride test only uses raw loads, so it does not cover the structured-handle path @rminzao mentioned.
Happy to open it as a PR on top of #1762 if you want it. If @marquezinii's branch already has the test host change, I will not duplicate it.
Written with AI help (Claude/Kiro). The numbers are from runs on my machine.
@claude-GTA6 on GitHub · 2026-11-24 23:20 UTC · original
From a tester working with Claude (AI-assisted); measured on my own machine.
Thanks, all four of these are real, and they fit together:
GetDimensionsreturns the dword count, whiledescriptor_datatakes the first field as the record count. The title's element count has to be preserved.I'm reworking this into one consistent version: structured title views become raw views of 16-byte-aligned copies, the translator reads them through raw handles (indexed and atomic paths included) and derives the element count from bytes / stride, and the test host matches the runtime. I'll add your failing cases as tests, including the element-count test and the indexed/atomic path. I'll write it here rather than merge your branches, so it stays one reviewable change, and I'll credit each of you in the commits. I'll post here when it's up.
@marquezinii on GitHub · 2026-11-24 23:22 UTC · original
On the two points above, from the RTX 5070 (driver 621.40). Both apply to my branch as well.
@rminzao: structured reads through raw views. They read right on NVIDIA. With the test host's structured views made raw, the
victory-shadertests that read table views with structured handles ((12 | u, stride), strides 4 and 16 insynthetic_tests,waterfall_testsanddiff_tests) all pass on the hardware device. The rule I measured: NVIDIA takes the shader's byte address (element times the stride compiled into the handle, plus the offset), divides it by 4 and multiplies by the view's stride. A raw view has stride 4, so structured and raw handles both land on the right byte. Only a structured view breaks it, unless its stride happens to equal the compiled one.@AlanQiang0418: the record count. Right, and a raw view can't keep the title's element count, since its elements are dwords. The fix has to be in the translator:
descriptor_dataasks for the size through a structured handle and takes field 0 as the record count. I pushedf6bb5d5onmarquezinii:gpu/structured-views-raw-aligned. For a structured buffer, it asks through a raw handle, which returns bytes on a raw view for both shader and unordered views, and divides by the stride the used-resource entry already gives. Raw and typed buffers are unchanged.How far that is checked: it compiles, clippy is clean, and
victory-shadergives 208 passed with only the heap-cap failure. But the path is exercised only bydiff_tests("sizes from descriptors", "sizes for scalar loads"), and those skip here without the console compiler. If someone has it, those two cases would settle it.@AlanQiang0418 on GitHub · 2026-11-24 23:37 UTC · original
I tested the element-count candidate
f6bb5d5with hand-assembled GFX10 compute programs on an RTX 5080 (621.14) and Microsoft WARP. Each shader reads descriptor dword 2 and uses that same descriptor to load or store a known value. This also exposed a problem with the native PC reference used by the two differential cases.Record counts. For 192 bytes holding sixteen 12-byte records, the candidate returned 16 with a scalar SRV load and an indexed UAV store. A byte-offset (
offen) SRV load or UAV store returned 192 on both adapters. The data at byte 12 was correct. Classifying the count by the known structure stride even whenidxenis clear returned 16 on both. The raw control still reported 192 bytes and the typed control 12 RGBA32F texels. All seven cases passed on each adapter with the count change. Count fix and runnable regressionIndexed SRV data. With buffer dwords holding 100.0, 101.0, 102.0, …, a translated
buffer_load_dword idxenat element 1 gave the following results. The element counts themselves were correct in every row.An isolated experiment issuing the load through a raw handle at
index * stride + offsetpassed every row on both adapters for these in-bounds reads. The linked commit adds the four regression cases that fail on the RTX. Runcargo test -p victory-shader table_buffer_descriptor_word_two_counts_records -- --nocapture. Indexed-read reproducerPC reference. I ran the exact PC HLSL and bindings for “sizes from descriptors” and “sizes for scalar loads” against independent expected output. With a raw descriptor bound to native HLSL's structured SRV, the RTX got 256/256 lanes wrong in each case. Binding a real structured SRV for the native PC dispatch fixed every output word on both adapters. WARP also passed with the original binding. This test-host change retains raw views for translated dispatches. PC reference fix
Synthetic inputs only, DXIL validation for the translated fixtures, PC DXC 1.9.2609.5. The console SDK compiler was unavailable, so the full two-compiler comparison is still open. AI-assisted.
@claude-GTA6 on GitHub · 2026-11-25 00:00 UTC · original
From a tester working with Claude (AI-assisted); measured on my own machine.
@marquezinii @AlanQiang0418 thanks, that settles the translator half by measurement. The rework will follow it: indexed loads and atomics go through raw handles at
index * stride + offset(the stride-8/12/16/24 table shows the structured handle is wrong on the RTX even when the count is right), and the record count is bytes / stride, classified by the structure stride even whenidxenis clear. I'll take your failing cases as regression tests, including theoffencount cases and the indexed-read rows, and bind a real structured SRV for the native-PC reference in the two differential tests. Both of you will be credited in the commits.@Mericas77 on GitHub · 2026-11-25 00:22 UTC · original
Tested
550cac2on an NVIDIA host: RTX 4070 12 GB, driver 621.01, Windows 11 (build 26300), debug build, base70564ae.The bug reproduces on this card. This PR's new test, run against
main's runtime (70564aewith only this PR'sbindless.rstest added), fails:With this PR,
bindless::tests::raw_reads_of_structured_views_are_rightpasses.--test-threads=170564ae-p victory-gpu-p victory-shaderThe remaining failures all come from the 1,000,000 view heap cap that #1779 fixes:
dynamic_slots_are_held_until_released,lists_share_a_table_and_copies_keep_their_viewsanda_heap_buffer_read_where_no_buffer_view_is_reads_zeros.On its own, this PR doesn't change the victory-shader numbers, because the shader test host still makes structured views. #1887 is the test-side half: with both,
a_heap_buffer_read_by_element_takes_the_views_strideandgathers_at_a_level_match_the_hardwarepass on this card. The two merge cleanly. Together with #1779, all five NVIDIA failures from #1744/#1835 pass. No hangs, device removals or driver resets.@kappalegoat on GitHub · 2026-11-25 01:57 UTC · original
RTX 5070 (Blackwell, driver 621.24), the two raw-view versions against @AlanQiang0418's record-count test. Both trade one NVIDIA bug for the other:
raw_reads_of_structured_views_are_rightstructured_views_report_their_element_countmain70564ae550cac2(per @AlanQiang0418, RTX 5080)[64, 16, 256, 16]6f1f09b(Alan'sbindless.rstests copied onto it)[64, 16, 256, 16]The rest of this PR's suite on the 5070: 472 passed, 5 failed, the same five as
main(#1744). @marquezinii's branch fixes the element-stride test; this PR alone does not, becausevictory-shader's test host still makes structured views.The record count can be fixed on the translator side, and only there. A raw host view no longer knows the title's stride, so no host view can make HLSL's
StructuredBuffer.GetDimensionsgive 16 again. But the translator never needs HLSL's answer:descriptor_data(lower.rs, theFields::BufferandFields::Smemarms) asksgetDimensionsthrough a structured handle(12 | u, stride)and stores field 0 as the record count, and in both arms the stride is a compile-time constant. If every structured title view is raw on the host, the same query through a raw handle(11 | u, 0)returns the view's size in bytes on every vendor, andbytes / strideis the title's record count. That needs the conversion to be total: with this PR's fallback (a view not on 16 bytes stays structured) a raw query of the leftover structured views would be the mismatch again, so it fits @marquezinii's version (own copy for views not on 16 bytes), not this one as it stands.I have not written that change: whoever carries the raw-view conversion is better placed to include it. The test for it would be a translated program reading dword 2 of a structured buffer's descriptor, rather than
bindless.rs's HLSL test, which checks HLSL's behaviour and will keep failing with any raw host view. I did not run the title.AI-assisted (Claude Code).
@kappalegoat on GitHub · 2026-11-25 01:59 UTC · original
RTX 5070 (Blackwell, driver 621.24), the two raw-view versions against @AlanQiang0418's record-count test. Both trade one NVIDIA bug for the other:
raw_reads_of_structured_views_are_rightstructured_views_report_their_element_countmain70564ae550cac2(per @AlanQiang0418, RTX 5080)[64, 16, 256, 16]6f1f09b(Alan'sbindless.rstests copied onto it)[64, 16, 256, 16]The rest of this PR's suite on the 5070: 472 passed, 5 failed, the same five as
main(#1744). @marquezinii's branch fixes the element-stride test; this PR alone does not, becausevictory-shader's test host still makes structured views.The record count can be fixed on the translator side, and only there. A raw host view no longer knows the title's stride, so no host view can make HLSL's
StructuredBuffer.GetDimensionsgive 16 again. But the translator never needs HLSL's answer:descriptor_data(lower.rs, theFields::BufferandFields::Smemarms) asksgetDimensionsthrough a structured handle(12 | u, stride)and stores field 0 as the record count, and in both arms the stride is a compile-time constant. If every structured title view is raw on the host, the same query through a raw handle(11 | u, 0)returns the view's size in bytes on every vendor, andbytes / strideis the title's record count. That needs the conversion to be total: with this PR's fallback (a view not on 16 bytes stays structured) a raw query of the leftover structured views would be the mismatch again, so it fits @marquezinii's version (own copy for views not on 16 bytes), not this one as it stands.I have not written that change: whoever carries the raw-view conversion is better placed to include it. The test for it would be a translated program reading dword 2 of a structured buffer's descriptor, rather than
bindless.rs's HLSL test, which checks HLSL's behaviour and will keep failing with any raw host view. I did not run the title.AI-assisted (Claude Code).
@claude-GTA6 on GitHub · 2026-11-25 02:25 UTC · original
From a tester working with Claude (AI-assisted); measured on my own machine (RTX 5090, Windows 11, Rust 1.98.1 MSVC) and WARP.
v2 is up: three commits on top of the first one. It is our own code, built from your reports and reproducers. Thank you @marquezinii, @AlanQiang0418, @rminzao, @welisonzika14-jpg and @kappalegoat; each commit message names what came from whom.
Where the design comes from. Raw views of structured buffers, read as bytes at
index * stride + offset, with the record count taken as the raw size over the stride, is how fxceless/victory-fork (GPL-3.0) does it; that fork renders the title's opening lit on NVIDIA. v1 ported itsraw_window. v2 follows the same design in the translator and adds what it lacks: copies that start on 16 bytes for views that do not, the record count for buffers read by index, and tests.What changed
shadow::for_viewfor a copy that starts on 16 bytes (D3D12_RAW_UAV_SRV_BYTE_ALIGNMENT) instead of on an element. A view not on 16 bytes of its buffer's copy gets a copy of its own bytes, as views off their elements already do, and is made raw as well.view_copyuses the same rule (view_align), so draws find and refresh the copy the slot shows.structured_views_off_their_buffers_elements_get_their_own_copygains thestart + 456case.index * stride + offset. Root views keep their old path. On the RTX 5090 the new testindexed_loads_and_atomics_of_structured_buffers_read_raw_views(an indexed load from a 12-byte-stride view, an indexed atomic add into an 8-byte-stride unordered view) reads all zeros with v1's structured handles and is right with raw ones. That matches @AlanQiang0418's table (element 1 read as 101/102 for strides 8 to 24) more than "structured handles land right": on this card they do not.offen) or by scalar loads.a_buffer_descriptors_record_count_reads_as_its_views_kindruns your eleven cases (strides 4, 8, 12, 16 and 24 by index; 12-byte records at a byte offset and by a scalar load; raw; typed; unordered by index and at a byte offset) on the hardware device and WARP: all pass.structured_views_made_raw_keep_the_titles_byteschecks the host side (256 bytes for 16 records of 16).Stride::Structuredmakes a raw view for translated programs, as the runtime does, and a real structured view for the native PC reference (Host::dispatch_native), since native HLSL declares a structured buffer.a_heap_buffer_read_by_element_takes_the_views_stridenow passes here.@kappalegoat's three points
descriptor_data(item 3).a_buffer_descriptors_record_count_reads_as_its_views_kind. I left the HLSLstructured_views_report_their_element_countout for the reason you give: it checks HLSL'sGetDimensionson a structured declaration, which cannot hold through any raw view.Measured
cargo test -p victory-gpu --lib: 79 passed, 2 failed, both the known view-heap cap failures (dynamic_slots_are_held_until_released,lists_share_a_table_and_copies_keep_their_views).cargo test -p victory-shader: 209 passed, 1 failed (a_heap_buffer_read_where_no_buffer_view_is_reads_zeros, the heap cap again) at the second commit. At the head I re-ran thestride_testsmodule on the hardware device: 7 passed, the same heap-cap failure. The full suite at the head is queued behind other GPU work here; I will post it.cargo clippy --workspace --all-targets -- -D warnings, with and withoutdiagnostics: clean.xtask policy: clean.translate --validate --list, v1 against v2: the same programs emit and validate (vertex and pixel 14,217 of 14,259 emitted, all validated; compute 2,687 emitted, 1,952 validated; mesh 8,765 emitted, 8,694 validated). The DXIL of 22,116 programs changes and 3,535 are byte-identical. A build with a marker on the new path shows those 22,116 are exactly the programs that read a structured buffer through it: none changed without taking it, none took it without changing. Most programs read a structured buffer by index, so this is a wide change by nature.Not done / not tested
mainincrates/victory-shader/src/emit/lower.rs; the merge ofmainfollows as its own commit.@claude-GTA6 on GitHub · 2026-11-25 02:30 UTC · original
From a tester working with Claude (AI-assisted); measured on my own machine.
Merged current
main(940d32f6) as4eb5d1ed; it conflicted incrates/victory-shader/src/emit/lower.rsonly, in two hunks (the indexed buffer atomic and the indexed buffer store).mainaddedmark_view_writethere atindex * stride + offsetwhile still taking a structured handle; v2 takes a raw handle at that byte. Both are kept:structured_rawnow also returns the byte, and the atomic and the store pass it tomark_view_write. For heap and table views that is the raw handle's own coordinate, so the mark and the write name the same bytes; root views keep the structured handle withmain's byte.Checked at
4eb5d1ed, all without the hardware device (the card is busy):cargo test --release --workspace --no-run);cargo clippy --workspace --all-targets -- -D warnings, with and withoutdiagnostics: clean;cargo xtask policy: ok;victory-shaderstride_tests8 passed, 0 failed (both new tests included);victory-gpubindless and structured-view tests 7 passed, 0 failed (raw_reads_of_structured_views_are_right,structured_views_made_raw_keep_the_titles_bytes,structured_views_become_raw_views_of_the_same_bytes,structured_views_off_their_buffers_elements_get_their_own_copyand three older bindless tests).Not run at this head yet: the full suites on the hardware device (queued here; I will post the counts) and the whole-set translation comparison (the one in the comment above is v1 against v2 before the merge).
@welisonzika14-jpg on GitHub · 2026-11-25 02:46 UTC · original
RTX 5070 (Blackwell, driver 621.24), Ryzen 7 5700X, Windows 11, Rust 1.98.1 MSVC.
cargo test -p victory-gpu -p victory-shader --lib --no-fail-fast, no game files. I tested v2 and then the new head after the merge ofmain.victory-gpuvictory-shadermain70564ae550cac2f699994(base70564ae)4eb5d1e(v2 +main940d32f)mainmerge)4eb5d1e,a_heap_buffer_read_by_element_takes_the_views_strideandgathers_at_a_level_match_the_hardwarepass on this card. Both failed with v1.victory-gputests anda_heap_buffer_read_where_no_buffer_view_is_reads_zeros.4eb5d1eany more, so I could not repeat that on the new head.Limits: unit tests only, one run each. I did not read the new code and I did not run the title.
Thanks for taking the test-host change in. Written with AI help (Claude/Kiro); the numbers are from runs on my machine.
@claude-GTA6 on GitHub · 2026-11-25 03:40 UTC · original
From a tester working with Claude (AI-assisted); measured on my own machine.
The full suites at
4eb5d1edon the hardware device (RTX 5090), as promised:victory-shader: 248 passed, 1 failed:a_heap_buffer_read_where_no_buffer_view_is_reads_zeros, the view-heap cap.victory-gpu: 142 passed, 4 failed: the two view-heap cap tests, pluswatch::tests::writes_through_another_mapping_mark_the_trackerandshadow::tests::marked_pages_go_back_by_the_bytes_the_gpu_changed.Those last two are in
watch.rsandshadow.rs, files this PR does not touch, and neither makes a view. Both pass when run alone on the software adapter at this head. I have not run plainmainthrough the full parallel suite on this card, so I can't say they fail there too: only that they are outside this PR's files and pass alone. That matches @welisonzika14-jpg's run on a 5070 above (144 / 2 and 248 / 1), where the heap-cap tests were the only failures.@Marvisak on GitHub · 2026-11-25 03:41 UTC · original · edited 2026-11-25 09:18 UTC
Automated triage for the maintainers.
Needs work (close). v3 (
9f1da58f) starts a raw view on the 16 bytes at or below the title's first byte (raw_windowincrates/victory-gpu/src/descriptor/host.rs). It records the skipped bytes in the top bits of the view-stride entry (VIEW_SKIP_SHIFT), andemit/lower.rsadds them to byte addresses through raw heap views that may be structured. Head19c8013only adds#[cfg(test)]tostride_tableinemit/host.rs.Update since the last review. @wbkepler ran this head in the title on an RTX 5090, merged with a few other open NVIDIA fixes (#1775, #1778, #1779, #1769, #2175): the world goes from flat grey to the intro scene, with no device removal. @Mericas77's RTX 4070 run of the suites at
19c8013also fixes two failures thatmainhas. Together with @nathanbzrr's RX 7600 run, that covers most of the open testing. Still open:eeabda1keeps the signatures alive). Worth taking in or answering here;On your reply: keeping this head fixed while #1779 rebases is fine. A short v3 section in the description would make this ready for a maintainer's look.
CI: no check runs on the head commit.
Generated by Claude Code
@moe-miau on GitHub · 2026-11-25 03:49 UTC · original
In-game on
mainplus this PR only (the "Not covered" point above), RTX 4070 SUPER: the black world goes, and frames are about 8 times fasterSetup: RTX 4070 SUPER 12 GB, driver 32.0.16.1742, Windows 11 26300. Title 1.0.2.1, Series X profile, diag build, a fresh shader cache per run. A save past first-boot setup, then
VICTORY_KEYSpressing Enter every 6 s from 25 s to 150 s, which reaches the intro cutscene at about 90 s. Each run is 6 minutes.main940d32falone removes the device at 27 s on NVIDIA (#1753), so both runs include #1775 to get past that. Both merge cleanly with this PR (head4eb5d1e).940d32f+ #1775940d32f+ #1775 + #17620x887A0006at 210 sOther counts for the #1762 run: 136 pipelines refused (the wave64 compute programs NVIDIA cannot run, as before), 11 shaders not translated, 1
no host texture(the 2560x1440 format-115 target, #797).What this shows on
mainitself:42683eebec081520and8bbcbda6008eaa37read their divisors through structured views. On this card those reads return 0 without the conversion, and the loops run about 4 billion times.Still there:
fxceless/victory-forkon the same machine and route, which also draws characters and street lights at this point.0x887A0006), not an invalid call. With frames now about 8 times faster, more of the world's work runs per second. The baseline run only survived longer because it rendered so few frames. I haven't isolated the stopping dispatch on this tree yet.One run each, no debug layer. Counts and times only, no captures attached.
AI-assisted (Claude Code); runs done on my machine.
@BaggyALPHA on GitHub · 2026-11-25 04:01 UTC · original
Independent Windows check on RTX 3080 (driver 621.24), with v2
4eb5d1edapplied to upstream940d32f.a_heap_buffer_read_by_element_takes_the_views_stridefailed on upstream hardware and passed with the PR. The PR'sraw_reads_of_structured_views_are_rightend-to-end descriptor test also passed.victory-gpulibrary suite 9 times on each tree (one serial, eight with default threading). Upstream consistently had 141 passed, 2 failed, 2 ignored. The PR consistently had 144 passed, 2 failed, 2 ignored. Both failures in every run were the known NVIDIA descriptor-heap-cap tests.writes_through_another_mapping_mark_the_trackerormarked_pages_go_back_by_the_bytes_the_gpu_changedin this matrix. That limits the observed failures to the other setup or a condition this run did not exercise.These are synthetic tests on Ampere. AMD/Intel and title rendering remain outside this check. No game files were used. AI-assisted (OpenAI Codex).
@claude-GTA6 on GitHub · 2026-11-25 04:18 UTC · original
From a tester working with Claude (AI-assisted); measured on my own machine.
Thank you both, these are the independent numbers this PR was missing.
mainplus only this PR drawing the cutscene, at about 1 s per frame instead of about 8 s, on an RTX 4070 SUPER, separates this change from the rest of our branch. That is the result we could not give. We have not seen the0x887A0006at 210 s on our side. Our runs are 420 s from a later save on an RTX 5090 with the rest of our branch, so they are not a comparison. If you isolate the dispatch, I'll look at it here.I have updated the description to cover v2 (what each commit adds, and the overlap with #1887), as the triage note asked. AMD and Intel at this head are still untested by us. A run on either would be welcome.
@r4tedx on GitHub · 2026-11-25 04:21 UTC · original
@claude-GTA6, this is the fix I was about to redo on
mainafter #704 was closed, so I'll put my evidence here instead of opening a second PR. On an RTX 5070 (Windows 11, native D3D12),main'sa_heap_buffer_read_by_element_takes_the_views_stridefails at940d32fwith[101, 104, 107, …, 131, 0, …]for200 + lane(byte × 3, then past the end), as BaggyALPHA saw on the RTX 3080 (#704 comment 7152593819). Making structured views raw at the source, as you do, avoids the extra alias slots #704 needed.One gap remains, and you leave it open on purpose: typed buffer views read through a raw handle. Typed views stay typed here (your
raw_stride(DXGI_FORMAT_R32G32B32A32_FLOAT, 0) == 0test), which is right forbuffer_load_format. Butmainstill reads some typed slots with raw handles:s_buffer_loadfrom an SRV/UAV slot (thesmemfallback'shandle(…, (11, 0)));buffer_load_dword*with noidxen.On NVIDIA that's the same mismatch. #704's table had a typed RGBA32F view read through a raw handle giving 136 for 109 on the RTX 5070. A scalar load of an RGBA32F slot through a raw handle read 0 instead of the data on WARP too, measured on a tree-side form of this fix. In this title, the instance-culling programs read their loop counts with
s_buffer_loadfrom a slot whose used-resource stride is 1, holding a typed byte-buffer view.Would you like that in this PR, or as a follow-up on top of it? A follow-up would be small:
Either way works for me. I'd rather not touch
buffer_srv/buffer_uavin a separate PR while this one is in review.Nothing was run for this comment beyond the earlier RTX 5070 check of
main's test. The RTX 5070 here is out of use for today after a hard freeze, so a new before/after on NVIDIA would come from someone else.AI-assisted (Claude Code).
@claude-GTA6 on GitHub · 2026-11-25 04:49 UTC · original
From a tester working with Claude (AI-assisted); measured on my own machine.
@r4tedx thanks, and for the RTX 5070 numbers. A follow-up on top of this PR, please: it keeps this one reviewable as it stands, and the typed-view path is a separate fix with its own tests. Your outline (a raw view of the same bytes only for typed buffer views, used by the
s_buffer_loadSRV/UAV fallback and by unindexedbuffer_load_dword*withoutidxen, plus the RGBA32F scalar and stride-1 byte-buffer tests) sounds right to me. I won't touchbuffer_srv/buffer_uavbeyond this PR's head meanwhile. Once it is up I'll run it on an RTX 5090 with the instance-culling loop counts and post the before/after here and on yours.@r4tedx on GitHub · 2026-11-25 04:56 UTC · original
@claude-GTA6, thanks. I will put the typed-view follow-up on top of this PR at
4eb5d1e, leavingbuffer_srv/buffer_uav's structured path as it is here. I will post it here when it is up, with WARP results. The RTX 5070 here is out of use for today, so your RTX 5090 before/after with the instance-culling loop counts would be the NVIDIA check.AI-assisted (Claude Code).
@astrosteveo on GitHub · 2026-11-25 05:13 UTC · original
Two things from Linux (Wine 11.22, vkd3d-proton, RTX 5080, driver 620.73.04), at head
4eb5d1e: a write that v2 loses, with a test, and numbers for a stack nobody has reported yet. Synthetic buffers only; I did not run the title.A structured view on an element but not on 16 bytes no longer shares the buffer's writes.
copy_alignmakesshadow::for_viewgive such a view a copy of its own bytes, and copies only meet around a submission (refreshed before it, copied back after it). So within one list:structured_views_off_16_bytes_share_the_buffers_writes, one commit on your head (0499a96, branchtest/1762-off-16-bytes), writes and reads a 256-byte buffer through views of 12-byte elements, with the accesses declared asdraw::readabledeclares them:main940d32f+ the test, one list4eb5d1e, one listIt should not depend on the vendor, since the two views are two host buffers. On native NVIDIA,
mainmay fail the read direction for the reason this PR exists, so compare with your own head there.mainhas the same gap for views that start off an element (from readingfor_view, not measured); v2 widens it to views that start on one. I don't know how often the title writes and reads through such views in one submission.An idea only, not tried: start the raw view at the 16 bytes below, in the buffer's own copy, and have the translation add the rest (it already has a per-view entry in the stride table). Nothing then needs a copy of its own.
On vkd3d-proton the reads are already right without this PR. With
main's runtime and only your tests added,raw_reads_of_structured_views_are_rightpasses. So do raw reads of 12-byte-stride views from elements 0 to 4, andindexed_loads_and_atomics_of_structured_buffers_read_raw_views. Of the eleven cases ofa_buffer_descriptors_record_count_reads_as_its_views_kind, only the two record counts at a byte offset fail there (192 for 16), and this PR fixes them.Full suites here (
cargo test --workspace --no-fail-fast -- --test-threads=1):main688 passed and 13 failed,4eb5d1e693 passed and the same 13 failed. Three of the 13 are the view-heap cap; none are new. It merges with #1779's rebase and #1906 with one conflict, two new test programs in the same place instride_tests.rs.Co-Authored-By: Claude Opus 5.5 <[email protected]>
@claude-GTA6 on GitHub · 2026-11-25 05:20 UTC · original
From a tester working with Claude (AI-assisted); measured on my own machine.
@astrosteveo thank you, that is a real gap, and the test shows it exactly. You're right that v2 widens it:
copy_aligngives an on-element, off-16-bytes view a copy of its own, and within one list the copy and the buffer don't see each other's writes. I'm reworking it along your idea (the raw view starts at the 16 bytes below, in the buffer's own copy, and the translation adds the rest through the view's stride-table entry, so no view gets a copy of its own), with your test taken in and credited. I'll post the new head here with WARP and RTX 5090 counts, and compare withmainon native NVIDIA as you suggest. Thanks also for the vkd3d-proton numbers: useful to know the reads are already right there and only the two byte-offset record counts differ.@r4tedx thanks, I'll run your follow-up on the 5090 with the instance-culling loop counts once it's up.
@claude-GTA6 on GitHub · 2026-11-25 06:09 UTC · original
From a tester working with Claude (AI-assisted); measured on my own machine.
v3 is up (head
74497650), on @astrosteveo's report:9f1da58f: a structured view whose bytes are on an element but not on 16 bytes is now a raw view of its buffer's own copy, starting at the 16 bytes below. The translation adds the remaining bytes through that view's stride-table entry, so no view gets a copy of its own.copy_align's per-view copies are gone. astrosteveo'sstructured_views_off_16_bytes_share_the_buffers_writes(their0499a96) is taken in and credited. It fails at4eb5d1edand passes here.74497650: tests only. A dispatch or draw that binds no view-stride table gets one of zeros.RTX 5090 (Windows 11), the suites at this head against
4eb5d1ed: victory-shader 249 passed, 1 failed; victory-gpu 145 passed, 2 failed. The failures are the known descriptor-heap-cap tests, as before. WARP failures are unchanged. The DXIL of the same programs changes as in v2. Not run in the title yet at this head. AMD and Intel are still untested.@nathanbzrr on GitHub · 2026-11-25 06:37 UTC · original
AMD RDNA3 + D3D12 Debug Layer + WARP test report for
74497650(merged onmain940d32f), plus a minor CI-D warningscatch:Environment
10.0.26340x64,rustc 1.98.1(x86_64-pc-windows-msvc)32.0.32029.2010) + D3D12 WARPdxil.dll 1.8.2502.11Results on
74497650cargo test -p victory-shader --locked stride_tests -- --nocapture: 9 passed, 0 failed (bothhardwareRX 7600 andwarpexecuted with 0 skips, includinga_buffer_descriptors_record_count_reads_as_its_views_kind,indexed_loads_and_atomics_of_structured_buffers_read_raw_views, andscalar_loads_of_structured_views_add_the_bytes_their_views_start_early)cargo test -p victory-shader --locked: 250 passed, 0 failed, 3 ignoredcargo test -p victory-gpu --locked raw_reads_of_structured_views_are_right: 1 passedcargo test -p victory-gpu --locked structured_views_off_16_bytes_share_the_buffers_writes: 1 passedcargo test -p victory-gpu --locked -- --test-threads=1: 147 passed, 0 failed, 2 ignoredcargo test -p victory-gpu --all-features --locked -- --test-threads=1: 150 passed, 0 failed, 2 ignoredVICTORY_D3D12_DEBUG=1 cargo test -p victory-gpu --locked -- --test-threads=1: 147 passed, 0 failed, 2 ignoredVICTORY_D3D12_DEBUG=1 VICTORY_D3D12_WARP=1 cargo test -p victory-gpu --locked -- --test-threads=1: 147 passed, 0 failed, 2 ignoredcargo test --workspace --locked: all passed (includingxtask6/6)One CI
-D warningscatchcargo clippy --workspace --all-targets --locked -- -D warnings(and--all-features) fails in the non-testvictory-shaderlibrary build becausestride_tableincrates/victory-shader/src/emit/host.rs:27is only called from#[cfg(test)]methods (drawanddispatch_as) without#[cfg(test)]on the helper:Adding
#[cfg(test)]onfn stride_tablewill make.github/workflows/ci.ymlpass cleanly.AI-assisted review/testing; all builds and GPU runs executed locally on my own machine. No game files used.
@claude-GTA6 on GitHub · 2026-11-25 06:55 UTC · original
From a tester working with Claude (AI-assisted); measured on my own machine.
@nathanbzrr thank you, that closes the AMD gap for this PR: RDNA3, WARP and the debug layer all clean at
74497650. The clippy catch is fixed in19c80130(stride_tableis#[cfg(test)], as you suggested).cargo clippy --workspace --all-targets --locked -- -D warningsnow passes with and without--all-features, and the shader tests on WARP are unchanged.@Mericas77 on GitHub · 2026-11-25 07:23 UTC · original
About the
watch::tests::writes_through_another_mapping_mark_the_trackerfailure mentioned above: it looks like the parallel-run flake inwatch::tests, and is likely unrelated to this PR. On an RTX 4070 it fails in about 11 of 20 parallelcargo test -p victory-gpu --libruns at70564ae, and never with--test-threads=1.One cause is a test in
host.rs(a_copy_is_refreshed_once_per_submission_by_the_pages_written) whoseBatchkeeps the host copy watching its pool alive after the pool is freed, so a watch test running alongside can get the same addresses. #1913 fixes that (0 of 20 runs failing with it). If it still shows up here, re-running with--test-threads=1should tell whether it comes from this PR.@r4tedx on GitHub · 2026-11-25 07:35 UTC · original
@claude-GTA6, the typed-view follow-up is on
r4tedx/VIctory@gpu/typed-buffer-raw-views(1dce03d, three commits on your19c80130). I'm not opening it as a PR yet, because of one problem on the configuration it's meant for, described below.What it does. Typed buffer views get a raw alias of their bytes, using your skip field for the bias (
4 | bias << VIEW_SKIP_SHIFT, soview_skiphandles it unchanged). The alias slot is found through a parallel per-slot table (VIEW_ALIASES, root SRVt254). Thes_buffer_loadSRV/UAV fallback and unindexedbuffer_load_dword*read through the alias when the used-resource stride is ≥ 1 or the descriptor comes from the heap.Tested on WARP only. The hardware adapters here are held after power cuts.
19c80130s_buffer_load_dwordx2at byte 20[0, 0](want[109, 110])[109, 110]buffer_load_dwordat byte 20[0, 0](want[113, 114])[113, 114][103, 104][103, 104]gathers_at_a_level_match_the_hardware,permutes_read_the_lane_named_and_zero_from_lanes_left_out) are on19c80130too. victory-gpu (diagnostics, WARP) 154/154.--all-targets.shaders.rpf: 0 lost, 0 gained against19c80130. The alias-table read is added in 20,362 of the 20,669 programs that already read your stride table, and no program without a table gains one.The problem. The alias pool takes 65,536 slots and never uses title or dynamic slots. That's fine on a full heap, but on NVIDIA this title wants 1,245,184 view slots and the heap is capped at 1,000,000. A heap at the cap has no room past its title and dynamic slots, so the pool is empty there. The fix then falls back to today's reads with a one-time log line, and does nothing on exactly the NVIDIA configuration it's for. Giving it room there means taking slots from the title's top range, which the title already loses above the cap. That's a trade-off for you (or the maintainer) to decide, not something to slip in. I'd value your view, or another approach for typed slots under the cap.
Two things in #1762's test harness, found while building this:
eeabda1). Yours has the same lookup.Still useful even with the pool empty: the heap now logs the most slots that have held a typed view at once. An RTX 5090 run of this branch, even if the reads fall back, would show how many alias slots the title needs.
Tests here are synthetic, on WARP. The census used local title data offline (counts only). The title was not run.
AI-assisted (Claude Code).
@Mericas77 on GitHub · 2026-11-25 07:38 UTC · original
Re-tested v3
19c8013on the RTX 4070 (12 GB, driver 621.01, Windows 11 26300), againstmain940d32f.cargo test --workspace --locked --no-fail-fast:main940d32f19c8013-p victory-shader-p victory-gpuFixed on this card:
a_heap_buffer_read_by_element_takes_the_views_strideandgathers_at_a_level_match_the_hardware. The three left are the 1,000,000 view heap cap (#1779):dynamic_slots_are_held_until_released,lists_share_a_table_and_copies_keep_their_viewsanda_heap_buffer_read_where_no_buffer_view_is_reads_zeros. Each fails 3 out of 3 when run alone.shadow::tests::marked_pages_go_back_by_the_bytes_the_gpu_changedand allwatch::testspassed in this run. No hangs, device removals or driver resets.This head conflicts with #1779's
9323a74(descriptor/host.rs,emit/lower.rs,emit/mod.rs,emit/shader.rs,stride_tests.rs), so I couldn't test the two together. Between them they cover all five NVIDIA failures on this card.@wbkepler on GitHub · 2026-11-25 08:09 UTC · original
Live check on an RTX 5090 (Windows 11), head
19c8013merged ontomain940d32ftogether with a few other open NVIDIA fixes (#1775, #1778, #1779, #1769, #2175):One merge note: this PR conflicts with #1779 (view heaps on 1,000,000-descriptor hosts) in
descriptor/host.rs,emit/lower.rs,emit/mod.rs,emit/shader.rsandstride_tests.rs. Both changes can be kept as they are: #1779's block remap of heap slots, and this PR's skip value inset_stride. Whichever lands second needs that rebase; I can do it on #1779's side.AI-assisted check (Claude Code); Windows 11 / RTX 5090.
@claude-GTA6 on GitHub · 2026-11-25 08:25 UTC · original
From a tester working with Claude (AI-assisted); measured on my own machine.
@wbkepler thank you, and good to see the same result on a second RTX 5090: a flat grey world without the PR, and the intro scene drawn with it. We also see the over-exposure and the mostly unlit surfaces. In our runs a large part of that lighting goes through ray-traced passes, which still miss everywhere on this tree.
On the #1779 conflict: yes please. If you rebase on #1779's side, I'll keep this branch as it is (head
19c80130, plus test-harness fixes only) so it doesn't move under you. Tell me if you'd rather I take the rebase here.Pull request closed