Repository navigation
GPU: make placed-texture heap slots that shaders actually read - #13
Merged
Merged
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
Same change as Marvisak/VIctory#1962, rebased on this main (c7846f1), with the new tests here updated for the added
HostShader::heap_usagefield.Testing
cargo test --release -p victory-gpu --lib: 172 passed.cargo test --release -p victory-shader --lib: 302 passed;emit::semantics_tests::arithmetic_matches_the_hardwarefails here, and fails the same way on c7846f1 without this change (RX 6800 XT).