Repository navigation
Conversation
DrDarkDK
left a comment
There was a problem hiding this comment.
At 16a3994, I tested write_address with a placed structured buffer SRV and UAV, each with FirstElement = 5, NumElements = 37, and a 12-byte stride. Both entries published the correct byte address, but their shader-visible record counts differed:
| View | Expected dword 2 | Actual dword 2 |
|---|---|---|
| SRV | 37 | 5768 (Shader4ComponentMapping) |
| UAV | 37 | 5 (low dword of FirstElement) |
buffer_words() returns the API view description. In that layout, words[2] isn’t the record count and words[3] isn’t the console format/type word. Could the table writer decode NumElements from the SRV/UAV descriptions and handle console format/type encoding separately?
Synthetic CPU-side test only. No game data used.
AI-assisted with Codex.
|
First run on NVIDIA hardware here, as far as I can see. RTX 5070 (Blackwell, driver 621.24), Ryzen 7 5700X, Windows 11, Rust 1.98.1 MSVC, no game files. Head The PR adds no test that runs here, so this only shows it breaks nothing. The rest is the same as One run, unit tests only, title not run. Written with AI help (Claude/Kiro); the numbers are from runs on my machine. |
catminou4
left a comment
There was a problem hiding this comment.
Descriptor dwords read as data — view-address table widened to 16 bytes per slot (record count dword 2, format/type dword 3). Static review only: victory-gpu/victory-hle are Windows-only (D3D12/windows-sys); not compiled or tested on this macOS arm64 host. rustc 1.98.1. Mixed gpu+shader; the shader consumer side is in the same PR.
|
On The regression creates two adjacent typed buffer SRVs through the guest
For these SRVs, The test-only commit is directly on this PR head and reproduces the failure. It can also be used to verify a fix. Regression commit git fetch https://github.com/steven-seagull27/VIctory.git refs/heads/codex/pr2363-descriptor-readback
git cherry-pick 1c6d0002c2fd3c9d0113e778c2b4e2c7eee69d07
$env:VICTORY_D3D12_WARP = '0'
cargo test -p victory-gpu --all-features --lib --locked adjacent_buffer_descriptors_report_their_fields_after_a_rewrite -- --nocapture --test-threads=1
$env:VICTORY_D3D12_WARP = '1'
cargo test -p victory-gpu --all-features --lib --locked adjacent_buffer_descriptors_report_their_fields_after_a_rewrite -- --nocapture --test-threads=1 |
|
I pushed a cherry-pickable fix for the record-count failure on The RTX 5080 (621.40) and built-in WARP (10.0.26100.10068) returned the same numbers at each step. The regression creates the views through the guest API and reads dword 2 of four adjacent entries with a compute shader.
That takes the count readback from 0/8 to 8/8 on each adapter. A separate CPU test covers the chosen bound for a raw range of 4 GiB: the byte range stays 64-bit, while the shader-visible count saturates at The format still needs a fix. I reran the earlier translated GFX10 shader on both adapters with this patch. Across the four typed reads, the byte offsets (16, 48, 80, 48) and counts (5, 11, 7, 11) now match. All four FORMAT fields still read zero, where the shader expects 20, 22, 21, 22. These are synthetic readbacks. git fetch https://github.com/steven-seagull27/VIctory.git refs/heads/codex/pr2363-buffer-record-counts
git cherry-pick 6a83efe6954697b01aac89cc0dd860bf50ce1649
$env:VICTORY_D3D12_WARP = '0'
cargo test -p victory-gpu --all-features --lib --locked shader_reads_buffer_record_counts_after_a_slot_rewrite -- --nocapture --test-threads=1
$env:VICTORY_D3D12_WARP = '1'
cargo test -p victory-gpu --all-features --lib --locked shader_reads_buffer_record_counts_after_a_slot_rewrite -- --nocapture --test-threads=1AI-assisted with Codex. |
|
The FORMAT fix is ready on top of the earlier record-count patch. On the RTX 5080 (621.40) and built-in WARP (10.0.26100.10068), the translated guest shader went from 0/24 to 24/24 correct FORMAT fields in the expanded test. The four original slot/rewrite checks also pass on both. Format fix The shader reads adjacent typed SRV/UAV descriptors after each of 12 rewrites. The SRV padding deliberately contains The writer now constructs bits 18:12 of dword 3 from the guest view format. The 46 named DXGI mappings were checked against AMD PAL's GFX10.3 table and enum. Raw and structured views use PAL’s untyped R32_UINT convention; unknown buffer encodings return INVALID. The other fields in dword 3, including component selection and out-of-bounds mode, read as zero. In-game behavior is still unverified. AMD format table · AMD GFX10 enum From PR head git fetch https://github.com/steven-seagull27/VIctory.git refs/heads/codex/pr2363-format-matrix
git cherry-pick 6a83efe6954697b01aac89cc0dd860bf50ce1649
git cherry-pick f79c97a6b87677ef8827f601842eece77d2ade0d
git cherry-pick ebaee6d288fc2727239bc05a367bfe404351c99c
$env:VICTORY_D3D12_WARP = '0'
cargo test -p victory-gpu --all-features --lib --locked adjacent_buffer_descriptors_report_their_fields_after_a_rewrite -- --nocapture
$env:VICTORY_D3D12_WARP = '1'
cargo test -p victory-gpu --all-features --lib --locked adjacent_buffer_descriptors_report_their_fields_after_a_rewrite -- --nocaptureAI-assisted with Codex. Synthetic descriptor readbacks. |
|
Good measurements, and a question that decides whether these two are the same fix or a stack: The head this PR carries now is not the record-count-only patch you built on — it also serves dword 3 from the title's own descriptor words ( So, before either of us duplicates the other: could you run the same 12-rewrite, 24-field test against the current head (
Your SRV padding trick ( |
|
Automated triage for the maintainers. Needs rebase. This PR no longer merges cleanly into From the earlier needs-work note, still open: build dword 2 from the view's Generated by Claude Code |
|
Offline RTX 3060 Ti follow-up (NVIDIA 616.56, Windows 11 build 26200). I integrated the corrected count and format encoding linked in this thread, preserving tagged address entries from #2091. This tests the combined code through Two pixel shaders with the descriptor-as-data refusal in the preceding run both translated on the corrected integration. The descriptor suite passed 17 checks, and the separate record-count readback test, three memory tests, and seven Wave32 tests also passed. The later captures remain black or gray. The run recorded 0.92 FPS on nine intervals with more than 200 draws/frame and ended at the memory guard. AI-assisted integration and test. Code-only branch: https://github.com/Capi360/VIctory/tree/codex/rtx-3060-ti-descriptor-data |
16a3994 to
67e8ae1
Compare
…the format
A title may load a descriptor from its heap and read its dwords as numbers:
the base address (to hand to `s_load`, as the BVH's pointer), the record
count (bounds checks), the format and type (to pick a path). The host had
only the address: `view_addresses` served dwords 0-1 and a read past them
stopped the program with "a descriptor read only as data".
Across this title's shader pack (`shaders.rpf`, 26,503 containers) that one
message was 37 programs, all compute. Supplying the record count moved 36
of them on to the format, which is the next dword they read; with both
served, none is left - and 35 programs that failed on it now translate
(14,205 to 14,240 vertex and pixel programs).
Both dwords come from the **title's own descriptor** (`desc[2]`, `desc[3]`),
not from the host view, so a shader that decodes them sees what the console
would have given it. The table is four dwords per heap index instead of two
(host: 16 bytes a slot, `write_address`), and `view_addresses` reads words
0-3, keeping 4-7 refused by name ("a descriptor's dword 4 read as data") so
nothing falls back to a silent zero. Dword 1 still carries the address bits
only: the stride is in the view-stride table (`VIEW_STRIDES`), where the
lowered code reads it.
The table is shared with textures, whose size fields `main` now puts in the
same four dwords (`texture_words`); this keeps that branch and fills a
buffer's dwords 2-3 instead of its zeros.
`title_memory_is_read_and_written_at_computed_addresses` now also loads a
buffer descriptor's dwords 2-3 and checks they come back as the title's
record count and format.
|
Rebased onto Also extended the existing test:
|
|
A note on the timeline: the close at 16:09 was mine by accident — a script at the start of the rebase pushed the branch at |
|
Thanks — that is exactly the pair the fix is for: the two The black/gray captures and 0.92 FPS are the wider emulator state, not this change; the useful part of your run is that the two refusal programs went through. |
|
@Calvix2k I ran the 12-rewrite test you asked for on both
On both unpatched heads the first R8_UINT SRV returned I kept your texture-size path and the regression’s padding sentinel. These three commits on your current PR head can fast-forward your existing branch. git fetch https://github.com/steven-seagull27/VIctory.git refs/heads/codex/pr2363-fields-rebased
git merge --ff-only 85936a89fa6eeffbbb5f6eb233a9683b794c095c
$env:VICTORY_D3D12_WARP = '0'
cargo test -p victory-gpu --all-features --lib --locked adjacent_buffer_descriptors_report_their_fields_after_a_rewrite -- --nocapture --test-threads=1
$env:VICTORY_D3D12_WARP = '1'
cargo test -p victory-gpu --all-features --lib --locked adjacent_buffer_descriptors_report_their_fields_after_a_rewrite -- --nocapture --test-threads=1I also pushed a tested merge with main. To take that integration directly, fetch RTX 5080 driver 621.40 and Windows built-in WARP 10.0.26100.10068, separate processes with the D3D12 debug layer. The texture-size regression passed on both. On the direct fixed branch, the wider descriptor/count selection passed 24/24 on WARP and 23/24 on RTX. The capped-heap assertion in |
|
Measured offline on the title's shaders (the method in #1247), head On the stack from #1247 (#1924 port + #2978 + #385 + #2999 + #1737 + #3016 on |
|
Thanks for the rebase. The head still serves a buffer's dwords 2 and 3 from the API view description ( Dword 2 is the component mapping and dword 3 the description's padding word. The right values are 37 records and format 20 (32_UINT) at bits 12-18. With steven-seagull27's I put this PR's head onto
Census ( Tests on the branch (WARP): @Calvix2k, would you take these into the PR? You could reset to the branch above, or cherry-pick steven-seagull27's three commits and keep their authorship. Either way the PR would serve the right values and merge cleanly. The unit tests are synthetic. Local title data was used offline for the census: a translation of the title's shader pack, with only counts and refusal reasons reported. AI-assisted |
A title may load a descriptor from its heap and read its dwords as numbers: the base address (to hand to
s_load, as the BVH's pointer), the record count (bounds checks), the format and type (to pick a path).view_addressesserved only the address — dwords 0-1 — and a read past them stopped the program witha descriptor read only as data, which is how six pixel shaders of this title were dropped.Measured over the shader pack
victory translate --listovershaders.rpf(26,503 containers), same build otherwise:With the record count alone the 36 still failing moved on to the format, which is the next dword they read; both are needed, and with both served nothing in the pack fails on this reason any more.
How
Both dwords come from the title's own descriptor —
desc[2]anddesc[3]— not from the host view, so a shader that decodes them (a record count, a console format enum) sees exactly what the console would have given it. The table is four dwords per heap index instead of two (16 bytes a slot on the host,write_address);view_addressesreads words 0-3 and keeps 4-7 refused by name (a descriptor's dword 4 read as data), so nothing falls back to a silent zero. Dword 1 still carries the address bits only: the stride lives in the view-stride table (VIEW_STRIDES), where the lowered code already reads it.Verification
cargo test -p victory-shader --lib: 247 passed, 0 failed, 3 ignored (Windows 10 19045 / RX 7800 XT, SM 6.6 via the Agility runtime for the test binaries); the memory test'sview_addressesfixture follows the new width. clippy-D warningsclean.8660e982,7d0f14ce,e5b2121a,c8df7216,2fd01fca,6b6db9f1) should now translate, but that needs a run-in-game check, which I will report here.