Exemplo n.º 1
0
void GraphicsContext3DInternal::releaseFrontBuffer()
{
    LOGWEBGL("GraphicsContext3DInternal::releaseFrontBuffer()");
    MutexLocker lock(m_fboMutex);
    FBO* fbo = m_frontFBO;

    if (fbo) {
        fbo->setLocked(false);
        if (fbo->sync() != EGL_NO_SYNC_KHR) {
            eglDestroySyncKHR(m_dpy, fbo->sync());
        }
        fbo->setSync();
    }
    updateFrontBuffer();
}
Exemplo n.º 2
0
void GraphicsContext3DInternal::swapBuffers()
{
    if (s_loggingEnabled)
        m_webGLFPSTimer->tick();

    LOGWEBGL("+swapBuffers()");

    MutexLocker lock(m_fboMutex);
    FBO* fbo = m_currentFBO;
    if (fbo == 0)
        return;

    makeContextCurrent();

    bool mustRestoreFBO = (m_boundFBO != fbo->fbo());
    if (mustRestoreFBO) {
        glBindFramebuffer(GL_FRAMEBUFFER, fbo->fbo());
    }

    // Create the fence sync and notify the sync thread
    fbo->setSync();
    //[CAPPFIX_WEB_WEBGL] - Improve UI Response Begin
    if (!m_needImproveUIResponseMode)
    //[CAPPFIX_WEB_WEBGL_END]
#if USE(SHARED_TEXTURE_WEBGL)
        glFinish();
#else
        glFlush();
#endif

    m_queuedBuffers.append(fbo);
    m_threadCondition.broadcast();

#if USE(SHARED_TEXTURE_WEBGL)
    // Dequeue a new buffer
    fbo = dequeueBuffer();
#else
    //[CAPPFIX_WEB_WEBGL] - Improve UI Response Begin
    int tick = 0;
    if (!m_needImproveUIResponseMode)
        tick = getTickCount();
    //[CAPPFIX_WEB_WEBGL_END]
    // Dequeue a new buffer
    fbo = dequeueBuffer();

    //[CAPPFIX_WEB_WEBGL] - Improve UI Response Begin
    if (!m_needImproveUIResponseMode &&  getTickCount() - tick > SWP_WebGL_IUR_Time) {
        m_needImproveUIResponseMode = true;
        LOGWEBGL("On needImproveUIResponseMode");
    }
    //[CAPPFIX_WEB_WEBGL_END]
#endif
    m_currentFBO = fbo;

    if (!mustRestoreFBO) {
        m_boundFBO = m_currentFBO->fbo();
    }
    glBindFramebuffer(GL_FRAMEBUFFER, m_boundFBO);
    m_canvasDirty = false;
    m_layerComposited = true;
    LOGWEBGL("-swapBuffers()");
}