Merge pull request #2384 from ReinUsesLisp/gl-state-clear

gl_rasterizer: Apply just the needed state on Clear
This commit is contained in:
bunnei 2019-04-16 22:19:03 -04:00 committed by GitHub
commit 21d498bc06
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -582,9 +582,6 @@ std::pair<bool, bool> RasterizerOpenGL::ConfigureFramebuffers(
} }
void RasterizerOpenGL::Clear() { void RasterizerOpenGL::Clear() {
const auto prev_state{state};
SCOPE_EXIT({ prev_state.Apply(); });
const auto& regs = system.GPU().Maxwell3D().regs; const auto& regs = system.GPU().Maxwell3D().regs;
bool use_color{}; bool use_color{};
bool use_depth{}; bool use_depth{};
@ -656,7 +653,10 @@ void RasterizerOpenGL::Clear() {
clear_state.EmulateViewportWithScissor(); clear_state.EmulateViewportWithScissor();
} }
clear_state.Apply(); clear_state.ApplyColorMask();
clear_state.ApplyDepth();
clear_state.ApplyStencilTest();
clear_state.ApplyViewport();
if (use_color) { if (use_color) {
glClearBufferfv(GL_COLOR, regs.clear_buffers.RT, regs.clear_color); glClearBufferfv(GL_COLOR, regs.clear_buffers.RT, regs.clear_color);