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
parent fa628f0ac4
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;
auto src_width = rsx::apply_resolution_scale(section.width, true);
auto src_height = rsx::apply_resolution_scale(h, true);
auto dst_width = src_width;
auto dst_height = src_height;
auto dst_width = u16(src_width * scale_x);
auto dst_height = u16(src_height * scale_y);
if (scale_x > 1.f)
{
@ -1639,13 +1639,13 @@ namespace rsx
if (limit_x > slice_w)
{
dst_width = (limit_x - dst_x);
dst_width = (slice_w - dst_x);
src_width = dst_width / scale_x;
}
if (limit_y > slice_h)
{
dst_height = (limit_y - dst_y);
dst_height = (slice_h - dst_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
{
if (LIKELY(sections_to_transfer.size() == 1))
{
return sections_to_transfer.front().src;
}
gl::texture* result = nullptr;
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,
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);
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
{
if (LIKELY(sections_to_transfer.size() == 1))
{
return sections_to_transfer.front().src;
}
vk::image* result = nullptr;
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,
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);
const auto image = result->image();