GPU: a buffer view off its copy's elements gets a copy of its own instead of a null slot #362
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!362
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-362"
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?
@RenzoWit35 on GitHub · 2026-11-24 23:56 UTC · original
RenzoWit35:fix/62-misaligned-typed-views→main· +210 −8 · 2 files · 2 commits · openRefs #62 (the refused typed views reported in its comments). It does not close #62: see the note below.
What
A typed shader view of buffer memory names its first element in its own elements, so on the host copy of the memory it is in it can only begin where
offset % element == 0. The console lets a view begin anywhere.buffer_srvrefused the rest ("buffer view not on an element of its host copy") and left the slot null, so shaders read zeros. The report in #62 counted 100–121 such views per run, allR32G32B32_FLOAT(12-byte elements), 264–792 bytes, 4 or 16 bytes off.shadow::exact(start, len): a host copy of exactly the title memory one view reads, so the view begins at element 0. Kept in its own map, handed out under its lock, and let go with the idle windows inlet_go_idle(same criteria: no list, no slot, idle).descriptor::host::off_element: the one decision. A view that is no raw window, has a known element size, and does not begin on an element of its copy.buffer_srvmakes such a view on its own copy at element 0.buffer_copynames the same copy for the view, so the heap pass andreadable()bring it up to date, and the slot shows the copy that gets refreshed.shortcut:within one submission, what shaders write to the other copy of the same memory reaches the view's copy only through title memory, after the submission (the same as any other copy). Before, these views read zeros.Note on #62
A commenter on #62 ported the same idea locally on
4e17478: the refusals went to 0, but the missing cell walls were still missing in that run. So this is a correctness fix for what those views read, not a fix for the walls.Tests
views_off_their_copys_elements_are_told_apart(pure): typed 12-byte elements 4 and 16 bytes in need their own copy; 0 and 24 do not; a structured view that is a raw window does not; one that is not and is off its stride does; an unknown format does not.a_typed_view_off_its_copys_elements_gets_its_own_copy(needs a host device, skips without one): 22R32G32B32_FLOATelements (264 bytes) from element 1, 4 bytes into a registered buffer, get a slot on a copy of exactly that range, andbuffer_copynames that copy. A view of the same memory on an element keeps the buffer's own copy. With the fix switched off it fails: the view is left null.a_views_own_copy_holds_exactly_its_bytes(needs a host device): afterupdate, the copy holds the title's bytes for the range, and the same range asked for again is the same copy.On Windows 11, MSVC Rust 1.98.1, on top of
main(2119b0e):cargo clippy --workspace --all-targets --locked -- -D warnings, the same with--all-features,cargo test --workspace --locked, andcargo xtask policyall pass. Not run in the title.🤖 Generated with Claude Code
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.