Пример #1
0
void LanczosFilter::init()
{
    if (m_inited)
        return;
    m_inited = true;
    const bool force = (qstrcmp(qgetenv("KWIN_FORCE_LANCZOS"), "1") == 0);
    if (force) {
        kWarning(1212) << "Lanczos Filter forced on by environment variable";
    }

    if (!force && options->glSmoothScale() != 2)
        return; // disabled by config

    // The lanczos filter is reported to be broken with the Intel driver and Mesa 7.10
    GLPlatform *gl = GLPlatform::instance();
    if (!force && gl->driver() == Driver_Intel && gl->mesaVersion() >= kVersionNumber(7, 10) && gl->chipClass() < SandyBridge)
        return;
    // With fglrx the ARB Shader crashes KWin (see Bug #270818 and #286795) and GLSL Shaders are not functional
    if (!force && gl->driver() == Driver_Catalyst) {
        return;
    }

    m_shader = new LanczosShader(this);
    if (!m_shader->init()) {
        delete m_shader;
        m_shader = 0;
    }
}