[PR #3204] [MERGED] texture_cache: Async download of GPU modified linear images #3302

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

📋 Pull Request Information

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

Base: mainHead: linear-img


📝 Commits (4)

  • ea9a2ac texture_cache: Async download of GPU modified linear images
  • 4238cd9 liverpool: Back to less submits
  • ac430ca texture_cache: Don't download depth images
  • 12bc09c config: Add option for linear image readback

📊 Changes

10 files changed (+106 additions, -16 deletions)

View changed files

📝 src/common/config.cpp (+10 -1)
📝 src/common/config.h (+1 -0)
📝 src/video_core/amdgpu/liverpool.cpp (+1 -2)
📝 src/video_core/buffer_cache/buffer_cache.h (+1 -1)
📝 src/video_core/renderer_vulkan/vk_rasterizer.cpp (+12 -4)
📝 src/video_core/renderer_vulkan/vk_rasterizer.h (+1 -1)
📝 src/video_core/renderer_vulkan/vk_scheduler.cpp (+9 -4)
📝 src/video_core/renderer_vulkan/vk_scheduler.h (+3 -0)
📝 src/video_core/texture_cache/texture_cache.cpp (+59 -2)
📝 src/video_core/texture_cache/texture_cache.h (+9 -1)

📄 Description

@AboMedoz mentioned to me that @Ruahh reported a softlock in The Last Guardian regarding water physics, this PR fixes that. Turns out it creates a bunch of images with linear tiling and expects to read them on the CPU. I've also noticed this improves the post processing of the game, but requires more testing.

Doing proper read protection on the texture cache is much more difficult than buffer cache, as images can overlap with each other, so it triggers false positives a bunch of times. Also images generally occupy more space and are more difficult to download a per page basis, as there is no fine grained tracking. So this PR simply downloads them in async way to avoid dealing with those problems and still get the data to the CPU, even if a frame late.

I'll probably add an option for this too, even if it should have much less perf impact compared to buffer readbacks.


🔄 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/3204 **Author:** [@raphaelthegreat](https://github.com/raphaelthegreat) **Created:** 7/7/2025 **Status:** ✅ Merged **Merged:** 7/7/2025 **Merged by:** [@georgemoralis](https://github.com/georgemoralis) **Base:** `main` ← **Head:** `linear-img` --- ### 📝 Commits (4) - [`ea9a2ac`](https://github.com/shadps4-emu/shadPS4/commit/ea9a2ac26a7372ccbce3d69ef26242e40f05e09c) texture_cache: Async download of GPU modified linear images - [`4238cd9`](https://github.com/shadps4-emu/shadPS4/commit/4238cd9fac12a6a569f20ac2d62cdf969f57bfff) liverpool: Back to less submits - [`ac430ca`](https://github.com/shadps4-emu/shadPS4/commit/ac430ca0d0e558050e39174ab7a6ad6002c8754e) texture_cache: Don't download depth images - [`12bc09c`](https://github.com/shadps4-emu/shadPS4/commit/12bc09cfa034ea548e800d9420542343a15ed776) config: Add option for linear image readback ### 📊 Changes **10 files changed** (+106 additions, -16 deletions) <details> <summary>View changed files</summary> 📝 `src/common/config.cpp` (+10 -1) 📝 `src/common/config.h` (+1 -0) 📝 `src/video_core/amdgpu/liverpool.cpp` (+1 -2) 📝 `src/video_core/buffer_cache/buffer_cache.h` (+1 -1) 📝 `src/video_core/renderer_vulkan/vk_rasterizer.cpp` (+12 -4) 📝 `src/video_core/renderer_vulkan/vk_rasterizer.h` (+1 -1) 📝 `src/video_core/renderer_vulkan/vk_scheduler.cpp` (+9 -4) 📝 `src/video_core/renderer_vulkan/vk_scheduler.h` (+3 -0) 📝 `src/video_core/texture_cache/texture_cache.cpp` (+59 -2) 📝 `src/video_core/texture_cache/texture_cache.h` (+9 -1) </details> ### 📄 Description @AboMedoz mentioned to me that @Ruahh reported a softlock in The Last Guardian regarding water physics, this PR fixes that. Turns out it creates a bunch of images with linear tiling and expects to read them on the CPU. I've also noticed this improves the post processing of the game, but requires more testing. Doing proper read protection on the texture cache is much more difficult than buffer cache, as images can overlap with each other, so it triggers false positives a bunch of times. Also images generally occupy more space and are more difficult to download a per page basis, as there is no fine grained tracking. So this PR simply downloads them in async way to avoid dealing with those problems and still get the data to the CPU, even if a frame late. I'll probably add an option for this too, even if it should have much less perf impact compared to buffer readbacks. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 22:03:12 +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#3302
No description provided.