rsx: Only transfer framebuffer contents if memory contents are compatible

This commit is contained in:
kd-11 2017-10-23 15:54:29 +03:00
parent 0de0dded53
commit 7a5c88a8d1
2 changed files with 37 additions and 27 deletions

View File

@ -364,6 +364,8 @@ void GLGSRender::end()
//Check if depth buffer is bound and valid //Check if depth buffer is bound and valid
//If ds is not initialized clear it; it seems new depth textures should have depth cleared //If ds is not initialized clear it; it seems new depth textures should have depth cleared
auto copy_rtt_contents = [](gl::render_target *surface) auto copy_rtt_contents = [](gl::render_target *surface)
{
if (surface->get_compatible_internal_format() == surface->old_contents->get_compatible_internal_format())
{ {
//Copy data from old contents onto this one //Copy data from old contents onto this one
//1. Clip a rectangular region defning the data //1. Clip a rectangular region defning the data
@ -375,6 +377,9 @@ void GLGSRender::end()
std::tie(std::ignore, std::ignore, copy_w, copy_h) = rsx::clip_region<u16>(parent_w, parent_h, 0, 0, surface->width(), surface->height(), true); std::tie(std::ignore, std::ignore, copy_w, copy_h) = rsx::clip_region<u16>(parent_w, parent_h, 0, 0, surface->width(), surface->height(), true);
glCopyImageSubData(surface->old_contents->id(), GL_TEXTURE_2D, 0, 0, 0, 0, surface->id(), GL_TEXTURE_2D, 0, 0, 0, 0, copy_w, copy_h, 1); glCopyImageSubData(surface->old_contents->id(), GL_TEXTURE_2D, 0, 0, 0, 0, surface->id(), GL_TEXTURE_2D, 0, 0, 0, 0, copy_w, copy_h, 1);
surface->set_cleared(); surface->set_cleared();
}
//TODO: download image contents and reupload them or do a memory cast to copy memory contents if not compatible
surface->old_contents = nullptr; surface->old_contents = nullptr;
}; };

View File

@ -1011,6 +1011,8 @@ void VKGSRender::end()
if (g_cfg.video.strict_rendering_mode) if (g_cfg.video.strict_rendering_mode)
{ {
auto copy_rtt_contents = [&](vk::render_target* surface) auto copy_rtt_contents = [&](vk::render_target* surface)
{
if (surface->info.format == surface->old_contents->info.format)
{ {
const VkImageAspectFlags aspect = surface->attachment_aspect_flag; const VkImageAspectFlags aspect = surface->attachment_aspect_flag;
@ -1037,6 +1039,9 @@ void VKGSRender::end()
vk::change_image_layout(*m_current_command_buffer, surface, old_layout, subresource_range); vk::change_image_layout(*m_current_command_buffer, surface, old_layout, subresource_range);
surface->dirty = false; surface->dirty = false;
}
//TODO: download image contents and reupload them or do a memory cast to copy memory contents if not compatible
surface->old_contents = nullptr; surface->old_contents = nullptr;
}; };