summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.cpp11
-rw-r--r--src/video_core/renderer_opengl/gl_state.cpp22
-rw-r--r--src/video_core/renderer_opengl/gl_state.h10
-rw-r--r--src/video_core/renderer_opengl/renderer_opengl.cpp3
4 files changed, 7 insertions, 39 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp
index d1034c2a2..744892618 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() {
1210 auto& maxwell3d = system.GPU().Maxwell3D(); 1210 auto& maxwell3d = system.GPU().Maxwell3D();
1211 const auto& regs = maxwell3d.regs; 1211 const auto& regs = maxwell3d.regs;
1212 1212
1213 state.polygon_offset.fill_enable = regs.polygon_offset_fill_enable != 0; 1213 oglEnable(GL_POLYGON_OFFSET_FILL, regs.polygon_offset_fill_enable);
1214 state.polygon_offset.line_enable = regs.polygon_offset_line_enable != 0; 1214 oglEnable(GL_POLYGON_OFFSET_LINE, regs.polygon_offset_line_enable);
1215 state.polygon_offset.point_enable = regs.polygon_offset_point_enable != 0; 1215 oglEnable(GL_POLYGON_OFFSET_POINT, regs.polygon_offset_point_enable);
1216 1216
1217 // Hardware divides polygon offset units by two 1217 // Hardware divides polygon offset units by two
1218 state.polygon_offset.units = regs.polygon_offset_units / 2.0f; 1218 glPolygonOffsetClamp(regs.polygon_offset_factor, regs.polygon_offset_units / 2.0f,
1219 state.polygon_offset.factor = regs.polygon_offset_factor; 1219 regs.polygon_offset_clamp);
1220 state.polygon_offset.clamp = regs.polygon_offset_clamp;
1221} 1220}
1222 1221
1223void RasterizerOpenGL::SyncAlphaTest() { 1222void RasterizerOpenGL::SyncAlphaTest() {
diff --git a/src/video_core/renderer_opengl/gl_state.cpp b/src/video_core/renderer_opengl/gl_state.cpp
index 59fd8e421..05c271ad2 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() {
347 } 347 }
348} 348}
349 349
350void OpenGLState::ApplyPolygonOffset() {
351 Enable(GL_POLYGON_OFFSET_FILL, cur_state.polygon_offset.fill_enable,
352 polygon_offset.fill_enable);
353 Enable(GL_POLYGON_OFFSET_LINE, cur_state.polygon_offset.line_enable,
354 polygon_offset.line_enable);
355 Enable(GL_POLYGON_OFFSET_POINT, cur_state.polygon_offset.point_enable,
356 polygon_offset.point_enable);
357
358 if (UpdateTie(std::tie(cur_state.polygon_offset.factor, cur_state.polygon_offset.units,
359 cur_state.polygon_offset.clamp),
360 std::tie(polygon_offset.factor, polygon_offset.units, polygon_offset.clamp))) {
361 if (GLAD_GL_EXT_polygon_offset_clamp && polygon_offset.clamp != 0) {
362 glPolygonOffsetClamp(polygon_offset.factor, polygon_offset.units, polygon_offset.clamp);
363 } else {
364 UNIMPLEMENTED_IF_MSG(polygon_offset.clamp != 0,
365 "Unimplemented Depth polygon offset clamp.");
366 glPolygonOffset(polygon_offset.factor, polygon_offset.units);
367 }
368 }
369}
370
371void OpenGLState::ApplyClipControl() { 350void OpenGLState::ApplyClipControl() {
372 if (UpdateTie(std::tie(cur_state.clip_control.origin, cur_state.clip_control.depth_mode), 351 if (UpdateTie(std::tie(cur_state.clip_control.origin, cur_state.clip_control.depth_mode),
373 std::tie(clip_control.origin, clip_control.depth_mode))) { 352 std::tie(clip_control.origin, clip_control.depth_mode))) {
@@ -432,7 +411,6 @@ void OpenGLState::Apply() {
432 ApplyTextures(); 411 ApplyTextures();
433 ApplySamplers(); 412 ApplySamplers();
434 ApplyImages(); 413 ApplyImages();
435 ApplyPolygonOffset();
436 ApplyClipControl(); 414 ApplyClipControl();
437 ApplyRenderBuffer(); 415 ApplyRenderBuffer();
438} 416}
diff --git a/src/video_core/renderer_opengl/gl_state.h b/src/video_core/renderer_opengl/gl_state.h
index f0e02e717..71a2cad2e 100644
--- a/src/video_core/renderer_opengl/gl_state.h
+++ b/src/video_core/renderer_opengl/gl_state.h
@@ -124,15 +124,6 @@ public:
124 }; 124 };
125 std::array<Viewport, Tegra::Engines::Maxwell3D::Regs::NumViewports> viewports; 125 std::array<Viewport, Tegra::Engines::Maxwell3D::Regs::NumViewports> viewports;
126 126
127 struct {
128 bool point_enable = false;
129 bool line_enable = false;
130 bool fill_enable = false;
131 GLfloat units = 0.0f;
132 GLfloat factor = 0.0f;
133 GLfloat clamp = 0.0f;
134 } polygon_offset;
135
136 std::array<bool, 8> clip_distance = {}; // GL_CLIP_DISTANCE 127 std::array<bool, 8> clip_distance = {}; // GL_CLIP_DISTANCE
137 128
138 struct { 129 struct {
@@ -175,7 +166,6 @@ public:
175 void ApplySamplers(); 166 void ApplySamplers();
176 void ApplyImages(); 167 void ApplyImages();
177 void ApplyDepthClamp(); 168 void ApplyDepthClamp();
178 void ApplyPolygonOffset();
179 void ApplyClipControl(); 169 void ApplyClipControl();
180 void ApplyRenderBuffer(); 170 void ApplyRenderBuffer();
181 171
diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp
index 0879a5fb1..affc6137a 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,
573 state.Apply(); 573 state.Apply();
574 574
575 // TODO: Signal state tracker about these changes 575 // TODO: Signal state tracker about these changes
576 glDisable(GL_ALPHA_TEST);
577 glEnable(GL_CULL_FACE); 576 glEnable(GL_CULL_FACE);
577 glDisable(GL_ALPHA_TEST);
578 glDisable(GL_POLYGON_OFFSET_FILL);
578 glCullFace(GL_BACK); 579 glCullFace(GL_BACK);
579 glFrontFace(GL_CW); 580 glFrontFace(GL_CW);
580 581