rsx: Improve window border detection and clearing

- Improves logic to detect if the frame requires letterboxing and
properly clears the background appropriately.
This commit is contained in:
kd-11 2020-01-18 17:30:39 +03:00 committed by kd-11
parent 5e0ca4c0c4
commit 22ca2827de
2 changed files with 18 additions and 22 deletions

View File

@ -115,10 +115,8 @@ void GLGSRender::flip(const rsx::display_flip_info_t& info)
// Disable scissor test (affects blit, clear, etc)
gl_state.enable(GL_FALSE, GL_SCISSOR_TEST);
// Clear the window background to black
gl_state.clear_color(0, 0, 0, 0);
// Enable drawing to window backbuffer
gl::screen.bind();
gl::screen.clear(gl::buffers::color);
GLuint image_to_flip = GL_NONE;
@ -162,6 +160,13 @@ void GLGSRender::flip(const rsx::display_flip_info_t& info)
aspect_ratio.size = new_size;
if (!image_to_flip || aspect_ratio.width < csize.width || aspect_ratio.height < csize.height)
{
// Clear the window background to black
gl_state.clear_color(0, 0, 0, 0);
gl::screen.clear(gl::buffers::color);
}
if (image_to_flip)
{
if (m_frame->screenshot_toggle == true)

View File

@ -521,17 +521,18 @@ void VKGSRender::flip(const rsx::display_flip_info_t& info)
vk::framebuffer_holder* direct_fbo = nullptr;
vk::viewable_image* calibration_src = nullptr;
if (!image_to_flip || aspect_ratio.width < csize.width || aspect_ratio.height < csize.height)
{
// Clear the window background to black
VkClearColorValue clear_black {};
vk::change_image_layout(*m_current_command_buffer, target_image, present_layout, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, subresource_range);
vkCmdClearColorImage(*m_current_command_buffer, target_image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, &clear_black, 1, &subresource_range);
target_layout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL;
}
if (image_to_flip)
{
if (aspect_ratio.x || aspect_ratio.y)
{
VkClearColorValue clear_black {};
vk::change_image_layout(*m_current_command_buffer, target_image, present_layout, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, subresource_range);
vkCmdClearColorImage(*m_current_command_buffer, target_image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, &clear_black, 1, &subresource_range);
target_layout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL;
}
if (UNLIKELY(!g_cfg.video.full_rgb_range_output || !rsx::fcmp(avconfig->gamma, 1.f)))
{
calibration_src = dynamic_cast<vk::viewable_image*>(image_to_flip);
@ -599,16 +600,6 @@ void VKGSRender::flip(const rsx::display_flip_info_t& info)
m_frame->take_screenshot(std::move(sshot_frame), buffer_width, buffer_height);
}
}
else
{
// No draw call was issued!
// TODO: Upload raw bytes from cpu for rendering
VkClearColorValue clear_black {};
vk::change_image_layout(*m_current_command_buffer, target_image, present_layout, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, subresource_range);
vkCmdClearColorImage(*m_current_command_buffer, target_image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, &clear_black, 1, &subresource_range);
target_layout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL;
}
const bool has_overlay = (m_overlay_manager && m_overlay_manager->has_visible());
if (g_cfg.video.overlay || has_overlay)