vkback: probe whether linear mip layouts can be reused in place #137
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!137
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-137"
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?
@TheRifai on GitHub · 2026-12-01 20:29 UTC · original
TheRifai:mip-linear-probe→main· +75 −25 · 4 files · 1 commits · closed without mergingWhat
Mips are the largest single reason a console-linear texture takes a copying image (PR #129: 44,489 boat / 34,522 house attempts). The console packs linear mips smallest first and pads rows to 256 bytes (
frame::tiling::linear); a Vulkan linear image with a mip chain has its own per-level layout. This adds a read-only probe — one image creation per distinct (format, width, height, mip count) — that compares each level's offset and row pitch with the console's, and showsmip-linear probes: candidates N, layouts match Mon the stats line (docs/TASKS.md, "Linear textures with mipmaps are not bound in place"). No bindings change.The reference
The console's linear level layout is computed by its addrlib port; the probe reports whether Vulkan can reuse it directly.
Evidence
cargo check -p vkback --all-targets, 164 native tests, and the build all pass.mip-linear probes: candidates 6, layouts match 0. Boat start, 100 s: same. The note for the 128x72 R32_SFLOAT 7-mip case: levels 0 and 1 agree (@0x4900 pitch 512,@0x2500 pitch 256), level 2 does not (vk @0x1300 pitch 128, console@0x1300 pitch 256) — the console's 256-byte row padding is the first divergence./tmp/opencode/capture/mip-probe-house2/,/tmp/opencode/capture/mip-probe-boat/. Neither is a performance measurement.Checklist (docs/AGENTS.md)
docs/TASKS.mdnot edited (rule 29/31)unsafeor translator output changed (rules 2/9b/33/35/36/27)@vktory6 on GitHub · 2026-12-01 20:32 UTC · original
Thanks, the probe answered its question cleanly: 0 of 6 mip chains match, and the 256-byte row padding of the console is the first divergence (level 2 of the 128x72 R32_SFLOAT chain). I recorded the result in the TASKS item "Linear textures with mipmaps are not bound in place":
github.com/vktory6/VKtory@ab7b4e6I'm closing it instead of merging, though: with the answer in hand, the probe would create a test image for every new mip-chain description in every run from now on. It's a Vulkan call change that needs its own validation run, for a question that's settled. The next step from the task is yours if you want it: one linear image per level, with a view per level, or a level-0 image with the other levels copied. A PR for either is welcome.
(The TASKS.md lines in the diff are from your branch's older base, not an edit of yours. No problem.)
@TheRifai on GitHub · 2026-12-01 22:06 UTC · original
On the invited next step for mipmapped linear textures: I looked at the shape of both options after the probe.
mto a different image handle. Today anImgcarries oneimageandviewdescindexes mips within it (imgmake.rs,placed.rs,ViewKey { image, mip }), so this is a descriptor/view-table change, not a local one inmake_linear_in_place.mip == 0views to the former. It still needs a per-texture mip-to-image map and a picture gate, but no descriptor format change.The probe's numbers suggest level 0 and 1 often agree with Vulkan's layout (128x72 R32_SFLOAT 7-mip: m0 @0x4900 pitch 512, m1 @0x2500 pitch 256) and the first divergence is row padding at m2, so option 2 would recover the in-place binding for the largest level with the least risk. I have not started it; recording the plan here so the task has a concrete next step.
@vktory6 on GitHub · 2026-12-01 22:08 UTC · original
Thanks for working out both shapes. One constraint decides between them, and it applies to both: a Vulkan image view samples the levels of one image only. A view over several levels (an SRV with MipLevels > 1, which LOD selection and trilinear filtering need) cannot span a level-0 image plus a copied image, nor one image per level. So either split only serves views that name a single level.
I put that into the task with a concrete first step: count the views of mipmapped linear textures by how many levels they name, in house and boat. If most name all levels, the copy stays (the console's 256-byte row padding per level doesn't fit one Vulkan linear image on RADV). If many name one level, your level-0 plan is worth building.
github.com/vktory6/VKtory@1ab74ffPull request closed