summaryrefslogtreecommitdiffstats
path: root/src/video_core
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2019-12-30 04:57:50 +0100
committerReinUsesLisp <reinuseslisp@airmail.cc>2020-02-28 21:56:42 +0100
commitbf1a1d989f03b6597a34de8d97b29c189e293134 (patch)
tree5c0225f8255b1fa0573b863891f2ec462f376bbc /src/video_core
parentgl_state_tracker: Implement dirty flags for sRGB (diff)
downloadyuzu-bf1a1d989f03b6597a34de8d97b29c189e293134.tar
yuzu-bf1a1d989f03b6597a34de8d97b29c189e293134.tar.gz
yuzu-bf1a1d989f03b6597a34de8d97b29c189e293134.tar.bz2
yuzu-bf1a1d989f03b6597a34de8d97b29c189e293134.tar.lz
yuzu-bf1a1d989f03b6597a34de8d97b29c189e293134.tar.xz
yuzu-bf1a1d989f03b6597a34de8d97b29c189e293134.tar.zst
yuzu-bf1a1d989f03b6597a34de8d97b29c189e293134.zip
Diffstat (limited to 'src/video_core')
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.cpp12
-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/renderer_opengl.cpp1
4 files changed, 22 insertions, 2 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp
index 47ad834aa..4cb050da6 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp
@@ -1213,11 +1213,19 @@ void RasterizerOpenGL::SyncBlendState() {
}
void RasterizerOpenGL::SyncLogicOpState() {
- const auto& regs = system.GPU().Maxwell3D().regs;
+ auto& gpu = system.GPU().Maxwell3D();
+ auto& flags = gpu.dirty.flags;
+ if (!flags[Dirty::LogicOp]) {
+ return;
+ }
+ flags[Dirty::LogicOp] = false;
- oglEnable(GL_COLOR_LOGIC_OP, regs.logic_op.enable);
+ const auto& regs = gpu.regs;
if (regs.logic_op.enable) {
+ glEnable(GL_COLOR_LOGIC_OP);
glLogicOp(MaxwellToGL::LogicOp(regs.logic_op.operation));
+ } else {
+ glDisable(GL_COLOR_LOGIC_OP);
}
}
diff --git a/src/video_core/renderer_opengl/gl_state_tracker.cpp b/src/video_core/renderer_opengl/gl_state_tracker.cpp
index a99a94aff..d6ad25ee9 100644
--- a/src/video_core/renderer_opengl/gl_state_tracker.cpp
+++ b/src/video_core/renderer_opengl/gl_state_tracker.cpp
@@ -197,6 +197,10 @@ void SetupDirtyFramebufferSRGB(Tables& tables) {
tables[0][OFF(framebuffer_srgb)] = FramebufferSRGB;
}
+void SetupDirtyLogicOp(Tables& tables) {
+ FillBlock(tables[0], OFF(logic_op), NUM(logic_op), LogicOp);
+}
+
void SetupDirtyMisc(Tables& tables) {
auto& table = tables[0];
@@ -231,6 +235,7 @@ void StateTracker::Initialize() {
SetupDirtyMultisampleControl(tables);
SetupDirtyRasterizeEnable(tables);
SetupDirtyFramebufferSRGB(tables);
+ SetupDirtyLogicOp(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 7cba66359..9901d2b0d 100644
--- a/src/video_core/renderer_opengl/gl_state_tracker.h
+++ b/src/video_core/renderer_opengl/gl_state_tracker.h
@@ -68,6 +68,7 @@ enum : u8 {
MultisampleControl,
RasterizeEnable,
FramebufferSRGB,
+ LogicOp,
Last
};
@@ -159,6 +160,11 @@ public:
flags[OpenGL::Dirty::FramebufferSRGB] = true;
}
+ void NotifyLogicOp() {
+ auto& flags = system.GPU().Maxwell3D().dirty.flags;
+ flags[OpenGL::Dirty::LogicOp] = true;
+ }
+
private:
Core::System& system;
};
diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp
index f8b6f98f7..7391412c2 100644
--- a/src/video_core/renderer_opengl/renderer_opengl.cpp
+++ b/src/video_core/renderer_opengl/renderer_opengl.cpp
@@ -589,6 +589,7 @@ void RendererOpenGL::DrawScreen(const Layout::FramebufferLayout& layout) {
state_tracker.NotifyPolygonOffset();
state_tracker.NotifyRasterizeEnable();
state_tracker.NotifyFramebufferSRGB();
+ state_tracker.NotifyLogicOp();
program_manager.UseVertexShader(vertex_program.handle);
program_manager.UseGeometryShader(0);