diff --git a/rpcs3/Emu/RSX/Common/texture_cache.h b/rpcs3/Emu/RSX/Common/texture_cache.h index e9af09670d..5ede03b59b 100644 --- a/rpcs3/Emu/RSX/Common/texture_cache.h +++ b/rpcs3/Emu/RSX/Common/texture_cache.h @@ -475,7 +475,7 @@ namespace rsx rsx::texture_upload_context context, rsx::texture_dimension_extended type, bool swizzled, component_order swizzle_flags, rsx::flags32_t flags) = 0; virtual section_storage_type* upload_image_from_cpu(commandbuffer_type&, const address_range &rsx_range, u16 width, u16 height, u16 depth, u16 mipmaps, u32 pitch, u32 gcm_format, texture_upload_context context, const std::vector& subresource_layout, rsx::texture_dimension_extended type, bool swizzled) = 0; - virtual section_storage_type* create_nul_section(commandbuffer_type&, const address_range &rsx_range, bool memory_load) = 0; + virtual section_storage_type* create_nul_section(commandbuffer_type&, const address_range &rsx_range, const image_section_attributes_t& attrs, bool memory_load) = 0; virtual void set_component_order(section_storage_type& section, u32 gcm_format, component_order expected) = 0; virtual void insert_texture_barrier(commandbuffer_type&, image_storage_type* tex, bool strong_ordering = true) = 0; virtual image_view_type generate_cubemap_from_images(commandbuffer_type&, u32 gcm_format, u16 size, const std::vector& sources, const texture_channel_remap_t& remap_vector) = 0; @@ -2684,7 +2684,7 @@ namespace rsx else { // Surface exists in local memory. - use_null_region = (is_copy_op && !is_format_convert && !src_is_tiled); + use_null_region = (is_copy_op && !is_format_convert); // Invalidate surfaces in range. Sample tests should catch overlaps in theory. m_rtts.invalidate_range(utils::address_range::start_length(dst_address, dst.pitch* dst_h)); @@ -3215,7 +3215,13 @@ namespace rsx force_dma_load = true; } - cached_dest = create_nul_section(cmd, rsx_range, force_dma_load); + const image_section_attributes_t attrs = + { + .pitch = dst.pitch, + .width = static_cast(dst_dimensions.width), + .height = static_cast(dst_dimensions.height) + }; + cached_dest = create_nul_section(cmd, rsx_range, attrs, force_dma_load); } else { diff --git a/rpcs3/Emu/RSX/Common/texture_cache_utils.h b/rpcs3/Emu/RSX/Common/texture_cache_utils.h index 20f83c0c4b..79ad1b610e 100644 --- a/rpcs3/Emu/RSX/Common/texture_cache_utils.h +++ b/rpcs3/Emu/RSX/Common/texture_cache_utils.h @@ -1171,7 +1171,14 @@ namespace rsx notify_range_valid(); } + void create_dma_only(u16 width, u16 height, u32 pitch) + { + this->width = width; + this->height = height; + this->rsx_pitch = pitch; + set_context(rsx::texture_upload_context::dma); + } /** * Destroyed Flag diff --git a/rpcs3/Emu/RSX/GL/GLTextureCache.h b/rpcs3/Emu/RSX/GL/GLTextureCache.h index 8ec9f5c2d5..de5084bb2c 100644 --- a/rpcs3/Emu/RSX/GL/GLTextureCache.h +++ b/rpcs3/Emu/RSX/GL/GLTextureCache.h @@ -708,14 +708,18 @@ namespace gl return &cached; } - cached_texture_section* create_nul_section(gl::command_context& /*cmd*/, const utils::address_range& rsx_range, bool /*memory_load*/) override + cached_texture_section* create_nul_section( + gl::command_context& /*cmd*/, + const utils::address_range& rsx_range, + const rsx::image_section_attributes_t& attrs, + bool /*memory_load*/) override { auto& cached = *find_cached_texture(rsx_range, { .gcm_format = RSX_GCM_FORMAT_IGNORED }, true, false, false); ensure(!cached.is_locked()); // Prepare section cached.reset(rsx_range); - cached.set_context(rsx::texture_upload_context::dma); + cached.create_dma_only(attrs.width, attrs.height, attrs.pitch); cached.set_dirty(false); no_access_range = cached.get_min_max(no_access_range, rsx::section_bounds::locked_range); diff --git a/rpcs3/Emu/RSX/VK/VKTextureCache.cpp b/rpcs3/Emu/RSX/VK/VKTextureCache.cpp index f94c901484..9255e84237 100644 --- a/rpcs3/Emu/RSX/VK/VKTextureCache.cpp +++ b/rpcs3/Emu/RSX/VK/VKTextureCache.cpp @@ -984,14 +984,18 @@ namespace vk return ®ion; } - cached_texture_section* texture_cache::create_nul_section(vk::command_buffer& /*cmd*/, const utils::address_range& rsx_range, bool memory_load) + cached_texture_section* texture_cache::create_nul_section( + vk::command_buffer& /*cmd*/, + const utils::address_range& rsx_range, + const rsx::image_section_attributes_t& attrs, + bool memory_load) { auto& region = *find_cached_texture(rsx_range, { .gcm_format = RSX_GCM_FORMAT_IGNORED }, true, false, false); ensure(!region.is_locked()); // Prepare section region.reset(rsx_range); - region.set_context(rsx::texture_upload_context::dma); + region.create_dma_only(attrs.width, attrs.height, attrs.pitch); region.set_dirty(false); region.set_unpack_swap_bytes(true); diff --git a/rpcs3/Emu/RSX/VK/VKTextureCache.h b/rpcs3/Emu/RSX/VK/VKTextureCache.h index 76903240fa..2ff0b5b447 100644 --- a/rpcs3/Emu/RSX/VK/VKTextureCache.h +++ b/rpcs3/Emu/RSX/VK/VKTextureCache.h @@ -482,7 +482,7 @@ namespace vk cached_texture_section* create_new_texture(vk::command_buffer& cmd, const utils::address_range& rsx_range, u16 width, u16 height, u16 depth, u16 mipmaps, u32 pitch, u32 gcm_format, rsx::texture_upload_context context, rsx::texture_dimension_extended type, bool swizzled, rsx::component_order swizzle_flags, rsx::flags32_t flags) override; - cached_texture_section* create_nul_section(vk::command_buffer& cmd, const utils::address_range& rsx_range, bool memory_load) override; + cached_texture_section* create_nul_section(vk::command_buffer& cmd, const utils::address_range& rsx_range, const rsx::image_section_attributes_t& attrs, bool memory_load) override; cached_texture_section* upload_image_from_cpu(vk::command_buffer& cmd, const utils::address_range& rsx_range, u16 width, u16 height, u16 depth, u16 mipmaps, u32 pitch, u32 gcm_format, rsx::texture_upload_context context, const std::vector& subresource_layout, rsx::texture_dimension_extended type, bool swizzled) override;