Shaders: view-address table for descriptors picked by a computed index #749
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/fxceless--victory-fork!749
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-749"
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?
@Revens2 on GitHub · 2026-11-25 06:14 UTC · original
Revens2:fix/issue-279→main· +216 −3 · 6 files · 2 commits · openRefs #279 (the pixel programs whose descriptor is "read only as data").
What is in it
SLOT_VIEWS, a root SRV likeSLOT_STRIDES, 2^21 slots x 16 bytes, so +32 MiB of upload buffer per view heap). It is written where a slot is written; the lowering reads the address, length and stride from it. A computed term in a used descriptor's address takes the same table.translate --validateon the same title pack with both trees: VItoriaBr had no "read only as data" failures, main had 40. Thelower.rs,descriptor/host.rs,pipeline/host.rs,emit/mod.rsandemit/shader.rsparts apply unchanged; thedraw.rspart is rewritten for the current main (it conflicted).Tested
victory translate <pack> --validate,VICTORY_HOST_WAVE=32, main8dd30abagainst this branch:cargo build --workspace --lockedandcargo test --workspace --locked -- --test-threads=4on this branch: 526 passed, 0 failed, 10 ignored.Not tested
AI use
Regression run
🤖 Generated with Claude Code
A program that loads a buffer descriptor at an index it computes, and only uses the descriptor's address as data, found no root view to ask and was refused ("a descriptor read only as data"). The host now keeps one table of the title addresses of the heap's buffer views by heap slot (SLOT_VIEWS, a root SRV like SLOT_STRIDES, 2^21 slots x 16 bytes), filled where a slot is written, and the lowering reads the address, length and stride from it. A computed term in a used descriptor's address takes the same table. Adapted from uiliannn/VItoriaBr commits b62bbc0 and 77ad907 (GPL-3.0, the fork's own licence); the draw.rs part is rewritten for the current main, the rest applies unchanged. Co-authored-by: uiliannn <[email protected]> Co-Authored-By: Claude Sonnet 5.5 <[email protected]>@ArturoWolff on GitHub · 2026-11-25 06:40 UTC · original
Linux offline comparison for the 64-lane question, with a 32-lane control. I built the translator separately at main
8dd30ab, #738ea40c9a, and this PR9b6b344. Same hash-checked inputs, directemit::translate, no shared shader cache;set_host_max_wave(32)and then(64). These are compiler settings, not a test on AMD hardware.PuddleDetectpixel shaders named in #279 (2fd01fca16993001,6b6db9f1a526daeb,7d0f14ce44746d7e) were refused on main and #738 at both settings. On #749 all three translated and passeddxvat both settings. This overlaps the earlier #203 replay; it is not three additional shaders on top of #203. Unlike #203 at 32, #749 still refused the shallow-water timestepceb5eb68cd99cb07at0x38.The useful next check for the new pixel shaders is a readback with distinguishable buffer addresses at nonzero descriptor indices and a nonzero table offset.
dxvacceptance cannot resolve the stride/offset review findings. No retail launch, GPU execution, or change in visible pixels measured here.AI-assisted: Hermes Agent ran the local comparisons and validator, checked the byte equality, and wrote this comment on ArturoWolff’s behalf.
@Revens2 on GitHub · 2026-11-25 06:40 UTC · original
In-game check (RTX 5070 12 GB, driver 32.0.16.2124, Series X profile,
VICTORY_RELAY=2, same key script, 420 s, release build; another agent's game was running alongside in the first run):8dd30abThe 7 refused compute pipelines ("Paramètre incorrect") appear on main too. One crash in three on the branch against one run on main is too few to say whether the PR changes crash odds (0xC0000005 during loading is already reported in #416/#453); the fps difference is within run-to-run spread. Not checked: any picture difference for the 35 programs that now translate.
@Revens2 on GitHub · 2026-11-25 06:53 UTC · original
Thanks for the review. Both findings are fixed in
41a3892, and the branch is rebased on maina26859f.SLOT_VIEWStable by a shift of 4. The shift comes from a shared constant,SLOT_VIEWS_RECORD_BYTES = 16, which the host allocation also uses. TheSLOT_VIEWSdoc comment said "two dwords per slot" and is corrected.view_address_indexedno longer adds the table byte offset to the loaded address. That offset is already part of the slot index, so the address read from the table is returned unchanged.Tests:
cargo build --workspace --lockedis clean.cargo test --workspace --locked -- --test-threads=4gives 535 passed, 0 failed, 10 ignored. Two new unit tests, one per finding: the record stride is 16 and the shift matches it, andview_address_indexeddoes not offset the loaded address.The P2 test is a source check on the function body (no
address_pluscall). It is not a readback. As @ArturoWolff noted, a readback with nonzero descriptor indices and a nonzero table offset is the check that settles this. No in-game run yet, so that stays "not tested".@ArturoWolff on GitHub · 2026-11-25 07:32 UTC · original
I checked the nonzero-index/nonzero-offset case against
41a3892and its direct parenta1855ac. The emitted shader selects the intended record and returns its address unchanged on41a3892. This is a CPU interpretation of the DXIL, not a device readback. Both versions passdxv, so validation alone would miss the difference.The same synthetic one-thread compute shader used a table base of 32 bytes, dynamic index 4, and immediate table offset 32 bytes (expected slot 6). Eight 16-byte host records had distinct addresses and stride tags. The shader returned the address and tag; it did not dereference the address.
a1855ac0x280→0x2a041a38920x400→0x400The tag identifies the record independently of the returned address: the parent both selected the wrong record and added 32 after loading it. Neither error occurred on your fix. Unlike my earlier puddle-shader translation comparison, this checks the values produced by the emitted operations. The isolated lavapipe attempt timed out during initialization, before dispatch; actual host binding, device output, and in-game pixels remain unverified.
AI disclosure: Hermes Agent built the synthetic fixture, validated the DXIL, reran the CPU/IR comparison, and wrote this follow-up on ArturoWolff’s behalf.
@Revens2 on GitHub · 2026-11-25 09:35 UTC · original
@ArturoWolff thanks for checking the emitted DXIL on
41a3892and for pinning the bad parent (a1855ac). The in-game and device-readback side is still unverified on our end; we will report a run on this head when the queue reaches it.@codex review
@chatgpt-codex-connector[bot] on GitHub · 2026-11-25 06:15 UTC · original · edited 2026-11-25 09:42 UTC
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
41a3892ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.
@chatgpt-codex-connector[bot] on GitHub · 2026-11-25 06:21 UTC · original
On
crates/victory-shader/src/emit/lower.rsline 2720 (outdated):For a computed descriptor index above 0, this uses an 8-byte stride even though the host allocates and writes four dwords (16 bytes) per slot. The four-component load therefore reads overlapping records instead of the selected slot, so shader code can use a bogus address when walking the buffer. Shift by 4, or otherwise match the host writer's 16-byte entry size.
Useful? React with 👍 / 👎.
@chatgpt-codex-connector[bot] on GitHub · 2026-11-25 06:21 UTC · original
On
crates/victory-shader/src/emit/lower.rsline 2744 (outdated):When the
s_loadaddress has a nonzero root-relative descriptor-table offset,heap_indexhas already used that address to select the absolute heap slot read fromSLOT_VIEWS;a.offsetis part of the descriptor-table address, not an offset into the selected buffer. Adding it here shifts the returned title pointer (for example, an entry at byte offset 32 yields its buffer address plus 32), so address-based walkers can read unrelated bytes. Leave the fetched address unchanged.Useful? React with 👍 / 👎.
@ -1074,0 +1084,4 @@l.SetGraphicsRootShaderResourceView(param, gpu);}},None => once!("a shader reads view addresses of a heap that is not set"),@chatgpt-codex-connector[bot] on GitHub · 2026-11-25 09:42 UTC · original
If the 32 MiB
viewsupload allocation fails,HostHeap::newleavesviewsunset andheap_viewsreturnsNone. This arm only warns and continues, so the draw or dispatch still runs without a validSLOT_VIEWSroot SRV; the shader's raw loads then read zero or undefined addresses. Refuse the submission when this required table cannot be bound.Useful? React with 👍 / 👎.
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.