コード例 #1
0
bool FECustomFilter::prepareForDrawing(CustomFilterDrawType filterDrawType)
{
    if (!m_context && !initializeContext())
        return false;
    m_context->makeContextCurrent();

    // If the shader had compiler errors we cannot draw anything.
    if (!m_compiledProgram->isInitialized())
        return false;

    // Only allocate a texture if the program needs one and the caller doesn't allocate one by itself.
    if ((programNeedsInputTexture() && (filterDrawType == NEEDS_INPUT_TEXTURE) && !ensureInputTexture())
            || !ensureFrameBuffer())
        return false;

    return true;
}
コード例 #2
0
bool FECustomFilter::prepareForDrawing()
{
    m_context->makeContextCurrent();

    // Lazily inject the compiled program into the CustomFilterRenderer.
    if (!m_customFilterRenderer->compiledProgram())
        m_customFilterRenderer->setCompiledProgram(m_validatedProgram->compiledProgram());

    if (!m_customFilterRenderer->prepareForDrawing())
        return false;

    // Only allocate a texture if the program needs one and the caller doesn't allocate one by itself.
    if ((m_customFilterRenderer->programNeedsInputTexture() && !ensureInputTexture()) || !ensureFrameBuffer())
        return false;

    return true;
}
コード例 #3
0
bool FECustomFilter::prepareForDrawing()
{
    m_context->makeContextCurrent();

    if (!m_customFilterRenderer->compiledProgram()) {
        RefPtr<CustomFilterCompiledProgram> compiledProgram = m_validatedProgram->compiledProgram();
        if (!compiledProgram) {
            // Lazily create a compiled program and let CustomFilterValidatedProgram hold on to it.
            compiledProgram = CustomFilterCompiledProgram::create(m_context, m_validatedProgram->validatedVertexShader(), m_validatedProgram->validatedFragmentShader(), m_validatedProgram->programInfo().programType());
            m_validatedProgram->setCompiledProgram(compiledProgram);
        }
        // Lazily inject the compiled program into the CustomFilterRenderer.
        m_customFilterRenderer->setCompiledProgram(compiledProgram.release());
    }

    if (!m_customFilterRenderer->prepareForDrawing())
        return false;

    // Only allocate a texture if the program needs one and the caller doesn't allocate one by itself.
    if ((m_customFilterRenderer->programNeedsInputTexture() && !ensureInputTexture()) || !ensureFrameBuffer())
        return false;

    return true;
}