vkback/shader: clamp view indices (typed and raw twins) to the title's null slot #206
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/vktory6--VKtory!206
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-206"
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?
@lordra9-svg on GitHub · 2026-12-02 12:07 UTC · original
lordra9-svg:fix/view-heap-null-slot→main· +235 −36 · 11 files · 2 commits · merged 2026-12-02 20:07 UTCWhat
docs/TASKS.md:1265: a garbage view index could read past its typed binding or past the raw twins.VKBACK_RAW_VIEWS - 1 = 2,097,151, but each typed binding holdsHEAP_SLOTS = 1,245,184slots, so an index in[1,245,184, 2,097,151]read past binding 0-3/6's array (for binding 6, past the descriptor buffer) instead of a null.Lower::raw_twinclamped a garbage title index to2^21-1then OR'd2^21, giving2^22-1 = 4,194,303, past bindings 4/5's3,342,337slots (binding 4 into 5, binding 5 into binding 6's UBO).Change
desc_countskeeps one reserve slot per typed binding (typed = heap_slots + 1);null_fillalready fills it null.VKBACK_HEAP_SLOTS = 1,245,184shared with the translator (slot_tables_match_the_translatorasserts equality).set_view_heap_limit(VKBACK_HEAP_SLOTS)(wasVKBACK_RAW_VIEWS - 1), so a typed index>= HEAP_SLOTSreads the reserve null slot.Lower::raw_twinclamps to the same limit before OR-ing the twin base, so the largest twin index isRAW_TWIN + HEAP_SLOTS = 3,342,336, exactly the twin null slot; with no heap limit it keeps the oldfirst - 1fallback.TRANSLATOR_VERSION13 -> 14 (the emitted clamp changed);desc_countsispubsovk-mutprobeuses the single formula.Verified
cargo test -p victory-shader --lib: 243 passed (2 new: garbage twin index clamps to the twin null slot; fallback without a heap limit).cargo test -p vkback --lib: 169 passed; policy 6;cargo test -p frame --lib13; clippy-D warningsclean;tools/build.shexit 0.VK_LAYER_KHRONOS_validation, house save, 220 s): only the four known VUIDs (06409 x4, 01687/01688/03428 x20 each), no new errors, no device loss.Notes
A latent safety fix (indices seen to be garbage), so no picture change is expected; the evidence is the clamp constants and the clean validation run.
@vktory6 on GitHub · 2026-12-02 20:07 UTC · original
Merged, thanks. We merged main into your branch. It conflicted with #169's
set_vkback_host(lanes, rdna): we kept that signature, your raw/heap clamp now goes throughvkback_view_settings(), and the test checks raw and heap only.TRANSLATOR_VERSIONis 15, after #180's 14.On the reference card: the card tests pass on the merged state (345). The whole-store diff on your branch translated all 19,112 shaders with 0 failures; 18,732 changed, the clamp constant as expected. Your validation run (only the four listed errors) covers the new descriptor counts.
The translator's direction, including what the emitted clamps should look like, is being discussed in https://github.com/vktory6/VKtory/discussions/270.