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, UNIMPLEMENTED_IF_MSG(regs.alpha_test_enabled != 0 && regs.rt_control.count > 1,
"Alpha Testing is enabled with more than one rendertarget"); "Alpha Testing is enabled with more than one rendertarget");
state.alpha_test.enabled = regs.alpha_test_enabled; oglEnable(GL_ALPHA_TEST, regs.alpha_test_enabled);
if (!state.alpha_test.enabled) { if (regs.alpha_test_enabled) {
return; 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 } // 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() { void OpenGLState::ApplyClipControl() {
if (UpdateTie(std::tie(cur_state.clip_control.origin, cur_state.clip_control.depth_mode), if (UpdateTie(std::tie(cur_state.clip_control.origin, cur_state.clip_control.depth_mode),
std::tie(clip_control.origin, clip_control.depth_mode))) { std::tie(clip_control.origin, clip_control.depth_mode))) {
@ -441,7 +433,6 @@ void OpenGLState::Apply() {
ApplySamplers(); ApplySamplers();
ApplyImages(); ApplyImages();
ApplyPolygonOffset(); ApplyPolygonOffset();
ApplyAlphaTest();
ApplyClipControl(); ApplyClipControl();
ApplyRenderBuffer(); ApplyRenderBuffer();
} }

View File

@ -133,12 +133,6 @@ public:
GLfloat clamp = 0.0f; GLfloat clamp = 0.0f;
} polygon_offset; } 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 std::array<bool, 8> clip_distance = {}; // GL_CLIP_DISTANCE
struct { struct {
@ -182,7 +176,6 @@ public:
void ApplyImages(); void ApplyImages();
void ApplyDepthClamp(); void ApplyDepthClamp();
void ApplyPolygonOffset(); void ApplyPolygonOffset();
void ApplyAlphaTest();
void ApplyClipControl(); void ApplyClipControl();
void ApplyRenderBuffer(); void ApplyRenderBuffer();

View File

@ -573,6 +573,7 @@ void RendererOpenGL::DrawScreenTriangles(const ScreenInfo& screen_info, float x,
state.Apply(); state.Apply();
// TODO: Signal state tracker about these changes // TODO: Signal state tracker about these changes
glDisable(GL_ALPHA_TEST);
glEnable(GL_CULL_FACE); glEnable(GL_CULL_FACE);
glCullFace(GL_BACK); glCullFace(GL_BACK);
glFrontFace(GL_CW); glFrontFace(GL_CW);