[PR #3056] [MERGED] texture_cache: Handle compressed views of uncompressed images #3184

Closed
opened 2026-02-27 22:02:45 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/shadps4-emu/shadPS4/pull/3056
Author: @raphaelthegreat
Created: 6/8/2025
Status: Merged
Merged: 6/8/2025
Merged by: @georgemoralis

Base: mainHead: block-view


📝 Commits (6)

  • b60f821 pixel_format: Remove unused tables, refactor
  • 70c7fd4 host_compatibilty: Cleanup and support uncompressed views of compressed formats
  • a7f91d8 texture_cache: Handle compressed views of uncompressed images
  • a82f3ce tile_manager: Bump max supported mips to 16
  • e9672ff oops
  • d8f28cc texture_cache: Fix order of format compat check

📊 Changes

17 files changed (+434 additions, -609 deletions)

View changed files

📝 CMakeLists.txt (+1 -0)
📝 src/shader_recompiler/ir/passes/lower_buffer_format_to_raw.cpp (+1 -1)
📝 src/video_core/amdgpu/liverpool.h (+1 -1)
📝 src/video_core/amdgpu/pixel_format.cpp (+92 -122)
📝 src/video_core/amdgpu/pixel_format.h (+2 -4)
📝 src/video_core/host_shaders/detilers/micro_128bpp.comp (+1 -1)
📝 src/video_core/host_shaders/detilers/micro_16bpp.comp (+1 -1)
📝 src/video_core/host_shaders/detilers/micro_32bpp.comp (+1 -1)
📝 src/video_core/host_shaders/detilers/micro_64bpp.comp (+1 -1)
📝 src/video_core/host_shaders/detilers/micro_8bpp.comp (+1 -1)
src/video_core/texture_cache/host_compatibility.cpp (+220 -0)
📝 src/video_core/texture_cache/host_compatibility.h (+2 -378)
📝 src/video_core/texture_cache/image.cpp (+6 -59)
📝 src/video_core/texture_cache/image_info.cpp (+76 -3)
📝 src/video_core/texture_cache/image_info.h (+7 -18)
📝 src/video_core/texture_cache/texture_cache.cpp (+15 -10)
📝 src/video_core/texture_cache/tile_manager.cpp (+6 -8)

📄 Description

Fixes the missing car colors in Driveclub (CUSA00093). The game renders the car paint textures as R32G32B32A32 and then uses a compute shader to write to another texture of the same format. It turns out this is a BC3 compression shader, as the game will later request the that storage image as BC3. The texture cache considered this a bad match and threw out the generated one, in favor of an empty black image.

This is fixed by relaxing the mismatch check to use dimention in blocks instead of texels and checking bits per block as a rough estimate of compatibility. Then an image copy is issued in the uncompressed -> compressed conversion. On AMD GPUs having a compressed view of an uncompressed image works just fine, but on NVIDIA it doesn't, so the copy is required.

The vulkan compatibility rule table has also been expanded to handle size compatibility, when VK_IMAGE_CREATE_BLOCK_TEXEL_VIEW_COMPATIBLE_BIT is enabled which is used now. This ensures that if the image is requested in uncompressed format again, the cache can use an image view on the compressed image instead of creating a new image again.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/shadps4-emu/shadPS4/pull/3056 **Author:** [@raphaelthegreat](https://github.com/raphaelthegreat) **Created:** 6/8/2025 **Status:** ✅ Merged **Merged:** 6/8/2025 **Merged by:** [@georgemoralis](https://github.com/georgemoralis) **Base:** `main` ← **Head:** `block-view` --- ### 📝 Commits (6) - [`b60f821`](https://github.com/shadps4-emu/shadPS4/commit/b60f821d8d6c9262e56048dae467df1f090e24a0) pixel_format: Remove unused tables, refactor - [`70c7fd4`](https://github.com/shadps4-emu/shadPS4/commit/70c7fd4fab0ce785abd75b5b015a2e6325bc1b9d) host_compatibilty: Cleanup and support uncompressed views of compressed formats - [`a7f91d8`](https://github.com/shadps4-emu/shadPS4/commit/a7f91d8ff5455326d74ab240a9791b9075f6d3f3) texture_cache: Handle compressed views of uncompressed images - [`a82f3ce`](https://github.com/shadps4-emu/shadPS4/commit/a82f3cec4b692eec86d566a828cd589146f361b4) tile_manager: Bump max supported mips to 16 - [`e9672ff`](https://github.com/shadps4-emu/shadPS4/commit/e9672ff24fa5592a3ad66a591ca2983b1c624820) oops - [`d8f28cc`](https://github.com/shadps4-emu/shadPS4/commit/d8f28cccc10303016cf508694c4ab1daa9a2cba4) texture_cache: Fix order of format compat check ### 📊 Changes **17 files changed** (+434 additions, -609 deletions) <details> <summary>View changed files</summary> 📝 `CMakeLists.txt` (+1 -0) 📝 `src/shader_recompiler/ir/passes/lower_buffer_format_to_raw.cpp` (+1 -1) 📝 `src/video_core/amdgpu/liverpool.h` (+1 -1) 📝 `src/video_core/amdgpu/pixel_format.cpp` (+92 -122) 📝 `src/video_core/amdgpu/pixel_format.h` (+2 -4) 📝 `src/video_core/host_shaders/detilers/micro_128bpp.comp` (+1 -1) 📝 `src/video_core/host_shaders/detilers/micro_16bpp.comp` (+1 -1) 📝 `src/video_core/host_shaders/detilers/micro_32bpp.comp` (+1 -1) 📝 `src/video_core/host_shaders/detilers/micro_64bpp.comp` (+1 -1) 📝 `src/video_core/host_shaders/detilers/micro_8bpp.comp` (+1 -1) ➕ `src/video_core/texture_cache/host_compatibility.cpp` (+220 -0) 📝 `src/video_core/texture_cache/host_compatibility.h` (+2 -378) 📝 `src/video_core/texture_cache/image.cpp` (+6 -59) 📝 `src/video_core/texture_cache/image_info.cpp` (+76 -3) 📝 `src/video_core/texture_cache/image_info.h` (+7 -18) 📝 `src/video_core/texture_cache/texture_cache.cpp` (+15 -10) 📝 `src/video_core/texture_cache/tile_manager.cpp` (+6 -8) </details> ### 📄 Description Fixes the missing car colors in Driveclub (CUSA00093). The game renders the car paint textures as R32G32B32A32 and then uses a compute shader to write to another texture of the same format. It turns out this is a BC3 compression shader, as the game will later request the that storage image as BC3. The texture cache considered this a bad match and threw out the generated one, in favor of an empty black image. This is fixed by relaxing the mismatch check to use dimention in blocks instead of texels and checking bits per block as a rough estimate of compatibility. Then an image copy is issued in the uncompressed -> compressed conversion. On AMD GPUs having a compressed view of an uncompressed image works just fine, but on NVIDIA it doesn't, so the copy is required. The vulkan compatibility rule table has also been expanded to handle size compatibility, when VK_IMAGE_CREATE_BLOCK_TEXEL_VIEW_COMPATIBLE_BIT is enabled which is used now. This ensures that if the image is requested in uncompressed format again, the cache can use an image view on the compressed image instead of creating a new image again. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 22:02:45 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/shadPS4#3184
No description provided.