texture_cache: give a storage binding its own image when the cached BC image lacks storage usage #2174
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
GPU
GUI
help wanted
question
Shaders
Video
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/KytyPS5--KytyPS5!2174
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/2174/head"
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?
@Nawid3333 on GitHub · 2026-11-08 04:41 UTC · original
Nawid3333:fix/bc-storage-view-usage→main· +90 −4 · 3 files · 4 commits · closed without mergingSome drivers refuse
VK_IMAGE_USAGE_STORAGE_BITfor BC5 and BC6H images: AMD's Windows driver 26.10.1 refuses it invkGetPhysicalDeviceImageFormatProperties2for BC5_UNORM and BC6H_UFLOAT on an RX 9070 XT and on the Radeon iGPU of a Ryzen 5 7600X (also with MUTABLE | EXTENDED_USAGE | BLOCK_TEXEL_VIEW_COMPATIBLE, with and without a format list), while BC1/3/4/7 are accepted.ImageUsageFlagsthen creates those images without STORAGE and logsWarning: format Bc5UnormBlock does not support storage access. Of the logs attached to issues here, 24 of 152 AMD logs (20 titles) contain that warning, and none of 106 NVIDIA logs.When the guest later binds the same range as an uncompressed 128-bit storage image at block resolution (e.g. R32G32B32A32_UINT),
ResolveOverlapreaches the final equal-pitch handover and returns the cached BC image, becauseFormatsCompatibleputs BC5/BC6H in the 128-bit class.Image::FindViewthen creates a storage view of an image without STORAGE usage (VUID-VkImageViewCreateInfo-pNext-02662).Changes.
ResolveOverlap: a storage request whose cached image has no STORAGE usage (and no image merged yet) goes throughExpandImage, like the other layout changes in that branch. The new image of the requested format is filled from the cached one and replaces it; a later BC request at the range is rebuilt from it the same way. Devices that give BC images STORAGE keep the current reuse; the decision reads the image's usage, not the vendor. (#1980 makesFindViewexit on such a view; with this change the BC case no longer reaches that check.)Image::CopyImageclamped each level's extent to the smaller image in texels.vkCmdCopyImagecounts the extent in source texels, so a copy from a BC image (4x4 blocks) into a 128-bit image at block resolution covered a sixteenth of the blocks, and a larger 128-bit source could write past a BC destination. When the block extents differ, the extent is now clamped to the destination's block count; copies between equal block extents are unchanged. This is the block-ratio rule ofCopyExtentin #1176 by @overlordxrz-source, which also covers partial blocks and the buffer path but conflicts with main since440245f6; if #1176 lands first, this commit can be dropped.Test. A case in
CheckUnifiedTextureCacheFlow(--buffer-cache-range-only) uploads a 256x256 BC5 image, removes STORAGE from its backing (so the case runs on every device), binds a 64x64 R32G32B32A32_UINT storage image at the same range and requires: a separate image with STORAGE, the uploaded blocks in it, a stored value in a later BC sample, and the stored value again after binding the storage image once more (the BC image then holds the only copy).storage alias of a BC image without storage usage; with only the texture cache change it fails atstorage rebind after a BC sample; with both changes the case passes. All 145 selectors ofshader_recompiler_compute_testsgive the same exit code and the same failures on main and on this branch, and the full run fails the same two existing cases on both (GpuSelectedFormattedRgba16Store,IndirectImageQueryDimensions); both stop later at the same D24S8 depth image this GPU cannot create. A lab-only patch replaced the MSAA D24S8 depth format with D32S8 on every arm so the runs reach this case; it is not part of the PR.16d4469ac, mainf399d4818merged in): Windows, Linux and macOS build and pass the tests: https://github.com/KytyPS5/KytyPS5/actions/runs/42641619709Written with Claude Code, OpenAI Codex and GLM (AI): the fix, the test and the measurements, run on my PC; reviewed by me.
@coderabbitai[bot] on GitHub · 2026-11-08 04:48 UTC · original · edited 2026-11-09 15:12 UTC
No actionable comments were generated in the recent review.
Walkthrough
Image copies now calculate mip extents using source and destination block sizes. When a storage request overlaps a compatible cached image without storage usage,
ResolveOverlapcallsExpandImage. A new BC5 compute test checks storage alias separation, retained data, and visibility of storage clears.Suggested reviewers:
nmzik,claxten10Change: Bug fix
Merge Risk:
Minimal · up to
16d44The change makes storage bindings of cached BC images use a storage-capable image and clamps image copies at block boundaries. No actionable merge-blocking risk was identified in the supplied context.
Pre-merge checks:
4 ·
1
Full details: Title check
Explanation
The title names the main change: a storage binding gets its own image when the cached BC image lacks storage usage. The raw summary's ResolveOverlap change and the test case match this. The CopyImage clamp is a secondary change that the title does not mention, which is acceptable.
Full details: Description check
Explanation
The description covers the driver issue that causes the bug, the ResolveOverlap and Image::CopyImage changes, the new test case, and the test results. It is detailed and directly related to the changeset.
Full details: Docstring Coverage
Explanation
Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 3 functions across 2 files. (1 skipped: 1 too large.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Share
240c72b8-81c1-47fa-8572-63d3184d10e4Reviewing files that changed from the base of the PR and between
d1c2f7abadand16d4469ac4.tests/ShaderRecompilerComputeTests.cppIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
Pull request closed