mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2026-04-26 00:05:58 +03:00
[PR #3700] [MERGED] image_info: Fix guest size calculation for linear render targets #3665
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#3665
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/3700
Author: @raphaelthegreat
Created: 10/3/2025
Status: ✅ Merged
Merged: 10/4/2025
Merged by: @georgemoralis
Base:
main← Head:linear-align📝 Commits (1)
bb11184image_info: Fix guest size calculation for linear render targets📊 Changes
2 files changed (+21 additions, -7 deletions)
View changed files
📝
src/video_core/texture_cache/image_info.cpp(+18 -7)📝
src/video_core/texture_cache/texture_cache.cpp(+3 -0)📄 Description
The linear aligned tile mode doesn't require image height to be tile aligned only the pitch per addrlib
This is an issue with render targets because the registers that hold size information store it in units of tiles, so using these makes the guest size appear larger than it actually is. For example a 16128x1 RGBA32 render target should have a size of 258048 bytes (16128 * 16), but the color buffer registers will report 2064384 bytes (16128 * 8 * 16) which would be correct if the height were to be padded to tile dimension (8). The fix is manually computing the size if the render target is not tiled. Also removed handling of ArrayLinearGeneral because this doesn't align at all, so the current code is wrong for it anyway and seems entirely unused.
This should resolve some "Encountered unresolvable image overlap with equal memory address." asserts like this and might also fix random crashes when readback linear images is enabled, because with previous code it could overwrite additional memory, especially if the image size was 1x1 which isn't uncommon
This issue was reported to me by @Xcedf who also provided needed debugging information
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.