rsx/texture_cache: Fix 'AA' scaling hack and restore collection template selection

This commit is contained in:
kd-11 2019-02-26 13:31:32 +03:00 committed by kd-11
commit 563e205a72
3 changed files with 19 additions and 6 deletions

View file

@ -1628,8 +1628,8 @@ namespace rsx
const auto h = std::min(section_end, slice_end) - section.dst_y; const auto h = std::min(section_end, slice_end) - section.dst_y;
auto src_width = rsx::apply_resolution_scale(section.width, true); auto src_width = rsx::apply_resolution_scale(section.width, true);
auto src_height = rsx::apply_resolution_scale(h, true); auto src_height = rsx::apply_resolution_scale(h, true);
auto dst_width = src_width; auto dst_width = u16(src_width * scale_x);
auto dst_height = src_height; auto dst_height = u16(src_height * scale_y);
if (scale_x > 1.f) if (scale_x > 1.f)
{ {
@ -1639,13 +1639,13 @@ namespace rsx
if (limit_x > slice_w) if (limit_x > slice_w)
{ {
dst_width = (limit_x - dst_x); dst_width = (slice_w - dst_x);
src_width = dst_width / scale_x; src_width = dst_width / scale_x;
} }
if (limit_y > slice_h) if (limit_y > slice_h)
{ {
dst_height = (limit_y - dst_y); dst_height = (slice_h - dst_y);
src_height = dst_height / scale_y; src_height = dst_height / scale_y;
} }
} }

View file

@ -762,6 +762,11 @@ namespace gl
gl::texture* get_template_from_collection_impl(const std::vector<copy_region_descriptor>& sections_to_transfer) const gl::texture* get_template_from_collection_impl(const std::vector<copy_region_descriptor>& sections_to_transfer) const
{ {
if (LIKELY(sections_to_transfer.size() == 1))
{
return sections_to_transfer.front().src;
}
gl::texture* result = nullptr; gl::texture* result = nullptr;
for (const auto &section : sections_to_transfer) for (const auto &section : sections_to_transfer)
{ {
@ -854,7 +859,9 @@ namespace gl
gl::texture_view* generate_atlas_from_images(gl::command_context& cmd, u32 gcm_format, u16 width, u16 height, const std::vector<copy_region_descriptor>& sections_to_copy, gl::texture_view* generate_atlas_from_images(gl::command_context& cmd, u32 gcm_format, u16 width, u16 height, const std::vector<copy_region_descriptor>& sections_to_copy,
const texture_channel_remap_t& remap_vector) override const texture_channel_remap_t& remap_vector) override
{ {
auto result = create_temporary_subresource_impl(nullptr, GL_NONE, GL_TEXTURE_2D, gcm_format, 0, 0, width, height, remap_vector, false); auto _template = get_template_from_collection_impl(sections_to_copy);
const GLenum ifmt = _template ? (GLenum)_template->get_internal_format() : GL_NONE;
auto result = create_temporary_subresource_impl(_template, ifmt, GL_TEXTURE_2D, gcm_format, 0, 0, width, height, remap_vector, false);
copy_transfer_regions_impl(cmd, result->image(), sections_to_copy); copy_transfer_regions_impl(cmd, result->image(), sections_to_copy);
return result; return result;

View file

@ -590,6 +590,11 @@ namespace vk
vk::image* get_template_from_collection_impl(const std::vector<copy_region_descriptor>& sections_to_transfer) const vk::image* get_template_from_collection_impl(const std::vector<copy_region_descriptor>& sections_to_transfer) const
{ {
if (LIKELY(sections_to_transfer.size() == 1))
{
return sections_to_transfer.front().src;
}
vk::image* result = nullptr; vk::image* result = nullptr;
for (const auto &section : sections_to_transfer) for (const auto &section : sections_to_transfer)
{ {
@ -804,7 +809,8 @@ namespace vk
vk::image_view* generate_atlas_from_images(vk::command_buffer& cmd, u32 gcm_format, u16 width, u16 height, vk::image_view* generate_atlas_from_images(vk::command_buffer& cmd, u32 gcm_format, u16 width, u16 height,
const std::vector<copy_region_descriptor>& sections_to_copy, const texture_channel_remap_t& remap_vector) override const std::vector<copy_region_descriptor>& sections_to_copy, const texture_channel_remap_t& remap_vector) override
{ {
auto result = create_temporary_subresource_view_impl(cmd, nullptr, VK_IMAGE_TYPE_2D, auto _template = get_template_from_collection_impl(sections_to_copy);
auto result = create_temporary_subresource_view_impl(cmd, _template, VK_IMAGE_TYPE_2D,
VK_IMAGE_VIEW_TYPE_2D, gcm_format, 0, 0, width, height, remap_vector, false); VK_IMAGE_VIEW_TYPE_2D, gcm_format, 0, 0, width, height, remap_vector, false);
const auto image = result->image(); const auto image = result->image();