From 83d818d96f788db9f6d1a34d6e6f863e80f36be6 Mon Sep 17 00:00:00 2001 From: kd-11 Date: Mon, 15 Jun 2020 22:06:52 +0300 Subject: [PATCH] rsx: Improve mipmap gathering - Account for source offsets when grabbing subregions - Scale input accordingly when sourcing from fbo in all paths --- rpcs3/Emu/RSX/Common/texture_cache_helpers.h | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/rpcs3/Emu/RSX/Common/texture_cache_helpers.h b/rpcs3/Emu/RSX/Common/texture_cache_helpers.h index 22f88ee665..63f34dfb87 100644 --- a/rpcs3/Emu/RSX/Common/texture_cache_helpers.h +++ b/rpcs3/Emu/RSX/Common/texture_cache_helpers.h @@ -719,7 +719,9 @@ namespace rsx mip.dst_w = attr.width; mip.dst_h = attr.height; - if (level.upload_context == rsx::texture_upload_context::framebuffer_storage) + // "Fast" framebuffer results are a perfect match for attr so we do not store transfer sizes + // Calculate transfer dimensions from attr + if (level.upload_context == rsx::texture_upload_context::framebuffer_storage) [[likely]] { mip.src_w = rsx::apply_resolution_scale(attr.width, true); mip.src_h = rsx::apply_resolution_scale(attr.height, true); @@ -734,7 +736,6 @@ namespace rsx } else { - switch (level.external_subresource_desc.op) { case deferred_request_command::copy_image_dynamic: @@ -744,10 +745,15 @@ namespace rsx mip.src = level.external_subresource_desc.external_handle; mip.xform = surface_transform::coordinate_transform; mip.level = mipmap_level; - mip.src_w = level.external_subresource_desc.width; - mip.src_h = level.external_subresource_desc.height; mip.dst_w = attr.width; mip.dst_h = attr.height; + + // NOTE: gather_texture_slices pre-applies resolution scaling + mip.src_x = level.external_subresource_desc.x; + mip.src_y = level.external_subresource_desc.y; + mip.src_w = level.external_subresource_desc.width; + mip.src_h = level.external_subresource_desc.height; + sections.push_back(mip); break; }