diff options
author | ReinUsesLisp <reinuseslisp@airmail.cc> | 2019-12-30 04:53:53 +0100 |
---|---|---|
committer | ReinUsesLisp <reinuseslisp@airmail.cc> | 2020-02-28 21:56:42 +0100 |
commit | 13afd0e5b0a5e84f2a979515185ece5b54d3fed4 (patch) | |
tree | 5ba4ca0ea6ff81a9e82adb40978752c7aeaa18fd /src/video_core | |
parent | gl_state_tracker: Implement dirty flags for rasterize enable (diff) | |
download | yuzu-13afd0e5b0a5e84f2a979515185ece5b54d3fed4.tar yuzu-13afd0e5b0a5e84f2a979515185ece5b54d3fed4.tar.gz yuzu-13afd0e5b0a5e84f2a979515185ece5b54d3fed4.tar.bz2 yuzu-13afd0e5b0a5e84f2a979515185ece5b54d3fed4.tar.lz yuzu-13afd0e5b0a5e84f2a979515185ece5b54d3fed4.tar.xz yuzu-13afd0e5b0a5e84f2a979515185ece5b54d3fed4.tar.zst yuzu-13afd0e5b0a5e84f2a979515185ece5b54d3fed4.zip |
Diffstat (limited to 'src/video_core')
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); |