gl_state: Remove cull mode tracking

This commit is contained in:
ReinUsesLisp 2019-12-25 19:56:17 -03:00
parent 925521da5f
commit c8f5f54a44
4 changed files with 4 additions and 19 deletions

View file

@ -1020,10 +1020,8 @@ void RasterizerOpenGL::SyncClipCoef() {
void RasterizerOpenGL::SyncCullMode() { void RasterizerOpenGL::SyncCullMode() {
const auto& regs = system.GPU().Maxwell3D().regs; const auto& regs = system.GPU().Maxwell3D().regs;
state.cull.enabled = regs.cull.enabled != 0; oglEnable(GL_CULL_FACE, regs.cull.enabled);
if (state.cull.enabled) { glCullFace(MaxwellToGL::CullFace(regs.cull.cull_face));
state.cull.mode = MaxwellToGL::CullFace(regs.cull.cull_face);
}
glFrontFace(MaxwellToGL::FrontFace(regs.cull.front_face)); glFrontFace(MaxwellToGL::FrontFace(regs.cull.front_face));
} }

View file

@ -164,14 +164,6 @@ void OpenGLState::ApplySRgb() {
} }
} }
void OpenGLState::ApplyCulling() {
Enable(GL_CULL_FACE, cur_state.cull.enabled, cull.enabled);
if (UpdateValue(cur_state.cull.mode, cull.mode)) {
glCullFace(cull.mode);
}
}
void OpenGLState::ApplyRasterizerDiscard() { void OpenGLState::ApplyRasterizerDiscard() {
Enable(GL_RASTERIZER_DISCARD, cur_state.rasterizer_discard, rasterizer_discard); Enable(GL_RASTERIZER_DISCARD, cur_state.rasterizer_discard, rasterizer_discard);
} }
@ -441,7 +433,6 @@ void OpenGLState::Apply() {
ApplyViewport(); ApplyViewport();
ApplyStencilTest(); ApplyStencilTest();
ApplySRgb(); ApplySRgb();
ApplyCulling();
ApplyDepth(); ApplyDepth();
ApplyPrimitiveRestart(); ApplyPrimitiveRestart();
ApplyBlending(); ApplyBlending();

View file

@ -31,11 +31,6 @@ public:
bool near_plane = false; bool near_plane = false;
} depth_clamp; // GL_DEPTH_CLAMP } depth_clamp; // GL_DEPTH_CLAMP
struct {
bool enabled = false; // GL_CULL_FACE
GLenum mode = GL_BACK; // GL_CULL_FACE_MODE
} cull;
struct { struct {
bool test_enabled = false; // GL_DEPTH_TEST bool test_enabled = false; // GL_DEPTH_TEST
GLboolean write_mask = GL_TRUE; // GL_DEPTH_WRITEMASK GLboolean write_mask = GL_TRUE; // GL_DEPTH_WRITEMASK
@ -172,7 +167,6 @@ public:
void ApplyFragmentColorClamp(); void ApplyFragmentColorClamp();
void ApplyMultisample(); void ApplyMultisample();
void ApplySRgb(); void ApplySRgb();
void ApplyCulling();
void ApplyRasterizerDiscard(); void ApplyRasterizerDiscard();
void ApplyColorMask(); void ApplyColorMask();
void ApplyDepth(); void ApplyDepth();

View file

@ -573,6 +573,8 @@ 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
glEnable(GL_CULL_FACE);
glCullFace(GL_BACK);
glFrontFace(GL_CW); glFrontFace(GL_CW);
glNamedBufferSubData(vertex_buffer.handle, 0, sizeof(vertices), std::data(vertices)); glNamedBufferSubData(vertex_buffer.handle, 0, sizeof(vertices), std::data(vertices));