mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2026-04-27 00:36:00 +03:00
[PR #3079] [MERGED] texture_cache: Implement color<->depth copies #3203
Labels
No labels
Bloodborne
bug
contributor wanted
documentation
enhancement
frontend
good first issue
help wanted
linux
pull-request
question
release
verification progress
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/shadPS4#3203
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
📋 Pull Request Information
Original PR: https://github.com/shadps4-emu/shadPS4/pull/3079
Author: @raphaelthegreat
Created: 6/10/2025
Status: ✅ Merged
Merged: 6/11/2025
Merged by: @squidbus
Base:
main← Head:depth-color-copy📝 Commits (4)
2b3eef0texture_cache: Implement color to depth copies and vise versa2554ea5ir_passes: Adjust shared memory barrier pass to cover more cases78de61etexture_cache: Remove unused code3bf38d6review comment📊 Changes
7 files changed (+157 additions, -54 deletions)
View changed files
📝
src/shader_recompiler/ir/passes/shared_memory_barrier_pass.cpp(+23 -12)📝
src/video_core/buffer_cache/buffer_cache.cpp(+6 -4)📝
src/video_core/buffer_cache/buffer_cache.h(+16 -7)📝
src/video_core/renderer_vulkan/vk_rasterizer.cpp(+2 -2)📝
src/video_core/texture_cache/image.cpp(+96 -17)📝
src/video_core/texture_cache/image.h(+2 -1)📝
src/video_core/texture_cache/texture_cache.cpp(+12 -11)📄 Description
This fixes the skybox clouds covering everything in the screen in Driveclub (CUSA00093).
The game uses a compute shader with the depth buffer as input and generates a R32 image based on it. Later when rendering the clouds texture it binds that image as a D32 target with writes disabled to control which ones are rendered. The code for handling depth and color overlaps already existed, but the actual copy was unimplemented so it just discarded the old color image and resulted in empty depth buffer, allowing all clouds to render and overlap the screen. The copy is implemented here by using an intermediate buffer, as vulkan doesn't allow image copies with different aspects.
The compute shader that generated the R32 texture also had an issue with divergence on NVIDIA which I also fixed here while at it. The main shader is covered by an if condition, so all blocks had branch_depth = 1, which prevented barrier insertion. To address this, the branch_depth variable is replaced with a divergence_depth one which is the same but only increments when the branch has a divergent condition.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.