summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2019-12-30 03:25:53 +0100
committerReinUsesLisp <reinuseslisp@airmail.cc>2020-02-28 21:56:42 +0100
commit46a1888e02f04c1478fbf61ae003f14d09c70a42 (patch)
treefbe7f434d35462665a4b06cd8a20d607dcd56b7c
parentgl_state_tracker: Implement dirty flags for stencil testing (diff)
downloadyuzu-46a1888e02f04c1478fbf61ae003f14d09c70a42.tar
yuzu-46a1888e02f04c1478fbf61ae003f14d09c70a42.tar.gz
yuzu-46a1888e02f04c1478fbf61ae003f14d09c70a42.tar.bz2
yuzu-46a1888e02f04c1478fbf61ae003f14d09c70a42.tar.lz
yuzu-46a1888e02f04c1478fbf61ae003f14d09c70a42.tar.xz
yuzu-46a1888e02f04c1478fbf61ae003f14d09c70a42.tar.zst
yuzu-46a1888e02f04c1478fbf61ae003f14d09c70a42.zip
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