diff options
author | ReinUsesLisp <reinuseslisp@airmail.cc> | 2019-12-30 04:22:43 +0100 |
---|---|---|
committer | ReinUsesLisp <reinuseslisp@airmail.cc> | 2020-02-28 21:56:42 +0100 |
commit | 9e46953580eab7b5b1e7b813db0284a9d2f78f27 (patch) | |
tree | 24d2afbe0569e069f680d02664819ce15b2b4fc9 /src/video_core | |
parent | gl_state_tracker: Implement dirty flags for primitive restart (diff) | |
download | yuzu-9e46953580eab7b5b1e7b813db0284a9d2f78f27.tar yuzu-9e46953580eab7b5b1e7b813db0284a9d2f78f27.tar.gz yuzu-9e46953580eab7b5b1e7b813db0284a9d2f78f27.tar.bz2 yuzu-9e46953580eab7b5b1e7b813db0284a9d2f78f27.tar.lz yuzu-9e46953580eab7b5b1e7b813db0284a9d2f78f27.tar.xz yuzu-9e46953580eab7b5b1e7b813db0284a9d2f78f27.tar.zst yuzu-9e46953580eab7b5b1e7b813db0284a9d2f78f27.zip |
Diffstat (limited to '')
4 files changed, 24 insertions, 2 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index ebb072d91..78838b8d1 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp @@ -1249,9 +1249,14 @@ void RasterizerOpenGL::SyncPointState() { } void RasterizerOpenGL::SyncPolygonOffset() { - auto& maxwell3d = system.GPU().Maxwell3D(); - const auto& regs = maxwell3d.regs; + auto& gpu = system.GPU().Maxwell3D(); + auto& flags = gpu.dirty.flags; + if (!flags[Dirty::PolygonOffset]) { + return; + } + flags[Dirty::PolygonOffset] = false; + const auto& regs = gpu.regs; oglEnable(GL_POLYGON_OFFSET_FILL, regs.polygon_offset_fill_enable); oglEnable(GL_POLYGON_OFFSET_LINE, regs.polygon_offset_line_enable); oglEnable(GL_POLYGON_OFFSET_POINT, regs.polygon_offset_point_enable); diff --git a/src/video_core/renderer_opengl/gl_state_tracker.cpp b/src/video_core/renderer_opengl/gl_state_tracker.cpp index c07b7f136..7cb874ac9 100644 --- a/src/video_core/renderer_opengl/gl_state_tracker.cpp +++ b/src/video_core/renderer_opengl/gl_state_tracker.cpp @@ -168,6 +168,16 @@ void SetupDirtyPrimitiveRestart(Tables& tables) { FillBlock(tables[0], OFF(primitive_restart), NUM(primitive_restart), PrimitiveRestart); } +void SetupDirtyPolygonOffset(Tables& tables) { + auto& table = tables[0]; + table[OFF(polygon_offset_fill_enable)] = PolygonOffset; + table[OFF(polygon_offset_line_enable)] = PolygonOffset; + table[OFF(polygon_offset_point_enable)] = PolygonOffset; + table[OFF(polygon_offset_factor)] = PolygonOffset; + table[OFF(polygon_offset_units)] = PolygonOffset; + table[OFF(polygon_offset_clamp)] = PolygonOffset; +} + void SetupDirtyMisc(Tables& tables) { auto& table = tables[0]; @@ -197,6 +207,7 @@ void StateTracker::Initialize() { SetupDirtyStencilTest(tables); SetupDirtyBlend(tables); SetupDirtyPrimitiveRestart(tables); + SetupDirtyPolygonOffset(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 af50b1a29..20c63595c 100644 --- a/src/video_core/renderer_opengl/gl_state_tracker.h +++ b/src/video_core/renderer_opengl/gl_state_tracker.h @@ -140,6 +140,11 @@ public: flags[OpenGL::Dirty::StencilTest] = true; } + void NotifyPolygonOffset() { + auto& flags = system.GPU().Maxwell3D().dirty.flags; + flags[OpenGL::Dirty::PolygonOffset] = true; + } + private: Core::System& system; }; diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp index 2449e28ac..630406044 100644 --- a/src/video_core/renderer_opengl/renderer_opengl.cpp +++ b/src/video_core/renderer_opengl/renderer_opengl.cpp @@ -586,6 +586,7 @@ void RendererOpenGL::DrawScreen(const Layout::FramebufferLayout& layout) { state_tracker.NotifyCullTest(); state_tracker.NotifyDepthTest(); state_tracker.NotifyStencilTest(); + state_tracker.NotifyPolygonOffset(); program_manager.UseVertexShader(vertex_program.handle); program_manager.UseGeometryShader(0); |