VERY experimental Nintendo Switch 2 emulator
C++
gl_state: Remove polygon offset tracking
ReinUsesLisp84d4ac72ff56
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cppindex d1034c2a22..744892618d 100644--- a/src/video_core/renderer_opengl/gl_rasterizer.cpp+++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp@@ -1210,14 +1210,13 @@ void RasterizerOpenGL::SyncPolygonOffset() {auto& maxwell3d = system.GPU().Maxwell3D();const auto& regs = maxwell3d.regs;- state.polygon_offset.fill_enable = regs.polygon_offset_fill_enable != 0;- state.polygon_offset.line_enable = regs.polygon_offset_line_enable != 0;- state.polygon_offset.point_enable = regs.polygon_offset_point_enable != 0;+ 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);// Hardware divides polygon offset units by two- state.polygon_offset.units = regs.polygon_offset_units / 2.0f;- state.polygon_offset.factor = regs.polygon_offset_factor;- state.polygon_offset.clamp = regs.polygon_offset_clamp;+ glPolygonOffsetClamp(regs.polygon_offset_factor, regs.polygon_offset_units / 2.0f,+ regs.polygon_offset_clamp);}void RasterizerOpenGL::SyncAlphaTest() {diff --git a/src/video_core/renderer_opengl/gl_state.cpp b/src/video_core/renderer_opengl/gl_state.cppindex 59fd8e4219..05c271ad2f 100644--- a/src/video_core/renderer_opengl/gl_state.cpp+++ b/src/video_core/renderer_opengl/gl_state.cpp@@ -347,27 +347,6 @@ void OpenGLState::ApplyLogicOp() {}}-void OpenGLState::ApplyPolygonOffset() {- Enable(GL_POLYGON_OFFSET_FILL, cur_state.polygon_offset.fill_enable,- polygon_offset.fill_enable);- Enable(GL_POLYGON_OFFSET_LINE, cur_state.polygon_offset.line_enable,- polygon_offset.line_enable);- Enable(GL_POLYGON_OFFSET_POINT, cur_state.polygon_offset.point_enable,- polygon_offset.point_enable);-- if (UpdateTie(std::tie(cur_state.polygon_offset.factor, cur_state.polygon_offset.units,- cur_state.polygon_offset.clamp),- std::tie(polygon_offset.factor, polygon_offset.units, polygon_offset.clamp))) {- if (GLAD_GL_EXT_polygon_offset_clamp && polygon_offset.clamp != 0) {- glPolygonOffsetClamp(polygon_offset.factor, polygon_offset.units, polygon_offset.clamp);- } else {- UNIMPLEMENTED_IF_MSG(polygon_offset.clamp != 0,- "Unimplemented Depth polygon offset clamp.");- glPolygonOffset(polygon_offset.factor, polygon_offset.units);- }- }-}-void OpenGLState::ApplyClipControl() {if (UpdateTie(std::tie(cur_state.clip_control.origin, cur_state.clip_control.depth_mode),std::tie(clip_control.origin, clip_control.depth_mode))) {@@ -432,7 +411,6 @@ void OpenGLState::Apply() {ApplyTextures();ApplySamplers();ApplyImages();- ApplyPolygonOffset();ApplyClipControl();ApplyRenderBuffer();}diff --git a/src/video_core/renderer_opengl/gl_state.h b/src/video_core/renderer_opengl/gl_state.hindex f0e02e717d..71a2cad2ef 100644--- a/src/video_core/renderer_opengl/gl_state.h+++ b/src/video_core/renderer_opengl/gl_state.h@@ -124,15 +124,6 @@ public:};std::array<Viewport, Tegra::Engines::Maxwell3D::Regs::NumViewports> viewports;- struct {- bool point_enable = false;- bool line_enable = false;- bool fill_enable = false;- GLfloat units = 0.0f;- GLfloat factor = 0.0f;- GLfloat clamp = 0.0f;- } polygon_offset;-std::array<bool, 8> clip_distance = {}; // GL_CLIP_DISTANCEstruct {@@ -175,7 +166,6 @@ public:void ApplySamplers();void ApplyImages();void ApplyDepthClamp();- void ApplyPolygonOffset();void ApplyClipControl();void ApplyRenderBuffer();diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cppindex 0879a5fb12..affc6137ac 100644--- a/src/video_core/renderer_opengl/renderer_opengl.cpp+++ b/src/video_core/renderer_opengl/renderer_opengl.cpp@@ -573,8 +573,9 @@ void RendererOpenGL::DrawScreenTriangles(const ScreenInfo& screen_info, float x,state.Apply();// TODO: Signal state tracker about these changes- glDisable(GL_ALPHA_TEST);glEnable(GL_CULL_FACE);+ glDisable(GL_ALPHA_TEST);+ glDisable(GL_POLYGON_OFFSET_FILL);glCullFace(GL_BACK);glFrontFace(GL_CW);