Просмотр исходного кода

gl_rasterizer: Correct sRGB Fix regression

Fernando Sahmkow 6 лет назад
Родитель
Сommit
e60d281a01
1 измененных файлов с 12 добавлено и 0 удалено
  1. 12 0
      src/video_core/renderer_opengl/gl_rasterizer.cpp

+ 12 - 0
src/video_core/renderer_opengl/gl_rasterizer.cpp

@@ -485,6 +485,12 @@ std::pair<bool, bool> RasterizerOpenGL::ConfigureFramebuffers(
             View color_surface{
             View color_surface{
                 texture_cache.GetColorBufferSurface(*single_color_target, preserve_contents)};
                 texture_cache.GetColorBufferSurface(*single_color_target, preserve_contents)};
 
 
+            if (color_surface) {
+                // Assume that a surface will be written to if it is used as a framebuffer, even if
+                // the shader doesn't actually write to it.
+                texture_cache.MarkColorBufferInUse(*single_color_target);
+            }
+
             fbkey.is_single_buffer = true;
             fbkey.is_single_buffer = true;
             fbkey.color_attachments[0] =
             fbkey.color_attachments[0] =
                 GL_COLOR_ATTACHMENT0 + static_cast<GLenum>(*single_color_target);
                 GL_COLOR_ATTACHMENT0 + static_cast<GLenum>(*single_color_target);
@@ -499,6 +505,12 @@ std::pair<bool, bool> RasterizerOpenGL::ConfigureFramebuffers(
             for (std::size_t index = 0; index < Maxwell::NumRenderTargets; ++index) {
             for (std::size_t index = 0; index < Maxwell::NumRenderTargets; ++index) {
                 View color_surface{texture_cache.GetColorBufferSurface(index, preserve_contents)};
                 View color_surface{texture_cache.GetColorBufferSurface(index, preserve_contents)};
 
 
+                if (color_surface) {
+                    // Assume that a surface will be written to if it is used as a framebuffer, even
+                    // if the shader doesn't actually write to it.
+                    texture_cache.MarkColorBufferInUse(index);
+                }
+
                 fbkey.color_attachments[index] =
                 fbkey.color_attachments[index] =
                     GL_COLOR_ATTACHMENT0 + regs.rt_control.GetMap(index);
                     GL_COLOR_ATTACHMENT0 + regs.rt_control.GetMap(index);
                 fbkey.colors[index] = color_surface;
                 fbkey.colors[index] = color_surface;