rsx: Fix RSX tiling when using optimized DMA views

This commit is contained in:
kd-11 2023-12-31 23:55:15 +03:00 committed by kd-11
parent 4068423c48
commit 6c33c38c08
5 changed files with 29 additions and 8 deletions

View file

@ -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; 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, 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<rsx::subresource_layout>& subresource_layout, rsx::texture_dimension_extended type, bool swizzled) = 0; const std::vector<rsx::subresource_layout>& 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 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 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<copy_region_descriptor>& sources, const texture_channel_remap_t& remap_vector) = 0; virtual image_view_type generate_cubemap_from_images(commandbuffer_type&, u32 gcm_format, u16 size, const std::vector<copy_region_descriptor>& sources, const texture_channel_remap_t& remap_vector) = 0;
@ -2684,7 +2684,7 @@ namespace rsx
else else
{ {
// Surface exists in local memory. // 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. // 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)); 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; 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<u16>(dst_dimensions.width),
.height = static_cast<u16>(dst_dimensions.height)
};
cached_dest = create_nul_section(cmd, rsx_range, attrs, force_dma_load);
} }
else else
{ {

View file

@ -1171,7 +1171,14 @@ namespace rsx
notify_range_valid(); 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 * Destroyed Flag

View file

@ -708,14 +708,18 @@ namespace gl
return &cached; 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); auto& cached = *find_cached_texture(rsx_range, { .gcm_format = RSX_GCM_FORMAT_IGNORED }, true, false, false);
ensure(!cached.is_locked()); ensure(!cached.is_locked());
// Prepare section // Prepare section
cached.reset(rsx_range); 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); cached.set_dirty(false);
no_access_range = cached.get_min_max(no_access_range, rsx::section_bounds::locked_range); no_access_range = cached.get_min_max(no_access_range, rsx::section_bounds::locked_range);

View file

@ -984,14 +984,18 @@ namespace vk
return &region; return &region;
} }
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); auto& region = *find_cached_texture(rsx_range, { .gcm_format = RSX_GCM_FORMAT_IGNORED }, true, false, false);
ensure(!region.is_locked()); ensure(!region.is_locked());
// Prepare section // Prepare section
region.reset(rsx_range); 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_dirty(false);
region.set_unpack_swap_bytes(true); region.set_unpack_swap_bytes(true);

View file

@ -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, 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; 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, 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<rsx::subresource_layout>& subresource_layout, rsx::texture_dimension_extended type, bool swizzled) override; rsx::texture_upload_context context, const std::vector<rsx::subresource_layout>& subresource_layout, rsx::texture_dimension_extended type, bool swizzled) override;