summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.cpp10
-rw-r--r--src/video_core/renderer_opengl/gl_state_tracker.cpp5
-rw-r--r--src/video_core/renderer_opengl/gl_state_tracker.h6
-rw-r--r--src/video_core/renderer_opengl/gl_texture_cache.cpp1
-rw-r--r--src/video_core/renderer_opengl/renderer_opengl.cpp1
5 files changed, 21 insertions, 2 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp
index a650113ca..47ad834aa 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp
@@ -1301,8 +1301,14 @@ void RasterizerOpenGL::SyncAlphaTest() {
}
void RasterizerOpenGL::SyncFramebufferSRGB() {
- const auto& regs = system.GPU().Maxwell3D().regs;
- oglEnable(GL_FRAMEBUFFER_SRGB, regs.framebuffer_srgb);
+ auto& gpu = system.GPU().Maxwell3D();
+ auto& flags = gpu.dirty.flags;
+ if (!flags[Dirty::FramebufferSRGB]) {
+ return;
+ }
+ flags[Dirty::FramebufferSRGB] = false;
+
+ oglEnable(GL_FRAMEBUFFER_SRGB, gpu.regs.framebuffer_srgb);
}
} // namespace OpenGL
diff --git a/src/video_core/renderer_opengl/gl_state_tracker.cpp b/src/video_core/renderer_opengl/gl_state_tracker.cpp
index ebfb1945f..a99a94aff 100644
--- a/src/video_core/renderer_opengl/gl_state_tracker.cpp
+++ b/src/video_core/renderer_opengl/gl_state_tracker.cpp
@@ -193,6 +193,10 @@ void SetupDirtyRasterizeEnable(Tables& tables) {
tables[0][OFF(rasterize_enable)] = RasterizeEnable;
}
+void SetupDirtyFramebufferSRGB(Tables& tables) {
+ tables[0][OFF(framebuffer_srgb)] = FramebufferSRGB;
+}
+
void SetupDirtyMisc(Tables& tables) {
auto& table = tables[0];
@@ -226,6 +230,7 @@ void StateTracker::Initialize() {
SetupDirtyPolygonOffset(tables);
SetupDirtyMultisampleControl(tables);
SetupDirtyRasterizeEnable(tables);
+ SetupDirtyFramebufferSRGB(tables);
SetupDirtyMisc(tables);
auto& store = dirty.on_write_stores;
diff --git a/src/video_core/renderer_opengl/gl_state_tracker.h b/src/video_core/renderer_opengl/gl_state_tracker.h
index 73a63d31d..7cba66359 100644
--- a/src/video_core/renderer_opengl/gl_state_tracker.h
+++ b/src/video_core/renderer_opengl/gl_state_tracker.h
@@ -67,6 +67,7 @@ enum : u8 {
PolygonOffset,
MultisampleControl,
RasterizeEnable,
+ FramebufferSRGB,
Last
};
@@ -153,6 +154,11 @@ public:
flags[OpenGL::Dirty::RasterizeEnable] = true;
}
+ void NotifyFramebufferSRGB() {
+ auto& flags = system.GPU().Maxwell3D().dirty.flags;
+ flags[OpenGL::Dirty::FramebufferSRGB] = true;
+ }
+
private:
Core::System& system;
};
diff --git a/src/video_core/renderer_opengl/gl_texture_cache.cpp b/src/video_core/renderer_opengl/gl_texture_cache.cpp
index 81ab95604..d8a2bf9eb 100644
--- a/src/video_core/renderer_opengl/gl_texture_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_texture_cache.cpp
@@ -523,6 +523,7 @@ void TextureCacheOpenGL::ImageBlit(View& src_view, View& dst_view,
state_tracker.NotifyBlend0();
state_tracker.NotifyFramebuffer();
state_tracker.NotifyRasterizeEnable();
+ state_tracker.NotifyFramebufferSRGB();
if (dst_params.srgb_conversion) {
glEnable(GL_FRAMEBUFFER_SRGB);
diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp
index 41378978d..f8b6f98f7 100644
--- a/src/video_core/renderer_opengl/renderer_opengl.cpp
+++ b/src/video_core/renderer_opengl/renderer_opengl.cpp
@@ -588,6 +588,7 @@ void RendererOpenGL::DrawScreen(const Layout::FramebufferLayout& layout) {
state_tracker.NotifyStencilTest();
state_tracker.NotifyPolygonOffset();
state_tracker.NotifyRasterizeEnable();
+ state_tracker.NotifyFramebufferSRGB();
program_manager.UseVertexShader(vertex_program.handle);
program_manager.UseGeometryShader(0);