From 78574746bddb1d62d85ae90707e1f0283af2a5db Mon Sep 17 00:00:00 2001 From: ReinUsesLisp Date: Tue, 3 Sep 2019 01:05:23 -0300 Subject: renderer_opengl: Fix sRGB blits Removes the sRGB hack of tracking if a frame used an sRGB rendertarget to apply at least once to blit the final texture as sRGB. Instead of doing this apply sRGB if the presented image has sRGB. Also enable sRGB by default on Maxwell3D registers as some games seem to assume this. --- src/video_core/renderer_opengl/gl_rasterizer.cpp | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) (limited to 'src/video_core/renderer_opengl/gl_rasterizer.cpp') diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index 4e266cdad..f7397dd64 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp @@ -485,15 +485,6 @@ std::pair RasterizerOpenGL::ConfigureFramebuffers( View color_surface{ 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); - // Workaround for and issue in nvidia drivers - // https://devtalk.nvidia.com/default/topic/776591/opengl/gl_framebuffer_srgb-functions-incorrectly/ - state.framebuffer_srgb.enabled |= color_surface->GetSurfaceParams().srgb_conversion; - } - fbkey.is_single_buffer = true; fbkey.color_attachments[0] = GL_COLOR_ATTACHMENT0 + static_cast(*single_color_target); @@ -508,17 +499,6 @@ std::pair RasterizerOpenGL::ConfigureFramebuffers( for (std::size_t index = 0; index < Maxwell::NumRenderTargets; ++index) { 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); - // Enable sRGB only for supported formats - // Workaround for and issue in nvidia drivers - // https://devtalk.nvidia.com/default/topic/776591/opengl/gl_framebuffer_srgb-functions-incorrectly/ - state.framebuffer_srgb.enabled |= - color_surface->GetSurfaceParams().srgb_conversion; - } - fbkey.color_attachments[index] = GL_COLOR_ATTACHMENT0 + regs.rt_control.GetMap(index); fbkey.colors[index] = color_surface; @@ -906,6 +886,7 @@ bool RasterizerOpenGL::AccelerateDisplay(const Tegra::FramebufferConfig& config, } screen_info.display_texture = surface->GetTexture(); + screen_info.display_srgb = surface->GetSurfaceParams().srgb_conversion; return true; } -- cgit v1.2.3 From e60d281a0172274371d6ef66ed4c422c91b8ea30 Mon Sep 17 00:00:00 2001 From: Fernando Sahmkow Date: Sat, 7 Sep 2019 19:26:16 -0400 Subject: gl_rasterizer: Correct sRGB Fix regression --- src/video_core/renderer_opengl/gl_rasterizer.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/video_core/renderer_opengl/gl_rasterizer.cpp') diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index f7397dd64..4dd08bccb 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp @@ -485,6 +485,12 @@ std::pair RasterizerOpenGL::ConfigureFramebuffers( View color_surface{ 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.color_attachments[0] = GL_COLOR_ATTACHMENT0 + static_cast(*single_color_target); @@ -499,6 +505,12 @@ std::pair RasterizerOpenGL::ConfigureFramebuffers( for (std::size_t index = 0; index < Maxwell::NumRenderTargets; ++index) { 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] = GL_COLOR_ATTACHMENT0 + regs.rt_control.GetMap(index); fbkey.colors[index] = color_surface; -- cgit v1.2.3