summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2019-12-30 05:20:08 +0100
committerReinUsesLisp <reinuseslisp@airmail.cc>2020-02-28 21:56:42 +0100
commit231601763c4717f8d7978341994a479e4283fa3d (patch)
tree2728608710280f5ca4cb24948bf195ebe3f2d540
parentgl_state_tracker: Implement dirty flags for logic op (diff)
downloadyuzu-231601763c4717f8d7978341994a479e4283fa3d.tar
yuzu-231601763c4717f8d7978341994a479e4283fa3d.tar.gz
yuzu-231601763c4717f8d7978341994a479e4283fa3d.tar.bz2
yuzu-231601763c4717f8d7978341994a479e4283fa3d.tar.lz
yuzu-231601763c4717f8d7978341994a479e4283fa3d.tar.xz
yuzu-231601763c4717f8d7978341994a479e4283fa3d.tar.zst
yuzu-231601763c4717f8d7978341994a479e4283fa3d.zip
-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.h1
3 files changed, 14 insertions, 2 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp
index 4cb050da6..7ffb8fa09 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp
@@ -1149,8 +1149,14 @@ void RasterizerOpenGL::SyncMultiSampleState() {
}
void RasterizerOpenGL::SyncFragmentColorClampState() {
- const auto& regs = system.GPU().Maxwell3D().regs;
- glClampColor(GL_CLAMP_FRAGMENT_COLOR, regs.frag_color_clamp ? GL_TRUE : GL_FALSE);
+ auto& gpu = system.GPU().Maxwell3D();
+ auto& flags = gpu.dirty.flags;
+ if (!flags[Dirty::FragmentClampColor]) {
+ return;
+ }
+ flags[Dirty::FragmentClampColor] = false;
+
+ glClampColor(GL_CLAMP_FRAGMENT_COLOR, gpu.regs.frag_color_clamp ? GL_TRUE : GL_FALSE);
}
void RasterizerOpenGL::SyncBlendState() {
diff --git a/src/video_core/renderer_opengl/gl_state_tracker.cpp b/src/video_core/renderer_opengl/gl_state_tracker.cpp
index d6ad25ee9..538ab97e0 100644
--- a/src/video_core/renderer_opengl/gl_state_tracker.cpp
+++ b/src/video_core/renderer_opengl/gl_state_tracker.cpp
@@ -201,6 +201,10 @@ void SetupDirtyLogicOp(Tables& tables) {
FillBlock(tables[0], OFF(logic_op), NUM(logic_op), LogicOp);
}
+void SetupDirtyFragmentClampColor(Tables& tables) {
+ tables[0][OFF(frag_color_clamp)] = FragmentClampColor;
+}
+
void SetupDirtyMisc(Tables& tables) {
auto& table = tables[0];
@@ -236,6 +240,7 @@ void StateTracker::Initialize() {
SetupDirtyRasterizeEnable(tables);
SetupDirtyFramebufferSRGB(tables);
SetupDirtyLogicOp(tables);
+ SetupDirtyFragmentClampColor(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 9901d2b0d..db92a2e5c 100644
--- a/src/video_core/renderer_opengl/gl_state_tracker.h
+++ b/src/video_core/renderer_opengl/gl_state_tracker.h
@@ -69,6 +69,7 @@ enum : u8 {
RasterizeEnable,
FramebufferSRGB,
LogicOp,
+ FragmentClampColor,
Last
};