summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2019-12-30 04:49:19 +0100
committerReinUsesLisp <reinuseslisp@airmail.cc>2020-02-28 21:56:42 +0100
commitd8f5c450516c3956b422f0487293ea02620a3518 (patch)
tree06c933a0abd3679f73cbc869529952c86e71a0cc
parentgl_state_tracker: Implement dirty flags for multisample (diff)
downloadyuzu-d8f5c450516c3956b422f0487293ea02620a3518.tar
yuzu-d8f5c450516c3956b422f0487293ea02620a3518.tar.gz
yuzu-d8f5c450516c3956b422f0487293ea02620a3518.tar.bz2
yuzu-d8f5c450516c3956b422f0487293ea02620a3518.tar.lz
yuzu-d8f5c450516c3956b422f0487293ea02620a3518.tar.xz
yuzu-d8f5c450516c3956b422f0487293ea02620a3518.tar.zst
yuzu-d8f5c450516c3956b422f0487293ea02620a3518.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.h6
-rw-r--r--src/video_core/renderer_opengl/gl_texture_cache.cpp1
-rw-r--r--src/video_core/renderer_opengl/renderer_opengl.cpp1
5 files changed, 21 insertions, 2 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp
index e4875608a..a650113ca 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp
@@ -1090,8 +1090,14 @@ void RasterizerOpenGL::SyncStencilTestState() {
}
void RasterizerOpenGL::SyncRasterizeEnable() {
- const auto& regs = system.GPU().Maxwell3D().regs;
- oglEnable(GL_RASTERIZER_DISCARD, regs.rasterize_enable == 0);
+ auto& gpu = system.GPU().Maxwell3D();
+ auto& flags = gpu.dirty.flags;
+ if (!flags[Dirty::RasterizeEnable]) {
+ return;
+ }
+ flags[Dirty::RasterizeEnable] = false;
+
+ oglEnable(GL_RASTERIZER_DISCARD, gpu.regs.rasterize_enable == 0);
}
void RasterizerOpenGL::SyncColorMask() {
diff --git a/src/video_core/renderer_opengl/gl_state_tracker.cpp b/src/video_core/renderer_opengl/gl_state_tracker.cpp
index c979046a3..ebfb1945f 100644
--- a/src/video_core/renderer_opengl/gl_state_tracker.cpp
+++ b/src/video_core/renderer_opengl/gl_state_tracker.cpp
@@ -189,6 +189,10 @@ void SetupDirtyMultisampleControl(Tables& tables) {
FillBlock(tables[0], OFF(multisample_control), NUM(multisample_control), MultisampleControl);
}
+void SetupDirtyRasterizeEnable(Tables& tables) {
+ tables[0][OFF(rasterize_enable)] = RasterizeEnable;
+}
+
void SetupDirtyMisc(Tables& tables) {
auto& table = tables[0];
@@ -221,6 +225,7 @@ void StateTracker::Initialize() {
SetupDirtyPrimitiveRestart(tables);
SetupDirtyPolygonOffset(tables);
SetupDirtyMultisampleControl(tables);
+ SetupDirtyRasterizeEnable(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 afa8efc28..73a63d31d 100644
--- a/src/video_core/renderer_opengl/gl_state_tracker.h
+++ b/src/video_core/renderer_opengl/gl_state_tracker.h
@@ -66,6 +66,7 @@ enum : u8 {
PrimitiveRestart,
PolygonOffset,
MultisampleControl,
+ RasterizeEnable,
Last
};
@@ -147,6 +148,11 @@ public:
flags[OpenGL::Dirty::PolygonOffset] = true;
}
+ void NotifyRasterizeEnable() {
+ auto& flags = system.GPU().Maxwell3D().dirty.flags;
+ flags[OpenGL::Dirty::RasterizeEnable] = true;
+ }
+
private:
Core::System& system;
};
diff --git a/src/video_core/renderer_opengl/gl_texture_cache.cpp b/src/video_core/renderer_opengl/gl_texture_cache.cpp
index 46572eb43..81ab95604 100644
--- a/src/video_core/renderer_opengl/gl_texture_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_texture_cache.cpp
@@ -522,6 +522,7 @@ void TextureCacheOpenGL::ImageBlit(View& src_view, View& dst_view,
state_tracker.NotifyScissor0();
state_tracker.NotifyBlend0();
state_tracker.NotifyFramebuffer();
+ state_tracker.NotifyRasterizeEnable();
if (dst_params.srgb_conversion) {
glEnable(GL_FRAMEBUFFER_SRGB);
diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp
index 1be7e491a..41378978d 100644
--- a/src/video_core/renderer_opengl/renderer_opengl.cpp
+++ b/src/video_core/renderer_opengl/renderer_opengl.cpp
@@ -587,6 +587,7 @@ void RendererOpenGL::DrawScreen(const Layout::FramebufferLayout& layout) {
state_tracker.NotifyDepthTest();
state_tracker.NotifyStencilTest();
state_tracker.NotifyPolygonOffset();
+ state_tracker.NotifyRasterizeEnable();
program_manager.UseVertexShader(vertex_program.handle);
program_manager.UseGeometryShader(0);