diff --git a/rpcs3/Emu/RSX/Common/texture_cache.h b/rpcs3/Emu/RSX/Common/texture_cache.h index d85f9c5c7d..11c88cba56 100644 --- a/rpcs3/Emu/RSX/Common/texture_cache.h +++ b/rpcs3/Emu/RSX/Common/texture_cache.h @@ -143,6 +143,7 @@ namespace rsx std::vector sections_to_copy; texture_channel_remap_t remap; deferred_request_command op = deferred_request_command::nop; + u32 external_ref_addr = 0; u16 x = 0; u16 y = 0; @@ -274,6 +275,7 @@ namespace rsx // Blit op is a semantic variant of the copy and atlas ops. // We can simply reuse the atlas handler for this for now, but this allows simplification. external_subresource_desc.op = deferred_request_command::blit_image_static; + external_subresource_desc.external_ref_addr = cpy.base_addr; } } } @@ -1666,13 +1668,18 @@ namespace rsx { sections[n] = { - desc.external_handle, - surface_transform::coordinate_transform, - 0, - 0, static_cast(desc.slice_h * n), - 0, 0, n, - desc.width, desc.height, - desc.width, desc.height + .src = desc.external_handle, + .xform = surface_transform::coordinate_transform, + .level = 0, + .src_x = 0, + .src_y = static_cast(desc.slice_h * n), + .dst_x = 0, + .dst_y = 0, + .dst_z = n, + .src_w = desc.width, + .src_h = desc.height, + .dst_w = desc.width, + .dst_h = desc.height }; } @@ -1692,13 +1699,18 @@ namespace rsx { sections[n] = { - desc.external_handle, - surface_transform::coordinate_transform, - 0, - 0, static_cast(desc.slice_h * n), - 0, 0, n, - desc.width, desc.height, - desc.width, desc.height + .src = desc.external_handle, + .xform = surface_transform::coordinate_transform, + .level = 0, + .src_x = 0, + .src_y = static_cast(desc.slice_h * n), + .dst_x = 0, + .dst_y = 0, + .dst_z = n, + .src_w = desc.width, + .src_h = desc.height, + .dst_w = desc.width, + .dst_h = desc.height }; } diff --git a/rpcs3/Emu/RSX/Common/texture_cache_helpers.h b/rpcs3/Emu/RSX/Common/texture_cache_helpers.h index 58cda5f0a8..ae7ba000ec 100644 --- a/rpcs3/Emu/RSX/Common/texture_cache_helpers.h +++ b/rpcs3/Emu/RSX/Common/texture_cache_helpers.h @@ -20,6 +20,7 @@ namespace rsx { image_resource_type src; flags32_t xform; + u32 base_addr; u8 level; u16 src_x; u16 src_y; @@ -315,16 +316,19 @@ namespace rsx out.push_back ({ - section.surface->get_surface(rsx::surface_access::transfer_read), - surface_transform::identity, - 0, - static_cast(src_x), - static_cast(src_y), - static_cast(dst_x), - static_cast(dst_y), - slice, - src_width, src_height, - dst_width, dst_height + .src = section.surface->get_surface(rsx::surface_access::transfer_read), + .xform = surface_transform::identity, + .base_addr = section.base_addr, + .level = 0, + .src_x = static_cast(src_x), + .src_y = static_cast(src_y), + .dst_x = static_cast(dst_x), + .dst_y = static_cast(dst_y), + .dst_z = slice, + .src_w = src_width, + .src_h = src_height, + .dst_w = dst_width, + .dst_h = dst_height }); }; @@ -378,36 +382,37 @@ namespace rsx out.push_back ({ - section->get_raw_texture(), - surface_transform::identity, - 0, - static_cast(src_offset.x), // src.x - static_cast(src_offset.y), // src.y - _dst_x, // dst.x - _dst_y, // dst.y - slice, - src_w, - height, - _dst_w, - _dst_h + .src = section->get_raw_texture(), + .xform = surface_transform::identity, + .base_addr = address, + .level = 0, + .src_x = static_cast(src_offset.x), // src.x + .src_y = static_cast(src_offset.y), // src.y + .dst_x = _dst_x, // dst.x + .dst_y = _dst_y, // dst.y + .dst_z = slice, + .src_w = src_w, + .src_h = height, + .dst_w = _dst_w, + .dst_h = _dst_h }); } else { out.push_back ({ - section->get_raw_texture(), - surface_transform::identity, - 0, - static_cast(src_offset.x), // src.x - static_cast(src_offset.y), // src.y - static_cast(dst_offset.x), // dst.x - static_cast(dst_y - dst_slice_begin), // dst.y - 0, - src_w, - height, - dst_w, - height + .src = section->get_raw_texture(), + .xform = surface_transform::identity, + .level = 0, + .src_x = static_cast(src_offset.x), // src.x + .src_y = static_cast(src_offset.y), // src.y + .dst_x = static_cast(dst_offset.x), // dst.x + .dst_y = static_cast(dst_y - dst_slice_begin), // dst.y + .dst_z = 0, + .src_w = src_w, + .src_h = height, + .dst_w = dst_w, + .dst_h = height }); } }; @@ -561,6 +566,7 @@ namespace rsx // First, we convert this descriptor to a copy descriptor desc.external_subresource_desc.external_handle = section.src; + desc.external_subresource_desc.external_ref_addr = section.base_addr; // Now apply conversion convert_image_copy_to_clip_descriptor( @@ -828,12 +834,14 @@ namespace rsx { if (level.image_handle) { - copy_region_descriptor_type mip{}; - mip.src = level.image_handle->image(); - mip.xform = surface_transform::coordinate_transform; - mip.level = mipmap_level; - mip.dst_w = attr.width; - mip.dst_h = attr.height; + copy_region_descriptor_type mip + { + .src = level.image_handle->image(), + .xform = surface_transform::coordinate_transform, + .level = mipmap_level, + .dst_w = attr.width, + .dst_h = attr.height + }; // "Fast" framebuffer results are a perfect match for attr so we do not store transfer sizes // Calculate transfer dimensions from attr @@ -856,18 +864,21 @@ namespace rsx case deferred_request_command::copy_image_dynamic: case deferred_request_command::copy_image_static: { - copy_region_descriptor_type mip{}; - mip.src = level.external_subresource_desc.external_handle; - mip.xform = surface_transform::coordinate_transform; - mip.level = mipmap_level; - mip.dst_w = attr.width; - mip.dst_h = attr.height; + copy_region_descriptor_type mip + { + .src = level.external_subresource_desc.external_handle, + .xform = surface_transform::coordinate_transform, + .level = mipmap_level, - // 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; + // NOTE: gather_texture_slices pre-applies resolution scaling + .src_x = level.external_subresource_desc.x, + .src_y = level.external_subresource_desc.y, + .src_w = level.external_subresource_desc.width, + .src_h = level.external_subresource_desc.height, + + .dst_w = attr.width, + .dst_h = attr.height + }; sections.push_back(mip); break; diff --git a/rpcs3/Emu/RSX/GL/GLTextureCache.cpp b/rpcs3/Emu/RSX/GL/GLTextureCache.cpp index edf113f129..e5a2888708 100644 --- a/rpcs3/Emu/RSX/GL/GLTextureCache.cpp +++ b/rpcs3/Emu/RSX/GL/GLTextureCache.cpp @@ -161,11 +161,14 @@ namespace gl { std::vector region = {{ - src, - rsx::surface_transform::coordinate_transform, - 0, - x, y, 0, 0, 0, - width, height, width, height + .src = src, + .xform = rsx::surface_transform::coordinate_transform, + .src_x = x, + .src_y = y, + .src_w = width, + .src_h = height, + .dst_w = width, + .dst_h = height }}; copy_transfer_regions_impl(cmd, dst, region); diff --git a/rpcs3/Emu/RSX/GL/GLTextureCache.h b/rpcs3/Emu/RSX/GL/GLTextureCache.h index 9d60684d2a..aee6909a1b 100644 --- a/rpcs3/Emu/RSX/GL/GLTextureCache.h +++ b/rpcs3/Emu/RSX/GL/GLTextureCache.h @@ -591,11 +591,12 @@ namespace gl { std::vector region = {{ - src, - rsx::surface_transform::identity, - 0, - 0, 0, 0, 0, 0, - width, height, width, height + .src = src, + .xform = rsx::surface_transform::identity, + .src_w = width, + .src_h = height, + .dst_w = width, + .dst_h = height }}; copy_transfer_regions_impl(cmd, dst->image(), region); diff --git a/rpcs3/Emu/RSX/VK/VKTextureCache.cpp b/rpcs3/Emu/RSX/VK/VKTextureCache.cpp index 5b8c30c7bc..c732428daf 100644 --- a/rpcs3/Emu/RSX/VK/VKTextureCache.cpp +++ b/rpcs3/Emu/RSX/VK/VKTextureCache.cpp @@ -612,11 +612,14 @@ namespace vk { std::vector region = { { - source, - rsx::surface_transform::coordinate_transform, - 0, - x, y, 0, 0, 0, - w, h, w, h + .src = source, + .xform = rsx::surface_transform::coordinate_transform, + .src_x = x, + .src_y = y, + .src_w = w, + .src_h = h, + .dst_w = w, + .dst_h = h } }; vk::change_image_layout(cmd, image.get(), VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL); @@ -800,11 +803,12 @@ namespace vk { std::vector region = { { - src, - rsx::surface_transform::identity, - 0, - 0, 0, 0, 0, 0, - width, height, width, height + .src = src, + .xform = rsx::surface_transform::identity, + .src_w = width, + .src_h = height, + .dst_w = width, + .dst_h = height } }; auto dst = dst_view->image();