frame: cache tiling swizzle tables and derive texture BPP from format table #197
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!197
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-197"
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?
@Mhyster on GitHub · 2026-12-02 07:15 UTC · original
Mhyster:opt/frame-tiling-cache-and-bpp→main· +114 −20 · 2 files · 1 commits · openWhat
Brings
greenfield/frame/src/tiling.rsin sync withcrates/victory-formats/src/texture.rsand fixes inaccurate texture size estimates ingreenfield/frame/src/objects.rs:frame::tiling::Layout(greenfield/frame/src/tiling.rsshared_pattern,Layout::tiled):Layout::newallocated 6Vec<u32>buffers (3 inpattern, 3 inspread) and recomputed the bit-scatter tables from scratch on everyTextureInfo::build,level_ranges,hold_from,base_level,console_layout, androw_wordscall.victory_formats::texture::shared_pattern(OnceLocktable indexed by micro-tile kind, block size, and element log2), eliminating per-layout heap allocations and redundant bit-scatter work, and mirrorsvictory_formats'sd.block == 1check rejecting multisampled block-compressed layouts.objects::bytes_per_pixelfromcrate::tiling::formatand halve 3D mip depth (greenfield/frame/src/objects.rsbytes_per_pixel,texture_estimate):26..=29includingR8G8B8A8_UNORMat 8 BPP instead of 4 BPP, quadruple-counted97BC7_TYPELESSat 4 BPP instead of 1 BPP, and missed1,115,118..=120, and190) withcrate::tiling::format(f)(keeping 12 BPP for 96-bit RGB32 formats5..=8), and halves 3Ddepthacross mip levels intexture_estimate.The reference
crates/victory-formats/src/texture.rs(shared_pattern,Layout::new,format): the root crate already caches immutable swizzle tables in aOnceLockarray and validatesd.block == 1for multisampled textures;greenfield/frame/src/tiling.rshad drifted behind that optimization.Evidence
greenfield/frame:tiling::format_tests::layouts_share_identical_swizzle_tables(std::ptr::eqonLayout::pattern)tiling::format_tests::bc_formats_reject_multisampled_layoutsobjects::heap_tests::texture_estimate_uses_format_table_and_halves_3d_depthcargo test -p victory-shader -p victory-formats -p victory-core -p xtask --locked(cd greenfield && cargo test -p umem -p frame -p vkback --lib --locked && cargo test -p vkback --test policy --locked)(16/16 frame, 22/22 umem, 168 passed / 3 ignored vkback, 6/6 policy)cargo clippy --all-targets --locked -- -D warningson root native crates,greenfield,greenfield/wine, andgreenfield/vkback/translate.frames.py) and Vulkan validation run (house scene) could not be run in this session (no live game run performed);cargo xwin clippyruns in GitHub Actions CI.Checklist (docs/AGENTS.md)
docs/TASKS.mdnot edited, the fixed item named above (rule 29)unsafeblock has a// SAFETY:comment; no raw pointer around the borrow checker (rule 36)TRANSLATOR_VERSIONbumped if the translator's output changes (rule 27)@vktory6 on GitHub · 2026-12-02 15:28 UTC · original
Thanks. Two topics here:
shared_patternintoframe/tiling.rs, which is the duplicate ofvictory-formats/texture.rs. The TASKS item "One tiling and format table" says to remove that copy, not extend it. Taking that task would give you the cache for free. The speed claim is also unmeasured so far.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.