gl_state: Remove polygon offset tracking

This commit is contained in:
ReinUsesLisp 2019-12-26 00:25:53 -03:00
parent f646321dd0
commit a0321b984f
4 changed files with 7 additions and 39 deletions

View File

@ -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() {

View File

@ -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();
}

View File

@ -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_DISTANCE
struct {
@ -175,7 +166,6 @@ public:
void ApplySamplers();
void ApplyImages();
void ApplyDepthClamp();
void ApplyPolygonOffset();
void ApplyClipControl();
void ApplyRenderBuffer();

View File

@ -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);