Example #1
0
void GLBackend::do_setStateDepthTest(State::DepthTest test) {
    if (_pipeline._stateCache.depthTest != test) {
        if (test.isEnabled()) {
            glEnable(GL_DEPTH_TEST);
            glDepthMask(test.getWriteMask());
            glDepthFunc(GL_COMPARISON_FUNCTIONS[test.getFunction()]);
        } else {
            glDisable(GL_DEPTH_TEST);
        }
        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;
    }
}
Example #2
0
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()) {
            qCDebug(gpulogging) << "DepthTest" << (test.isEnabled() ? "Enabled" : "Disabled")
                << "Mask=" << (test.getWriteMask() ? "Write" : "no Write")
                << "Func=" << test.getFunction()
                << "Raw=" << test.getRaw();
        }
        _pipeline._stateCache.depthTest = test;
    }
}
Example #3
0
void generateDepthTest(GLState::Commands& commands, const State::DepthTest& test) {
    commands.push_back(std::make_shared<CommandDepthTest>(&GLBackend::do_setStateDepthTest, int32(test.getRaw())));
}
Example #4
0
void generateDepthTest(GLBackend::GLState::Commands& commands, const State::DepthTest& test) {
    commands.push_back(CommandPointer(new CommandDepthTest(&GLBackend::do_setStateDepthTest, int32(test.getRaw()))));
}