Repository navigation
GPU: make placed-texture heap slots that shaders actually read - #1962
antocorvo3000 wants to merge 1 commit into
Conversation
Shaders that take descriptors from the resource heap itself (bindless materials) read placed-texture slots that the heap mirror leaves null until a draw reads them through a table (the shortcut that keeps ~20,000 host textures from being made at once). In Grand Theft Auto VI most world materials sample that way, so their G-buffer albedo came out black and the lit scene stayed dark. Translated shaders now mark each heap slot they take a shader resource view from in a bitmap (u1 in the memory space, an atomic OR per lane), bound per list like the written-pages bitmap. After the list ran, each marked slot still holding a placed texture left for later is made, so it reads from the next list on. Only the textures in use are made. VICTORY_HEAP_USAGE=0 turns the marks off (shaders as before). The frame line reports slots marked, views made, and why marked slots were not made. Unit tests leave the marks off (the hardware harness binds only the parameters each test names). Measured in the world: albedo coverage from ~20% to 99% of the screen; about 10-20 views made per 5 s once streamed in; no view failed to make.
VIctory V2: community PRs, merged and testedOpen 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). 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: Unofficial community fork of Marvisak/VIctory, GPL-3.0. |
|
Automated triage for the maintainers. This pull request does not merge cleanly into It will be reviewed once it is rebased onto the current Generated by Claude Code |
|
On Windows I reproduced a warm-cache issue at Fix and regression assertion. The cache now keys on the same effective boolean that controls emission and feedback consumption. With that commit, the first run in each mode missed, repeat runs in both modes hit with matching flags, and the default shared the enabled cache. I tested both toggle orders in separate Windows processes and ran the GPU crate suite with diagnostics on WARP (144 passed, 2 ignored). AI-assisted. |
catminou4
left a comment
There was a problem hiding this comment.
Merge conflict with current main (940d32f) — git merge origin/main fails on the PR head; rebase needed. GPU: make placed-texture heap slots that shaders actually read — the shader-visible side of placed textures; relates to #1730's root views (merged) and #1971's descriptor metadata. Will re-test after rebase.
|
@antocorvo3000, this PR conflicts with
Tested on WARP only (the software adapter), each revision with its own build:
Not verified: the shader test harness runs with heap marks off, so placed-texture feedback end to end, hardware rendering and a warm cache across processes are untested. The title was not used in these tests. AI-assisted |
|
Hardware test on an RTX 3070 (8 GB VRAM, 32-lane waves), Windows 11, Series X mode. I merged the PR onto our local test branch: main plus #1890, #1906, #1779, #1763, #1762, #1883, and a page-mark guard like #2167. The image: the merge works. Before, world albedo covered ~1.3 % of the screen in a target dump (the G-buffer albedo target, 2560x1440). After the merge, materials show in the world and in cutscenes: prison clothes, shirt prints, hair, buttons. Merge conflict: on current main (940d32f), Performance (the main problem on this card): the bitmap comes from
AI-assisted. |
…per wave, test-before-OR, branch at block end, UAV stage flag)
|
Follow-up on the 8 GB card: the device removal was memory, and it is gone with five open PRs merged on top. Same test branch as above, 480 s runs.
AI-assisted. |
|
Following up on Slay326's measurements above, with a fix for the per-read atomic cost and for two translation problems we hit with this PR rebased onto 1. Marks: one atomic per wave, and only if the bit is clear (
2. The branch no longer breaks dominance ( 3. Vertex and mesh shaders that mark declare 4. Offline check.
The 7,330 programs regained are 7,256 mesh and 74 vertex shaders, all "Flags must match usage" before. In game nothing runs the validator, and the NVIDIA driver accepted those shaders without the flag. So this matters for validation and for stricter drivers, not for what ran in our earlier game runs. In game. RTX 5070 12 GB, 32 GB RAM, our play build: layer 2 of our tree, which includes #2242 and #2280, plus this PR and the fix above. Local title data used for the in-game measurement; only timings and log counts are reported.
Unit tests. victory-shader clippy AI-assisted |
|
WARP suite counts for
The two failures are The title was not used in these tests. AI-assisted |
A host texture's staging buffer (its uploads from title memory, the size of the texture, in the upload heap: the PC's memory) was kept as long as the host texture. With Marvisak#1962's placed-texture views, which heap slots keep, that was one per texture the title ever placed and a shader read; Marvisak#2161 cannot let those go while a slot views them. A staging buffer is now stamped with the time and frame whenever it is needed: a list copies from it (upload), or, for textures the heaps view (upload_changed, every submission), only when the memory changed. Once a second at present, one not needed for 5 seconds and 4 frames, and that no list not yet reset holds, goes; its buffer is retired so a running submission keeps it. The host texture keeps what was uploaded, and the memory's tracker (or, untracked, the last hash) stays with it: while the memory is unchanged, heap uploads make no new buffer. Once it changes, or a list copies from it, a new one is made and the whole memory detiled into it (forced: the buffer is new). One made but never refreshed keeps no tracker, so the next starts anew. VICTORY_STAGING_SWEEP=0 keeps them all, as before. The host textures line counts staging buffers alive and let go, with their bytes. Test (no game data): idle_staging_goes_and_its_host_texture_stays. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…arvisak#1873, Marvisak#2221, Marvisak#2161, idle staging buffers released) Marvisak#1873 81ebd7c: one shared scratch buffer for texture detiling. Marvisak#2221 df15bd1 (in place of Marvisak#1969): host textures made on a title texture's first use. Marvisak#2161 e04431f: idle placed textures are let go. 47bb09c: idle staging buffers are let go, their host textures kept. For A/B: VICTORY_STAGING_SWEEP=0, VICTORY_TEXTURE_SWEEP=0. Runtime only. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
In-game result with this PR in our play tree, thanks to @antocorvo3000 for the PR and @Slay326 for the measurements that shaped the fixes. RTX 5070 12 GB, 32 GB RAM, local title data used for the in-game measurement; only timings and a description of the picture are reported, no images. The tree has this PR as rebased, our marks fix (
Not separated: how much of the lighting comes from this PR and how much from the stand-ins. AI-assisted |
|
I tested antocorvo3000’s change with r4tedx’s
This comparison isolates the effect of creating the requested views as a group. Which individual texture made the hair visible is still open. Capture and analysis were assisted by OpenAI Codex. |
|
@Venom2054, thank you. That's a clean A/B: same exe, save, caches and input, with the descriptor indices checked 20/20. It's the first independent in-game confirmation that creating the requested placed-texture views brings back the hair and the material-buffer textures. On the character still being dark in the final lit frame: in our runs (RTX 5070, 32-lane waves) that comes from a separate gap, not from this PR. On Local title data was used for those in-game observations; only program names and hashes, refusal reasons and a description of the picture are given here. AI-assisted |
Shaders that take descriptors from the resource heap itself (bindless
materials) read placed-texture slots that the heap mirror leaves null
until a draw reads them through a table (the shortcut that keeps ~20,000
host textures from being made at once). In Grand Theft Auto VI most
world materials sample that way, so their G-buffer albedo came out
black and the lit scene stayed dark.
Translated shaders now mark each heap slot they take a shader resource
view from in a bitmap (u1 in the memory space, an atomic OR per lane),
bound per list like the written-pages bitmap. After the list ran, each
marked slot still holding a placed texture left for later is made, so it
reads from the next list on. Only the textures in use are made.
VICTORY_HEAP_USAGE=0 turns the marks off (shaders as before). The frame
line reports slots marked, views made, and why marked slots were not
made. Unit tests leave the marks off (the hardware harness binds only
the parameters each test names).
Measured in the world: albedo coverage from ~20% to 99% of the screen;
about 10-20 views made per 5 s once streamed in; no view failed to make.
Testing
cargo test --release -p victory-shader -p victory-gpu --lib: 246 + 141 passed.