summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar ReinUsesLisp2019-12-30 00:57:50 -0300
committerGravatar ReinUsesLisp2020-02-28 17:56:42 -0300
commitbf1a1d989f03b6597a34de8d97b29c189e293134 (patch)
tree5c0225f8255b1fa0573b863891f2ec462f376bbc /src
parentgl_state_tracker: Implement dirty flags for sRGB (diff)
downloadyuzu-bf1a1d989f03b6597a34de8d97b29c189e293134.tar.gz
yuzu-bf1a1d989f03b6597a34de8d97b29c189e293134.tar.xz
yuzu-bf1a1d989f03b6597a34de8d97b29c189e293134.zip
gl_state_tracker: Implement dirty flags for logic op
Diffstat (limited to 'src')
-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() {
1213} 1213}
1214 1214
1215void RasterizerOpenGL::SyncLogicOpState() { 1215void RasterizerOpenGL::SyncLogicOpState() {
1216 const auto& regs = system.GPU().Maxwell3D().regs; 1216 auto& gpu = system.GPU().Maxwell3D();
1217 auto& flags = gpu.dirty.flags;
1218 if (!flags[Dirty::LogicOp]) {
1219 return;
1220 }
1221 flags[Dirty::LogicOp] = false;
1217 1222
1218 oglEnable(GL_COLOR_LOGIC_OP, regs.logic_op.enable); 1223 const auto& regs = gpu.regs;
1219 if (regs.logic_op.enable) { 1224 if (regs.logic_op.enable) {
1225 glEnable(GL_COLOR_LOGIC_OP);
1220 glLogicOp(MaxwellToGL::LogicOp(regs.logic_op.operation)); 1226 glLogicOp(MaxwellToGL::LogicOp(regs.logic_op.operation));
1227 } else {
1228 glDisable(GL_COLOR_LOGIC_OP);
1221 } 1229 }
1222} 1230}
1223 1231
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) {
197 tables[0][OFF(framebuffer_srgb)] = FramebufferSRGB; 197 tables[0][OFF(framebuffer_srgb)] = FramebufferSRGB;
198} 198}
199 199
200void SetupDirtyLogicOp(Tables& tables) {
201 FillBlock(tables[0], OFF(logic_op), NUM(logic_op), LogicOp);
202}
203
200void SetupDirtyMisc(Tables& tables) { 204void SetupDirtyMisc(Tables& tables) {
201 auto& table = tables[0]; 205 auto& table = tables[0];
202 206
@@ -231,6 +235,7 @@ void StateTracker::Initialize() {
231 SetupDirtyMultisampleControl(tables); 235 SetupDirtyMultisampleControl(tables);
232 SetupDirtyRasterizeEnable(tables); 236 SetupDirtyRasterizeEnable(tables);
233 SetupDirtyFramebufferSRGB(tables); 237 SetupDirtyFramebufferSRGB(tables);
238 SetupDirtyLogicOp(tables);
234 SetupDirtyMisc(tables); 239 SetupDirtyMisc(tables);
235 240
236 auto& store = dirty.on_write_stores; 241 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 {
68 MultisampleControl, 68 MultisampleControl,
69 RasterizeEnable, 69 RasterizeEnable,
70 FramebufferSRGB, 70 FramebufferSRGB,
71 LogicOp,
71 72
72 Last 73 Last
73}; 74};
@@ -159,6 +160,11 @@ public:
159 flags[OpenGL::Dirty::FramebufferSRGB] = true; 160 flags[OpenGL::Dirty::FramebufferSRGB] = true;
160 } 161 }
161 162
163 void NotifyLogicOp() {
164 auto& flags = system.GPU().Maxwell3D().dirty.flags;
165 flags[OpenGL::Dirty::LogicOp] = true;
166 }
167
162private: 168private:
163 Core::System& system; 169 Core::System& system;
164}; 170};
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) {
589 state_tracker.NotifyPolygonOffset(); 589 state_tracker.NotifyPolygonOffset();
590 state_tracker.NotifyRasterizeEnable(); 590 state_tracker.NotifyRasterizeEnable();
591 state_tracker.NotifyFramebufferSRGB(); 591 state_tracker.NotifyFramebufferSRGB();
592 state_tracker.NotifyLogicOp();
592 593
593 program_manager.UseVertexShader(vertex_program.handle); 594 program_manager.UseVertexShader(vertex_program.handle);
594 program_manager.UseGeometryShader(0); 595 program_manager.UseGeometryShader(0);