Changeset 70552 in webkit


Ignore:
Timestamp:
Oct 26, 2010 12:01:19 PM (13 years ago)
Author:
senorblanco@chromium.org
Message:

2010-10-22 Stephen White <senorblanco@chromium.org>

Reviewed by Kenneth Russell.

Implement copy-texture-to-parent-texture API for WebGraphicsContext3DDefaultImpl.
https://bugs.webkit.org/show_bug.cgi?id=48152


This allows the in-process implementation to do accelerated canvas and
accelerated compositing together. It requires some changes landed
in chromium 63528, so this patch also rolls chromium DEPS to 63722
(current LKGR).

Covered by fast/canvas/arc360.html, and many more when run with
--accelerated-compositing and --accelerated-2d-canvas.

  • src/WebGraphicsContext3DDefaultImpl.cpp: (WebKit::WebGraphicsContext3DDefaultImpl::WebGraphicsContext3DDefaultImpl): Add member vars to save the currently-bound texture and for the texture-to-texture FBO. (WebKit::WebGraphicsContext3DDefaultImpl::~WebGraphicsContext3DDefaultImpl): Delete the texture-to-texture FBO on destruction.

(WebKit::WebGraphicsContext3DDefaultImpl::initialize):
Generate the texture-to-texture FBO.
(WebKit::WebGraphicsContext3DDefaultImpl::supportsCopyTextureToParentTextureCHROMIUM):
Check for support of the glGetTexLevelParameteriv function (required
for this implementation).
(WebKit::WebGraphicsContext3DDefaultImpl::copyTextureToParentTextureCHROMIUM):
Implement the extension: bind the FBO, bind the child texture, then
do a glCopyTexImage2D() into the parent texture.
(WebKit::WebGraphicsContext3DDefaultImpl::bindTexture):
Record the newly-bound texture in m_boundTexture.

  • src/WebGraphicsContext3DDefaultImpl.h: Add the two new member variables.
  • src/WebViewImpl.cpp: (WebKit::WebViewImpl::graphicsContext3D): Make sure the graphics context is reshaped to the correct size on all platforms.
Location:
trunk/WebKit/chromium
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit/chromium/ChangeLog

    r70543 r70552  
     12010-10-22  Stephen White  <senorblanco@chromium.org>
     2
     3        Reviewed by Kenneth Russell.
     4
     5        Implement copy-texture-to-parent-texture API for WebGraphicsContext3DDefaultImpl.
     6        https://bugs.webkit.org/show_bug.cgi?id=48152
     7       
     8        This allows the in-process implementation to do accelerated canvas and
     9        accelerated compositing together.  It requires some changes landed
     10        in chromium 63528, so this patch also rolls chromium DEPS to 63722
     11        (current LKGR).
     12
     13        Covered by fast/canvas/arc360.html, and many more when run with
     14        --accelerated-compositing and --accelerated-2d-canvas.
     15
     16        * src/WebGraphicsContext3DDefaultImpl.cpp:
     17        (WebKit::WebGraphicsContext3DDefaultImpl::WebGraphicsContext3DDefaultImpl):
     18        Add member vars to save the currently-bound texture and for the
     19        texture-to-texture FBO.
     20        (WebKit::WebGraphicsContext3DDefaultImpl::~WebGraphicsContext3DDefaultImpl):
     21        Delete the texture-to-texture FBO on destruction.
     22
     23        (WebKit::WebGraphicsContext3DDefaultImpl::initialize):
     24        Generate the texture-to-texture FBO.
     25        (WebKit::WebGraphicsContext3DDefaultImpl::supportsCopyTextureToParentTextureCHROMIUM):
     26        Check for support of the glGetTexLevelParameteriv function (required
     27        for this implementation).
     28        (WebKit::WebGraphicsContext3DDefaultImpl::copyTextureToParentTextureCHROMIUM):
     29        Implement the extension:  bind the FBO, bind the child texture, then
     30        do a glCopyTexImage2D() into the parent texture.
     31        (WebKit::WebGraphicsContext3DDefaultImpl::bindTexture):
     32        Record the newly-bound texture in m_boundTexture.
     33        * src/WebGraphicsContext3DDefaultImpl.h:
     34        Add the two new member variables.
     35        * src/WebViewImpl.cpp:
     36        (WebKit::WebViewImpl::graphicsContext3D):
     37        Make sure the graphics context is reshaped to the correct size on all
     38        platforms.
     39
    1402010-10-26  Alexey Marinichev  <amarinichev@chromium.org>
    241
  • trunk/WebKit/chromium/DEPS

    r70273 r70552  
    3333vars = {
    3434  'chromium_svn': 'http://src.chromium.org/svn/trunk/src',
    35   'chromium_rev': '63439'
     35  'chromium_rev': '63722'
    3636}
    3737
  • trunk/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.cpp

    r70534 r70552  
    8080    , m_multisampleColorBuffer(0)
    8181    , m_boundFBO(0)
     82    , m_boundTexture(0)
     83    , m_copyTextureToParentTextureFBO(0)
    8284#ifdef FLIP_FRAMEBUFFER_VERTICALLY
    8385    , m_scanline(0)
     
    104106        }
    105107        glDeleteTextures(1, &m_texture);
     108        glDeleteFramebuffersEXT(1, &m_copyTextureToParentTextureFBO);
    106109#ifdef FLIP_FRAMEBUFFER_VERTICALLY
    107110        if (m_scanline)
     
    173176        return false;
    174177    }
     178
     179    glGenFramebuffersEXT(1, &m_copyTextureToParentTextureFBO);
    175180
    176181    m_initialized = true;
     
    561566bool WebGraphicsContext3DDefaultImpl::supportsCopyTextureToParentTextureCHROMIUM()
    562567{
    563     // We don't claim support for this extension at this time
    564     return false;
     568    // This extension requires this desktopGL-only function (GLES2 doesn't
     569    // support it), so check for its existence here.
     570    return glGetTexLevelParameteriv;
    565571}
    566572
    567573void WebGraphicsContext3DDefaultImpl::copyTextureToParentTextureCHROMIUM(unsigned id, unsigned id2)
    568574{
     575    makeContextCurrent();
     576    glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_copyTextureToParentTextureFBO);
     577    glFramebufferTexture2DEXT(GL_FRAMEBUFFER,
     578                              GL_COLOR_ATTACHMENT0,
     579                              GL_TEXTURE_2D,
     580                              id,
     581                              0); // level
     582    glBindTexture(GL_TEXTURE_2D, id2);
     583    GLsizei width, height;
     584    glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &width);
     585    glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &height);
     586    glCopyTexImage2D(GL_TEXTURE_2D,
     587                     0, // level
     588                     GL_RGBA,
     589                     0, 0, // x, y
     590                     width,
     591                     height,
     592                     0); // border
     593    glBindTexture(GL_TEXTURE_2D, m_boundTexture);
     594    glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_boundFBO);
    569595}
    570596
     
    691717DELEGATE_TO_GL_2(bindRenderbuffer, BindRenderbufferEXT, unsigned long, WebGLId)
    692718
    693 DELEGATE_TO_GL_2(bindTexture, BindTexture, unsigned long, WebGLId)
     719void WebGraphicsContext3DDefaultImpl::bindTexture(unsigned long target, WebGLId texture)
     720{
     721    makeContextCurrent();
     722    glBindTexture(target, texture);
     723    m_boundTexture = texture;
     724}
    694725
    695726DELEGATE_TO_GL_4(blendColor, BlendColor, double, double, double, double)
  • trunk/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.h

    r68806 r70552  
    289289    unsigned int m_boundFBO;
    290290
     291    // For tracking which texture is bound
     292    unsigned int m_boundTexture;
     293   
     294    // FBO used for copying child texture to parent texture.
     295    unsigned m_copyTextureToParentTextureFBO;
     296
    291297#ifdef FLIP_FRAMEBUFFER_VERTICALLY
    292298    unsigned char* m_scanline;
  • trunk/WebKit/chromium/src/WebViewImpl.cpp

    r70543 r70552  
    25242524            GraphicsContext3D::Attributes attributes;
    25252525            m_temporaryOnscreenGraphicsContext3D = GraphicsContext3D::create(GraphicsContext3D::Attributes(), m_page->chrome(), GraphicsContext3D::RenderDirectlyToHostWindow);
    2526 #if OS(DARWIN)
    25272526            if (m_temporaryOnscreenGraphicsContext3D)
    25282527                m_temporaryOnscreenGraphicsContext3D->reshape(std::max(1, m_size.width), std::max(1, m_size.height));
    2529 #endif
    25302528            context = m_temporaryOnscreenGraphicsContext3D.get();
    25312529        }
Note: See TracChangeset for help on using the changeset viewer.