[PR #3167] [MERGED] Avoid clearing depth on partial HTILE writes #3278

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

📋 Pull Request Information

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

Base: mainHead: htile-noclear


📝 Commits (2)

  • e2dd2c2 vk_rasterizer: Avoid full depth clear in case of partial HTILE update
  • 9bec21b resource_tracking: Mark image as written when its used with atomics

📊 Changes

5 files changed (+28 additions, -30 deletions)

View changed files

📝 src/shader_recompiler/info.h (+1 -0)
📝 src/shader_recompiler/ir/passes/resource_tracking_pass.cpp (+8 -3)
📝 src/video_core/renderer_vulkan/vk_rasterizer.cpp (+2 -1)
📝 src/video_core/texture_cache/image.h (+3 -4)
📝 src/video_core/texture_cache/texture_cache.cpp (+14 -22)

📄 Description

This fixes the shadows on Driveclub (CUSA00093)

main PR
bad_shadows3 proper_shadows4

There is a shader that performs some bit operations on HTILE, but not a full clear which got mis-recognized as a clear. According to mesa this fetches the upper bit of SR1 and clears/sets zmask depending on that bit. I'm not sure what it is, but doesn't appear to be a depth or stencil clear as it leaves zmin/zmax and sr0/sr1 untouched.

htile | ((1u & (~bitfieldExtract(htile, 7, 1))) * 15))

🔄 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/3167 **Author:** [@raphaelthegreat](https://github.com/raphaelthegreat) **Created:** 6/28/2025 **Status:** ✅ Merged **Merged:** 6/28/2025 **Merged by:** [@georgemoralis](https://github.com/georgemoralis) **Base:** `main` ← **Head:** `htile-noclear` --- ### 📝 Commits (2) - [`e2dd2c2`](https://github.com/shadps4-emu/shadPS4/commit/e2dd2c282c66377e000e5663f1bc24efe801640e) vk_rasterizer: Avoid full depth clear in case of partial HTILE update - [`9bec21b`](https://github.com/shadps4-emu/shadPS4/commit/9bec21bf94069fbbe12eafdda5e45dbeb8454bb0) resource_tracking: Mark image as written when its used with atomics ### 📊 Changes **5 files changed** (+28 additions, -30 deletions) <details> <summary>View changed files</summary> 📝 `src/shader_recompiler/info.h` (+1 -0) 📝 `src/shader_recompiler/ir/passes/resource_tracking_pass.cpp` (+8 -3) 📝 `src/video_core/renderer_vulkan/vk_rasterizer.cpp` (+2 -1) 📝 `src/video_core/texture_cache/image.h` (+3 -4) 📝 `src/video_core/texture_cache/texture_cache.cpp` (+14 -22) </details> ### 📄 Description This fixes the shadows on Driveclub (CUSA00093) | main | PR | | ------------- | ------------- | | ![bad_shadows3](https://github.com/user-attachments/assets/3cd59c17-c260-4e92-93ac-44f678cd50d8) | ![proper_shadows4](https://github.com/user-attachments/assets/66f654f6-0ea0-4e40-904e-3c28f601c142) | There is a shader that performs some bit operations on HTILE, but not a full clear which got mis-recognized as a clear. According to [mesa](https://github.com/chaotic-cx/mesa-mirror/blob/646977348ba49630515f0da1542b77ef4919d68e/src/amd/vulkan/meta/radv_meta_clear.c#L661) this fetches the upper bit of SR1 and clears/sets zmask depending on that bit. I'm not sure what it is, but doesn't appear to be a depth or stencil clear as it leaves zmin/zmax and sr0/sr1 untouched. ```glsl htile | ((1u & (~bitfieldExtract(htile, 7, 1))) * 15)) ``` --- <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:06 +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#3278
No description provided.