[PR #3261] [MERGED] texture_cache: Clamp buffer image height to microtile height #3344

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

📋 Pull Request Information

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

Base: mainHead: mip-height


📝 Commits (2)

  • e040721 texture_cache: Clamp buffer image height to microtile height
  • 354cdff Merge branch 'main' into mip-height

📊 Changes

2 files changed (+12 additions, -13 deletions)

View changed files

📝 src/video_core/buffer_cache/buffer_cache.cpp (+3 -3)
📝 src/video_core/texture_cache/texture_cache.cpp (+9 -10)

📄 Description

When 2D array textures are used that have mipmaps with dimentions less than a tile (< 8) the size calculation will pad both the pitch and the height of the slice to microtile dimentions. The texture cache upload code used the correct pitch, but not the aligned height. This caused issues as some inbetween slices would receive the padding image data and not the intended, which at best will look the same and at worst would poison the image with NaNs.

Fix this by clamping the mip height to microtile height. This should work for macrotile images as well, since the lower mipmaps are downgraded to microtiled tiling


🔄 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/3261 **Author:** [@raphaelthegreat](https://github.com/raphaelthegreat) **Created:** 7/16/2025 **Status:** ✅ Merged **Merged:** 7/18/2025 **Merged by:** [@georgemoralis](https://github.com/georgemoralis) **Base:** `main` ← **Head:** `mip-height` --- ### 📝 Commits (2) - [`e040721`](https://github.com/shadps4-emu/shadPS4/commit/e0407212406c37eef441b3513dbe37afbf9f6492) texture_cache: Clamp buffer image height to microtile height - [`354cdff`](https://github.com/shadps4-emu/shadPS4/commit/354cdfffe3c37ab1348158209d2e96f058543ce3) Merge branch 'main' into mip-height ### 📊 Changes **2 files changed** (+12 additions, -13 deletions) <details> <summary>View changed files</summary> 📝 `src/video_core/buffer_cache/buffer_cache.cpp` (+3 -3) 📝 `src/video_core/texture_cache/texture_cache.cpp` (+9 -10) </details> ### 📄 Description When 2D array textures are used that have mipmaps with dimentions less than a tile (< 8) the size calculation will pad both the pitch and the height of the slice to microtile dimentions. The texture cache upload code used the correct pitch, but not the aligned height. This caused issues as some inbetween slices would receive the padding image data and not the intended, which at best will look the same and at worst would poison the image with NaNs. Fix this by clamping the mip height to microtile height. This should work for macrotile images as well, since the lower mipmaps are downgraded to microtiled tiling --- <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:21 +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#3344
No description provided.