void GLBackend::do_setStateDepthTest(State::DepthTest test) { const auto& current = _pipeline._stateCache.depthTest; if (current != test) { if (test.isEnabled()) { glEnable(GL_DEPTH_TEST); } else { glDisable(GL_DEPTH_TEST); } if (test.getWriteMask() != current.getWriteMask()) { glDepthMask(test.getWriteMask()); } if (test.getFunction() != current.getFunction()) { glDepthFunc(COMPARISON_TO_GL[test.getFunction()]); } if (CHECK_GL_ERROR()) { qDebug() << "DepthTest" << (test.isEnabled() ? "Enabled" : "Disabled") << "Mask=" << (test.getWriteMask() ? "Write" : "no Write") << "Func=" << test.getFunction() << "Raw=" << test.getRaw(); } _pipeline._stateCache.depthTest = test; } }
void generateDepthTest(GLState::Commands& commands, const State::DepthTest& test) { commands.push_back(std::make_shared<CommandDepthTest>(&GLBackend::do_setStateDepthTest, int32(test.getRaw()))); }
void generateDepthTest(GLBackend::GLState::Commands& commands, const State::DepthTest& test) { commands.push_back(CommandPointer(new CommandDepthTest(&GLBackend::do_setStateDepthTest, int32(test.getRaw())))); }