summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
index 10b2d8f3c..83d8d3d94 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
@@ -780,7 +780,10 @@ Surface RasterizerCacheOpenGL::GetSurface(const SurfaceParams& params, bool pres
780 } else if (preserve_contents) { 780 } else if (preserve_contents) {
781 // If surface parameters changed and we care about keeping the previous data, recreate 781 // If surface parameters changed and we care about keeping the previous data, recreate
782 // the surface from the old one 782 // the surface from the old one
783 return RecreateSurface(surface, params); 783 UnregisterSurface(surface);
784 Surface new_surface{RecreateSurface(surface, params)};
785 RegisterSurface(new_surface);
786 return new_surface;
784 } else { 787 } else {
785 // Delete the old surface before creating a new one to prevent collisions. 788 // Delete the old surface before creating a new one to prevent collisions.
786 UnregisterSurface(surface); 789 UnregisterSurface(surface);
@@ -813,6 +816,14 @@ Surface RasterizerCacheOpenGL::RecreateSurface(const Surface& surface,
813 // Create a new surface with the new parameters, and blit the previous surface to it 816 // Create a new surface with the new parameters, and blit the previous surface to it
814 Surface new_surface{std::make_shared<CachedSurface>(new_params)}; 817 Surface new_surface{std::make_shared<CachedSurface>(new_params)};
815 818
819 // If format is unchanged, we can do a faster blit without reinterpreting pixel data
820 if (params.pixel_format == new_params.pixel_format) {
821 BlitTextures(surface->Texture().handle, params.GetRect(), new_surface->Texture().handle,
822 new_surface->GetSurfaceParams().GetRect(), params.type,
823 read_framebuffer.handle, draw_framebuffer.handle);
824 return new_surface;
825 }
826
816 auto source_format = GetFormatTuple(params.pixel_format, params.component_type); 827 auto source_format = GetFormatTuple(params.pixel_format, params.component_type);
817 auto dest_format = GetFormatTuple(new_params.pixel_format, new_params.component_type); 828 auto dest_format = GetFormatTuple(new_params.pixel_format, new_params.component_type);
818 829
@@ -872,10 +883,6 @@ Surface RasterizerCacheOpenGL::RecreateSurface(const Surface& surface,
872 883
873 pbo.Release(); 884 pbo.Release();
874 885
875 // Update cache accordingly
876 UnregisterSurface(surface);
877 RegisterSurface(new_surface);
878
879 return new_surface; 886 return new_surface;
880} 887}
881 888