Skip to content

Commit d267b42

Browse files
committed
rsx: Don't overfit memory allocations in system RAM
- Avoids a lot of faults that would trigger slow flush operations when CELL is touching memory outside of the range we care about.
1 parent 7262633 commit d267b42

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

rpcs3/Emu/RSX/Common/texture_cache_helpers.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,14 @@ namespace rsx
232232

233233
if (src_is_render_target)
234234
{
235-
// Attempt to optimize...
236-
if (dst_dimensions.width == 1280 || dst_dimensions.width == 2560) [[likely]]
235+
// Attempt to optimize for performance...
236+
if (get_location(dst_range.start) == CELL_GCM_LOCATION_MAIN)
237+
{
238+
// Don't guess when working with main memory
239+
const auto min_fitted_height = utils::aligned_div(dst_range.length(), dst_pitch);
240+
dst_dimensions.height = std::min(dst_dimensions.height, min_fitted_height);
241+
}
242+
else if (dst_dimensions.width == 1280 || dst_dimensions.width == 2560)
237243
{
238244
// Optimizations table based on common width/height pairings. If we guess wrong, the upload resolver will fix it anyway
239245
// TODO: Add more entries based on empirical data

0 commit comments

Comments
 (0)