From ad00c442314177b631222260d7b159c8ed4b5cfc Mon Sep 17 00:00:00 2001 From: kd-11 Date: Wed, 3 Nov 2021 00:19:03 +0300 Subject: [PATCH] rsx: Configure pitch correctly for pitch-zero textures (1D) --- rpcs3/Emu/RSX/Common/TextureUtils.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/rpcs3/Emu/RSX/Common/TextureUtils.cpp b/rpcs3/Emu/RSX/Common/TextureUtils.cpp index 09a52faffb..3c59ab6d35 100644 --- a/rpcs3/Emu/RSX/Common/TextureUtils.cpp +++ b/rpcs3/Emu/RSX/Common/TextureUtils.cpp @@ -560,7 +560,7 @@ std::vector get_subresources_layout_impl(const RsxTextu std::tie(h, depth, layer) = get_height_depth_layer(texture); const auto format = texture.format() & ~(CELL_GCM_TEXTURE_LN | CELL_GCM_TEXTURE_UN); - const auto pitch = texture.pitch(); + auto pitch = texture.pitch(); const u32 texaddr = rsx::get_address(texture.offset(), texture.location()); auto pixels = vm::_ptr(texaddr); @@ -570,17 +570,18 @@ std::vector get_subresources_layout_impl(const RsxTextu if (!is_swizzled) { - if (pitch) [[likely]] + if (const auto packed_pitch = rsx::get_format_packed_pitch(format, w, has_border, false); pitch < packed_pitch) [[unlikely]] { - if (pitch < rsx::get_format_packed_pitch(format, w, has_border, false)) + if (pitch) { const u32 real_width_in_block = pitch / rsx::get_format_block_size_in_bytes(format); w = std::max(real_width_in_block * rsx::get_format_block_size_in_texel(format), 1); } - } - else - { - h = depth = 1; + else + { + h = depth = 1; + pitch = packed_pitch; + } } }