summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.cpp15
-rw-r--r--src/video_core/renderer_opengl/gl_state_tracker.cpp5
-rw-r--r--src/video_core/renderer_opengl/gl_state_tracker.h4
3 files changed, 19 insertions, 5 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp
index bc4542b69..ebb072d91 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp
@@ -1017,10 +1017,19 @@ void RasterizerOpenGL::SyncCullMode() {
}
void RasterizerOpenGL::SyncPrimitiveRestart() {
- const auto& regs = system.GPU().Maxwell3D().regs;
+ auto& gpu = system.GPU().Maxwell3D();
+ auto& flags = gpu.dirty.flags;
+ if (!flags[Dirty::PrimitiveRestart]) {
+ return;
+ }
+ flags[Dirty::PrimitiveRestart] = false;
- oglEnable(GL_PRIMITIVE_RESTART, regs.primitive_restart.enabled);
- glPrimitiveRestartIndex(regs.primitive_restart.index);
+ if (gpu.regs.primitive_restart.enabled) {
+ glEnable(GL_PRIMITIVE_RESTART);
+ glPrimitiveRestartIndex(gpu.regs.primitive_restart.index);
+ } else {
+ glDisable(GL_PRIMITIVE_RESTART);
+ }
}
void RasterizerOpenGL::SyncDepthTestState() {
diff --git a/src/video_core/renderer_opengl/gl_state_tracker.cpp b/src/video_core/renderer_opengl/gl_state_tracker.cpp
index eae47827b..c07b7f136 100644
--- a/src/video_core/renderer_opengl/gl_state_tracker.cpp
+++ b/src/video_core/renderer_opengl/gl_state_tracker.cpp
@@ -164,6 +164,10 @@ void SetupDirtyBlend(Tables& tables) {
FillBlock(tables[1], OFF(blend), NUM(blend), BlendStates);
}
+void SetupDirtyPrimitiveRestart(Tables& tables) {
+ FillBlock(tables[0], OFF(primitive_restart), NUM(primitive_restart), PrimitiveRestart);
+}
+
void SetupDirtyMisc(Tables& tables) {
auto& table = tables[0];
@@ -192,6 +196,7 @@ void StateTracker::Initialize() {
SetupDirtyDepthTest(tables);
SetupDirtyStencilTest(tables);
SetupDirtyBlend(tables);
+ SetupDirtyPrimitiveRestart(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 2eaec2a0d..af50b1a29 100644
--- a/src/video_core/renderer_opengl/gl_state_tracker.h
+++ b/src/video_core/renderer_opengl/gl_state_tracker.h
@@ -56,13 +56,13 @@ enum : u8 {
Shaders,
ClipDistances,
+ ColorMask,
FrontFace,
CullTest,
DepthMask,
DepthTest,
- PrimitiveRestart,
StencilTest,
- ColorMask,
+ PrimitiveRestart,
PolygonOffset,
Last