gl_state: Remove alpha test tracking

This commit is contained in:
ReinUsesLisp 2019-12-25 20:03:40 -03:00
parent c8f5f54a44
commit f646321dd0
4 changed files with 4 additions and 21 deletions

View file

@ -1225,12 +1225,10 @@ void RasterizerOpenGL::SyncAlphaTest() {
UNIMPLEMENTED_IF_MSG(regs.alpha_test_enabled != 0 && regs.rt_control.count > 1,
"Alpha Testing is enabled with more than one rendertarget");
state.alpha_test.enabled = regs.alpha_test_enabled;
if (!state.alpha_test.enabled) {
return;
oglEnable(GL_ALPHA_TEST, regs.alpha_test_enabled);
if (regs.alpha_test_enabled) {
glAlphaFunc(MaxwellToGL::ComparisonOp(regs.alpha_test_func), regs.alpha_test_ref);
}
state.alpha_test.func = MaxwellToGL::ComparisonOp(regs.alpha_test_func);
state.alpha_test.ref = regs.alpha_test_ref;
}
} // namespace OpenGL

View file

@ -368,14 +368,6 @@ void OpenGLState::ApplyPolygonOffset() {
}
}
void OpenGLState::ApplyAlphaTest() {
Enable(GL_ALPHA_TEST, cur_state.alpha_test.enabled, alpha_test.enabled);
if (UpdateTie(std::tie(cur_state.alpha_test.func, cur_state.alpha_test.ref),
std::tie(alpha_test.func, alpha_test.ref))) {
glAlphaFunc(alpha_test.func, alpha_test.ref);
}
}
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))) {
@ -441,7 +433,6 @@ void OpenGLState::Apply() {
ApplySamplers();
ApplyImages();
ApplyPolygonOffset();
ApplyAlphaTest();
ApplyClipControl();
ApplyRenderBuffer();
}

View file

@ -133,12 +133,6 @@ public:
GLfloat clamp = 0.0f;
} polygon_offset;
struct {
bool enabled = false; // GL_ALPHA_TEST
GLenum func = GL_ALWAYS; // GL_ALPHA_TEST_FUNC
GLfloat ref = 0.0f; // GL_ALPHA_TEST_REF
} alpha_test;
std::array<bool, 8> clip_distance = {}; // GL_CLIP_DISTANCE
struct {
@ -182,7 +176,6 @@ public:
void ApplyImages();
void ApplyDepthClamp();
void ApplyPolygonOffset();
void ApplyAlphaTest();
void ApplyClipControl();
void ApplyRenderBuffer();

View file

@ -573,6 +573,7 @@ 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);
glCullFace(GL_BACK);
glFrontFace(GL_CW);