GPU/tiles: fix failed card_wrote poisoning, 2D-array/MinLOD SRV clamping, and make/floor overflow #747
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!747
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-747"
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?
@AscilCH on GitHub · 2026-11-25 06:09 UTC · original
AscilCH:fix/gpu-tiles-card-wrote-failure-and-srv-clamping→main· +200 −32 · 1 files · 1 commits · openSummary
Fixes four bugs in the levels-on-demand tiled texture manager (
crates/victory-gpu/src/tiles.rs):card_wrote_ontile allocation poisoningself.card(Tiled::card_wrote_on,Tiled::uploaded_on):card_wrote_on()previously calledself.card.fetch_or(levels)beforegive_on(), and only clearedself.claimed(unclaim) whenwithout != 0. If heap/tile allocation failed, the unbacked level stayed permanently set inself.card, causing lateruploaded_on(..., room = false)calls to bypass the full-card budget (may = card), back an unheld level whose staging data is zeros, and expose that black mip viafirst_shown().uploaded_on()andcard_wrote_on()now masklevels/heldtoself.every_level(), perform the mapping and state updates under theself.givenlock (give_locked/without_locked), and only set bits inself.cardfor levels that actually have tiles.MipLevelsbounds, andResourceMinLODClampinshow_from():show_from()previously ignoredD3D12_SRV_DIMENSION_TEXTURE2DARRAY(allowing 1-layer 2D array SRVs to sample unmapped mip 0), did not clamp reducedMipLevelstolevels - first, and leftResourceMinLODClampunadjusted after raisingMostDetailedMip(double-clamping the effective minimum LOD by an extrafirst - MostDetailedMip).show_from()now handles bothTEXTURE2DandTEXTURE2DARRAY, clamps finiteMipLevelsinto1..=(levels - first), and reduces positiveResourceMinLODClampbyfewer as f32(clamped at0.0).Tiled::make()overflow & zero packed-tile guard:WidthInTiles * HeightInTiles * DepthInTilesand rejectsNumPackedMips > 0whenNumTilesForPackedMips == 0(which would otherwise leave packed mips permanently unbackable).VICTORY_LEVELS_MIN_KBoverflow (floor()):kb.max(64).saturating_mul(1024)instead ofkb.max(64) << 10, preventing huge values from wrapping to 0.Verification
cargo test -p victory-gpu --locked tiles::tests—3 passed, 0 failed, 1 ignored(newfloor_saturates_instead_of_wrapping,show_from_clamps_2d_and_2d_array_and_adjusts_min_lod,card_wrote_failure_does_not_poison_card_mask)cargo test -p victory-gpu --locked -- --ignored levels_on_demand_on_the_card --nocapture—1 passed, 0 failedon WARP software adapter (tiled resources tier 3, Graphics Tools debug layer not installed on host)cargo clippy -p victory-gpu --all-targets --all-features --locked— 0 warnings intiles.rs(only pre-existing upstream warnings in untouched filesdraw.rsandindirect.rs)cargo xtask policy—asset policy: 171 files ok(AI-assisted; synthetic unit tests only, no game data.)
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.