rsx: Fixup for missing visuals when framebuffer is larger than requested

display dimensions.
This commit is contained in:
kd-11 2020-01-18 12:21:31 +03:00 committed by kd-11
parent 48407752a6
commit 5e0ca4c0c4
2 changed files with 46 additions and 18 deletions

View File

@ -15,24 +15,38 @@ GLuint GLGSRender::get_present_source(gl::present_surface_info* info, const rsx:
{ {
const auto& section = overlap_info.back(); const auto& section = overlap_info.back();
auto surface = gl::as_rtt(section.surface); auto surface = gl::as_rtt(section.surface);
bool viable = false;
if (section.base_address >= info->address) if (section.base_address >= info->address)
{ {
// Check for intentional 'borders' const auto surface_width = surface->get_surface_width(rsx::surface_metrics::samples);
const u32 inset_offset = section.base_address - info->address; const auto surface_height = surface->get_surface_height(rsx::surface_metrics::samples);
const u32 inset_y = inset_offset / info->pitch;
const u32 inset_x = (inset_offset % info->pitch) / format_bpp;
const u32 full_width = surface->get_surface_width(rsx::surface_metrics::samples) + inset_x + inset_x; if (section.base_address == info->address)
const u32 full_height = surface->get_surface_height(rsx::surface_metrics::samples) + inset_y + inset_y; {
// Check for fit or crop
viable = (surface_width >= info->width && surface_height >= info->height);
}
else
{
// Check for borders and letterboxing
const u32 inset_offset = section.base_address - info->address;
const u32 inset_y = inset_offset / info->pitch;
const u32 inset_x = (inset_offset % info->pitch) / format_bpp;
if (full_width == info->width && full_height == info->height) const u32 full_width = surface_width + inset_x + inset_x;
const u32 full_height = surface_height + inset_y + inset_y;
viable = (full_width == info->width && full_height == info->height);
}
if (viable)
{ {
surface->read_barrier(cmd); surface->read_barrier(cmd);
image = section.surface->get_surface(rsx::surface_access::read)->id(); image = section.surface->get_surface(rsx::surface_access::read)->id();
info->width = rsx::apply_resolution_scale(full_width - (inset_x + inset_x), true); info->width = rsx::apply_resolution_scale(std::min(surface_width, static_cast<u16>(info->width)), true);
info->height = rsx::apply_resolution_scale(full_height - (inset_y + inset_y), true); info->height = rsx::apply_resolution_scale(std::min(surface_height, static_cast<u16>(info->height)), true);
} }
} }
} }

View File

@ -274,24 +274,38 @@ vk::image* VKGSRender::get_present_source(vk::present_surface_info* info, const
{ {
const auto& section = overlap_info.back(); const auto& section = overlap_info.back();
auto surface = vk::as_rtt(section.surface); auto surface = vk::as_rtt(section.surface);
bool viable = false;
if (section.base_address >= info->address) if (section.base_address >= info->address)
{ {
// Check for intentional 'borders' const auto surface_width = surface->get_surface_width(rsx::surface_metrics::samples);
const u32 inset_offset = section.base_address - info->address; const auto surface_height = surface->get_surface_height(rsx::surface_metrics::samples);
const u32 inset_y = inset_offset / info->pitch;
const u32 inset_x = (inset_offset % info->pitch) / format_bpp;
const u32 full_width = surface->get_surface_width(rsx::surface_metrics::samples) + inset_x + inset_x; if (section.base_address == info->address)
const u32 full_height = surface->get_surface_height(rsx::surface_metrics::samples) + inset_y + inset_y; {
// Check for fit or crop
viable = (surface_width >= info->width && surface_height >= info->height);
}
else
{
// Check for borders and letterboxing
const u32 inset_offset = section.base_address - info->address;
const u32 inset_y = inset_offset / info->pitch;
const u32 inset_x = (inset_offset % info->pitch) / format_bpp;
if (full_width == info->width && full_height == info->height) const u32 full_width = surface_width + inset_x + inset_x;
const u32 full_height = surface_height + inset_y + inset_y;
viable = (full_width == info->width && full_height == info->height);
}
if (viable)
{ {
surface->read_barrier(*m_current_command_buffer); surface->read_barrier(*m_current_command_buffer);
image_to_flip = section.surface->get_surface(rsx::surface_access::read); image_to_flip = section.surface->get_surface(rsx::surface_access::read);
info->width = rsx::apply_resolution_scale(full_width - (inset_x + inset_x), true); info->width = rsx::apply_resolution_scale(std::min(surface_width, static_cast<u16>(info->width)), true);
info->height = rsx::apply_resolution_scale(full_height - (inset_y + inset_y), true); info->height = rsx::apply_resolution_scale(std::min(surface_height, static_cast<u16>(info->height)), true);
} }
} }
} }