Changeset 220519 in webkit


Ignore:
Timestamp:
Aug 10, 2017 12:20:16 AM (7 years ago)
Author:
zandobersek@gmail.com
Message:

[TexMap] Drop GraphicsContext3D usage from BitmapTextureGL
https://bugs.webkit.org/show_bug.cgi?id=175317

Reviewed by Carlos Garcia Campos.

Have BitmapTextureGL use direct OpenGL API entrypoints and constants
instead of leveraging the GraphicsContext3D class. Any GraphicsContext3D
object passed to BitmapTextureGL would assume rendering to the GL context
that's current on that thread, translating method invocations to the
OpenGL API. We can do this by ourselves and benefit by avoiding allocating
GraphicsContext3D resources like the ANGLE compiler that are by most useful
for WebGL.

BitmapTextureGL::create() call sites are adjusted to stop passing a
GraphicsContext3D reference. BitmapTextureGL::bindAsSurface() doesn't need
a replacement for the passed-in GraphicsContext3D object since that object
originated from the TextureMapperGL instance, whose GraphicsContext3D is by
default of the render-to-current-context nature. Other changes are direct
translations of GraphicsContext3D methods to OpenGL API calls, or of
GraphicsContext3D values to OpenGL API constants.

No new tests -- no change in behavior.

  • platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:

(WebCore::MediaPlayerPrivateGStreamerBase::pushTextureToCompositor):

  • platform/graphics/texmap/BitmapTextureGL.cpp:

Also remove an unnecessary GraphicsContext.h header inclusion.
(WebCore::BitmapTextureGL::BitmapTextureGL):
(WebCore::BitmapTextureGL::didReset):
(WebCore::BitmapTextureGL::updateContentsNoSwizzle):
(WebCore::BitmapTextureGL::updateContents):
(WebCore::BitmapTextureGL::initializeStencil):
(WebCore::BitmapTextureGL::initializeDepthBuffer):
(WebCore::BitmapTextureGL::clearIfNeeded):
(WebCore::BitmapTextureGL::createFboIfNeeded):
(WebCore::BitmapTextureGL::bindAsSurface):
(WebCore::BitmapTextureGL::~BitmapTextureGL):
(WebCore::BitmapTextureGL::copyFromExternalTexture):

  • platform/graphics/texmap/BitmapTextureGL.h:

(WebCore::BitmapTextureGL::create):
(WebCore::BitmapTextureGL::textureTarget const):
(WebCore::BitmapTextureGL::internalFormat const):

  • platform/graphics/texmap/BitmapTexturePool.cpp:

(WebCore::BitmapTexturePool::createTexture):

  • platform/graphics/texmap/TextureMapperGL.cpp:

(WebCore::TextureMapperGL::bindSurface):
(WebCore::TextureMapperGL::createTexture):

Location:
trunk/Source/WebCore
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r220515 r220519  
     12017-08-10  Zan Dobersek  <zdobersek@igalia.com>
     2
     3        [TexMap] Drop GraphicsContext3D usage from BitmapTextureGL
     4        https://bugs.webkit.org/show_bug.cgi?id=175317
     5
     6        Reviewed by Carlos Garcia Campos.
     7
     8        Have BitmapTextureGL use direct OpenGL API entrypoints and constants
     9        instead of leveraging the GraphicsContext3D class. Any GraphicsContext3D
     10        object passed to BitmapTextureGL would assume rendering to the GL context
     11        that's current on that thread, translating method invocations to the
     12        OpenGL API. We can do this by ourselves and benefit by avoiding allocating
     13        GraphicsContext3D resources like the ANGLE compiler that are by most useful
     14        for WebGL.
     15
     16        BitmapTextureGL::create() call sites are adjusted to stop passing a
     17        GraphicsContext3D reference. BitmapTextureGL::bindAsSurface() doesn't need
     18        a replacement for the passed-in GraphicsContext3D object since that object
     19        originated from the TextureMapperGL instance, whose GraphicsContext3D is by
     20        default of the render-to-current-context nature. Other changes are direct
     21        translations of GraphicsContext3D methods to OpenGL API calls, or of
     22        GraphicsContext3D values to OpenGL API constants.
     23
     24        No new tests -- no change in behavior.
     25
     26        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
     27        (WebCore::MediaPlayerPrivateGStreamerBase::pushTextureToCompositor):
     28        * platform/graphics/texmap/BitmapTextureGL.cpp:
     29        Also remove an unnecessary GraphicsContext.h header inclusion.
     30        (WebCore::BitmapTextureGL::BitmapTextureGL):
     31        (WebCore::BitmapTextureGL::didReset):
     32        (WebCore::BitmapTextureGL::updateContentsNoSwizzle):
     33        (WebCore::BitmapTextureGL::updateContents):
     34        (WebCore::BitmapTextureGL::initializeStencil):
     35        (WebCore::BitmapTextureGL::initializeDepthBuffer):
     36        (WebCore::BitmapTextureGL::clearIfNeeded):
     37        (WebCore::BitmapTextureGL::createFboIfNeeded):
     38        (WebCore::BitmapTextureGL::bindAsSurface):
     39        (WebCore::BitmapTextureGL::~BitmapTextureGL):
     40        (WebCore::BitmapTextureGL::copyFromExternalTexture):
     41        * platform/graphics/texmap/BitmapTextureGL.h:
     42        (WebCore::BitmapTextureGL::create):
     43        (WebCore::BitmapTextureGL::textureTarget const):
     44        (WebCore::BitmapTextureGL::internalFormat const):
     45        * platform/graphics/texmap/BitmapTexturePool.cpp:
     46        (WebCore::BitmapTexturePool::createTexture):
     47        * platform/graphics/texmap/TextureMapperGL.cpp:
     48        (WebCore::TextureMapperGL::bindSurface):
     49        (WebCore::TextureMapperGL::createTexture):
     50
    1512017-08-09  Michael Catanzaro  <mcatanzaro@igalia.com>
    252
  • trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp

    r220397 r220519  
    624624        contextAttributes.initialize();
    625625
    626         auto texture = BitmapTextureGL::create(contextAttributes, *m_context3D);
     626        auto texture = BitmapTextureGL::create(contextAttributes);
    627627        texture->reset(size, GST_VIDEO_INFO_HAS_ALPHA(&videoInfo) ? BitmapTexture::SupportsAlpha : BitmapTexture::NoFlag);
    628628        buffer = std::make_unique<TextureMapperPlatformLayerBuffer>(WTFMove(texture));
  • trunk/Source/WebCore/platform/graphics/texmap/BitmapTextureGL.cpp

    r220399 r220519  
    2727#include "Extensions3D.h"
    2828#include "FilterOperations.h"
    29 #include "GraphicsContext.h"
    3029#include "Image.h"
    3130#include "LengthFunctions.h"
     
    5857}
    5958
    60 BitmapTextureGL::BitmapTextureGL(const TextureMapperContextAttributes& contextAttributes, RefPtr<GraphicsContext3D>&& context3D, const Flags flags, GC3Dint internalFormat)
     59BitmapTextureGL::BitmapTextureGL(const TextureMapperContextAttributes& contextAttributes, const Flags flags, GLint internalFormat)
    6160    : m_contextAttributes(contextAttributes)
    62     , m_context3D(WTFMove(context3D))
    63 {
    64     if (internalFormat != GraphicsContext3D::DONT_CARE) {
     61{
     62    if (internalFormat != GL_DONT_CARE) {
    6563        m_internalFormat = m_format = internalFormat;
    6664        return;
     
    6866
    6967    if (flags & FBOAttachment)
    70         m_internalFormat = m_format = GraphicsContext3D::RGBA;
     68        m_internalFormat = m_format = GL_RGBA;
    7169    else {
    7270        // If GL_EXT_texture_format_BGRA8888 is supported in the OpenGLES
    7371        // internal and external formats need to be BGRA
    74         m_internalFormat = GraphicsContext3D::RGBA;
    75         m_format = GraphicsContext3D::BGRA;
     72        m_internalFormat = GL_RGBA;
     73        m_format = GL_BGRA;
    7674        if (m_contextAttributes.isGLES2Compliant) {
    7775            if (m_contextAttributes.supportsBGRA8888)
    78                 m_internalFormat = GraphicsContext3D::BGRA;
     76                m_internalFormat = GL_BGRA;
    7977            else
    80                 m_format = GraphicsContext3D::RGBA;
     78                m_format = GL_RGBA;
    8179        }
    8280    }
     
    9694{
    9795    if (!m_id)
    98         m_id = m_context3D->createTexture();
     96        glGenTextures(1, &m_id);
    9997
    10098    m_shouldClear = true;
     
    103101
    104102    m_textureSize = contentSize();
    105     m_context3D->bindTexture(GraphicsContext3D::TEXTURE_2D, m_id);
    106     m_context3D->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MIN_FILTER, GraphicsContext3D::LINEAR);
    107     m_context3D->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MAG_FILTER, GraphicsContext3D::LINEAR);
    108     m_context3D->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_S, GraphicsContext3D::CLAMP_TO_EDGE);
    109     m_context3D->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_T, GraphicsContext3D::CLAMP_TO_EDGE);
    110 
    111     m_context3D->texImage2DDirect(GraphicsContext3D::TEXTURE_2D, 0, m_internalFormat, m_textureSize.width(), m_textureSize.height(), 0, m_format, m_type, 0);
    112 }
    113 
    114 void BitmapTextureGL::updateContentsNoSwizzle(const void* srcData, const IntRect& targetRect, const IntPoint& sourceOffset, int bytesPerLine, unsigned bytesPerPixel, Platform3DObject glFormat)
     103    glBindTexture(GL_TEXTURE_2D, m_id);
     104    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
     105    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
     106    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
     107    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
     108
     109    glTexImage2D(GL_TEXTURE_2D, 0, m_internalFormat, m_textureSize.width(), m_textureSize.height(), 0, m_format, m_type, 0);
     110}
     111
     112void BitmapTextureGL::updateContentsNoSwizzle(const void* srcData, const IntRect& targetRect, const IntPoint& sourceOffset, int bytesPerLine, unsigned bytesPerPixel, GLuint glFormat)
    115113{
    116114    // For ES drivers that don't support sub-images.
    117115    bool contextSupportsUnpackSubimage = m_contextAttributes.supportsUnpackSubimage;
    118116
    119     m_context3D->bindTexture(GraphicsContext3D::TEXTURE_2D, m_id);
     117    glBindTexture(GL_TEXTURE_2D, m_id);
    120118
    121119    if (contextSupportsUnpackSubimage) {
    122120        // Use the OpenGL sub-image extension, now that we know it's available.
    123         m_context3D->pixelStorei(GraphicsContext3D::UNPACK_ROW_LENGTH, bytesPerLine / bytesPerPixel);
    124         m_context3D->pixelStorei(GraphicsContext3D::UNPACK_SKIP_ROWS, sourceOffset.y());
    125         m_context3D->pixelStorei(GraphicsContext3D::UNPACK_SKIP_PIXELS, sourceOffset.x());
    126     }
    127 
    128     m_context3D->texSubImage2D(GraphicsContext3D::TEXTURE_2D, 0, targetRect.x(), targetRect.y(), targetRect.width(), targetRect.height(), glFormat, m_type, srcData);
     121        glPixelStorei(GL_UNPACK_ROW_LENGTH, bytesPerLine / bytesPerPixel);
     122        glPixelStorei(GL_UNPACK_SKIP_ROWS, sourceOffset.y());
     123        glPixelStorei(GL_UNPACK_SKIP_PIXELS, sourceOffset.x());
     124    }
     125
     126    glTexSubImage2D(GL_TEXTURE_2D, 0, targetRect.x(), targetRect.y(), targetRect.width(), targetRect.height(), glFormat, m_type, srcData);
    129127
    130128    if (contextSupportsUnpackSubimage) {
    131         m_context3D->pixelStorei(GraphicsContext3D::UNPACK_ROW_LENGTH, 0);
    132         m_context3D->pixelStorei(GraphicsContext3D::UNPACK_SKIP_ROWS, 0);
    133         m_context3D->pixelStorei(GraphicsContext3D::UNPACK_SKIP_PIXELS, 0);
     129        glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
     130        glPixelStorei(GL_UNPACK_SKIP_ROWS, 0);
     131        glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0);
    134132    }
    135133}
     
    137135void BitmapTextureGL::updateContents(const void* srcData, const IntRect& targetRect, const IntPoint& sourceOffset, int bytesPerLine, UpdateContentsFlag updateContentsFlag)
    138136{
    139     m_context3D->bindTexture(GraphicsContext3D::TEXTURE_2D, m_id);
     137    glBindTexture(GL_TEXTURE_2D, m_id);
    140138
    141139    const unsigned bytesPerPixel = 4;
     
    149147
    150148    // prepare temporaryData if necessary
    151     if ((m_format == GraphicsContext3D::RGBA && updateContentsFlag == UpdateCannotModifyOriginalImageData) || requireSubImageBuffer) {
     149    if ((m_format == GL_RGBA && updateContentsFlag == UpdateCannotModifyOriginalImageData) || requireSubImageBuffer) {
    152150        temporaryData.resize(targetRect.width() * targetRect.height() * bytesPerPixel);
    153151        data = temporaryData.data();
     
    166164    }
    167165
    168     if (m_format == GraphicsContext3D::RGBA)
     166    if (m_format == GL_RGBA)
    169167        swizzleBGRAToRGBA(reinterpret_cast_ptr<uint32_t*>(data), IntRect(adjustedSourceOffset, targetRect.size()), bytesPerLine / bytesPerPixel);
    170168
     
    262260        return;
    263261
    264     m_rbo = m_context3D->createRenderbuffer();
    265     m_context3D->bindRenderbuffer(GraphicsContext3D::RENDERBUFFER, m_rbo);
    266     m_context3D->renderbufferStorage(GraphicsContext3D::RENDERBUFFER, GraphicsContext3D::STENCIL_INDEX8, m_textureSize.width(), m_textureSize.height());
    267     m_context3D->bindRenderbuffer(GraphicsContext3D::RENDERBUFFER, 0);
    268     m_context3D->framebufferRenderbuffer(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::STENCIL_ATTACHMENT, GraphicsContext3D::RENDERBUFFER, m_rbo);
    269     m_context3D->clearStencil(0);
    270     m_context3D->clear(GraphicsContext3D::STENCIL_BUFFER_BIT);
     262    glGenRenderbuffers(1, &m_rbo);
     263    glBindRenderbuffer(GL_RENDERBUFFER, m_rbo);
     264    glRenderbufferStorage(GL_RENDERBUFFER, GL_STENCIL_INDEX8, m_textureSize.width(), m_textureSize.height());
     265    glBindRenderbuffer(GL_RENDERBUFFER, 0);
     266    glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, m_rbo);
     267    glClearStencil(0);
     268    glClear(GL_STENCIL_BUFFER_BIT);
    271269}
    272270
     
    276274        return;
    277275
    278     m_depthBufferObject = m_context3D->createRenderbuffer();
    279     m_context3D->bindRenderbuffer(GraphicsContext3D::RENDERBUFFER, m_depthBufferObject);
    280     m_context3D->renderbufferStorage(GraphicsContext3D::RENDERBUFFER, GraphicsContext3D::DEPTH_COMPONENT16, m_textureSize.width(), m_textureSize.height());
    281     m_context3D->bindRenderbuffer(GraphicsContext3D::RENDERBUFFER, 0);
    282     m_context3D->framebufferRenderbuffer(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::DEPTH_ATTACHMENT, GraphicsContext3D::RENDERBUFFER, m_depthBufferObject);
     276    glGenRenderbuffers(1, &m_depthBufferObject);
     277    glBindRenderbuffer(GL_RENDERBUFFER, m_depthBufferObject);
     278    glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, m_textureSize.width(), m_textureSize.height());
     279    glBindRenderbuffer(GL_RENDERBUFFER, 0);
     280    glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, m_depthBufferObject);
    283281}
    284282
     
    290288    m_clipStack.reset(IntRect(IntPoint::zero(), m_textureSize), ClipStack::YAxisMode::Default);
    291289    m_clipStack.applyIfNeeded();
    292     m_context3D->clearColor(0, 0, 0, 0);
    293     m_context3D->clear(GraphicsContext3D::COLOR_BUFFER_BIT);
     290    glClearColor(0, 0, 0, 0);
     291    glClear(GL_COLOR_BUFFER_BIT);
    294292    m_shouldClear = false;
    295293}
     
    300298        return;
    301299
    302     m_fbo = m_context3D->createFramebuffer();
    303     m_context3D->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_fbo);
    304     m_context3D->framebufferTexture2D(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::COLOR_ATTACHMENT0, GraphicsContext3D::TEXTURE_2D, id(), 0);
     300    glGenFramebuffers(1, &m_fbo);
     301    glBindFramebuffer(GL_FRAMEBUFFER, m_fbo);
     302    glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, id(), 0);
    305303    m_shouldClear = true;
    306304}
    307305
    308 void BitmapTextureGL::bindAsSurface(GraphicsContext3D* context3D)
    309 {
    310     context3D->bindTexture(GraphicsContext3D::TEXTURE_2D, 0);
     306void BitmapTextureGL::bindAsSurface()
     307{
     308    glBindTexture(GL_TEXTURE_2D, 0);
    311309    createFboIfNeeded();
    312     context3D->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_fbo);
    313     context3D->viewport(0, 0, m_textureSize.width(), m_textureSize.height());
     310    glBindFramebuffer(GL_FRAMEBUFFER, m_fbo);
     311    glViewport(0, 0, m_textureSize.width(), m_textureSize.height());
    314312    clearIfNeeded();
    315313    m_clipStack.apply();
     
    319317{
    320318    if (m_id)
    321         m_context3D->deleteTexture(m_id);
     319        glDeleteTextures(1, &m_id);
    322320
    323321    if (m_fbo)
    324         m_context3D->deleteFramebuffer(m_fbo);
     322        glDeleteFramebuffers(1, &m_fbo);
    325323
    326324    if (m_rbo)
    327         m_context3D->deleteRenderbuffer(m_rbo);
     325        glDeleteRenderbuffers(1, &m_rbo);
    328326
    329327    if (m_depthBufferObject)
    330         m_context3D->deleteRenderbuffer(m_depthBufferObject);
     328        glDeleteRenderbuffers(1, &m_depthBufferObject);
    331329}
    332330
     
    342340
    343341
    344 void BitmapTextureGL::copyFromExternalTexture(Platform3DObject sourceTextureID)
    345 {
    346     GC3Dint boundTexture = 0;
    347     GC3Dint boundFramebuffer = 0;
    348     GC3Dint boundActiveTexture = 0;
    349 
    350     m_context3D->getIntegerv(GraphicsContext3D::TEXTURE_BINDING_2D, &boundTexture);
    351     m_context3D->getIntegerv(GraphicsContext3D::FRAMEBUFFER_BINDING, &boundFramebuffer);
    352     m_context3D->getIntegerv(GraphicsContext3D::ACTIVE_TEXTURE, &boundActiveTexture);
    353 
    354     m_context3D->bindTexture(GraphicsContext3D::TEXTURE_2D, sourceTextureID);
    355 
    356     Platform3DObject copyFbo = m_context3D->createFramebuffer();
    357     m_context3D->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, copyFbo);
    358     m_context3D->framebufferTexture2D(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::COLOR_ATTACHMENT0, GraphicsContext3D::TEXTURE_2D, sourceTextureID, 0);
    359 
    360     m_context3D->activeTexture(GraphicsContext3D::TEXTURE0);
    361     m_context3D->bindTexture(GraphicsContext3D::TEXTURE_2D, id());
    362     m_context3D->copyTexSubImage2D(GraphicsContext3D::TEXTURE_2D, 0, 0, 0, 0, 0, m_textureSize.width(), m_textureSize.height());
    363 
    364     m_context3D->bindTexture(GraphicsContext3D::TEXTURE_2D, boundTexture);
    365     m_context3D->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, boundFramebuffer);
    366     m_context3D->bindTexture(GraphicsContext3D::TEXTURE_2D, boundTexture);
    367     m_context3D->activeTexture(boundActiveTexture);
    368     m_context3D->deleteFramebuffer(copyFbo);
     342void BitmapTextureGL::copyFromExternalTexture(GLuint sourceTextureID)
     343{
     344    GLint boundTexture = 0;
     345    GLint boundFramebuffer = 0;
     346    GLint boundActiveTexture = 0;
     347
     348    glGetIntegerv(GL_TEXTURE_BINDING_2D, &boundTexture);
     349    glGetIntegerv(GL_FRAMEBUFFER_BINDING, &boundFramebuffer);
     350    glGetIntegerv(GL_ACTIVE_TEXTURE, &boundActiveTexture);
     351
     352    glBindTexture(GL_TEXTURE_2D, sourceTextureID);
     353
     354    GLuint copyFbo = 0;
     355    glGenFramebuffers(1, &copyFbo);
     356    glBindFramebuffer(GL_FRAMEBUFFER, copyFbo);
     357    glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, sourceTextureID, 0);
     358
     359    glActiveTexture(GL_TEXTURE0);
     360    glBindTexture(GL_TEXTURE_2D, id());
     361    glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, m_textureSize.width(), m_textureSize.height());
     362
     363    glBindTexture(GL_TEXTURE_2D, boundTexture);
     364    glBindFramebuffer(GL_FRAMEBUFFER, boundFramebuffer);
     365    glBindTexture(GL_TEXTURE_2D, boundTexture);
     366    glActiveTexture(boundActiveTexture);
     367    glDeleteFramebuffers(1, &copyFbo);
    369368}
    370369
  • trunk/Source/WebCore/platform/graphics/texmap/BitmapTextureGL.h

    r220392 r220519  
    2727#include "ClipStack.h"
    2828#include "FilterOperation.h"
    29 #include "GraphicsContext3D.h"
    3029#include "IntSize.h"
    3130#include "TextureMapperContextAttributes.h"
    3231#include "TextureMapperGL.h"
     32#include "TextureMapperGLHeaders.h"
    3333
    3434namespace WebCore {
     
    4040class BitmapTextureGL : public BitmapTexture {
    4141public:
    42     static Ref<BitmapTexture> create(const TextureMapperContextAttributes& contextAttributes, Ref<GraphicsContext3D>&& context3D, const Flags flags = NoFlag, GC3Dint internalFormat = GraphicsContext3D::DONT_CARE)
     42    static Ref<BitmapTexture> create(const TextureMapperContextAttributes& contextAttributes, const Flags flags = NoFlag, GLint internalFormat = GL_DONT_CARE)
    4343    {
    44         return adoptRef(*new BitmapTextureGL(contextAttributes, WTFMove(context3D), flags, internalFormat));
     44        return adoptRef(*new BitmapTextureGL(contextAttributes, flags, internalFormat));
    4545    }
    4646
     
    5050    bool isValid() const override;
    5151    void didReset() override;
    52     void bindAsSurface(GraphicsContext3D*);
     52    void bindAsSurface();
    5353    void initializeStencil();
    5454    void initializeDepthBuffer();
    5555    virtual uint32_t id() const { return m_id; }
    56     uint32_t textureTarget() const { return GraphicsContext3D::TEXTURE_2D; }
     56    uint32_t textureTarget() const { return GL_TEXTURE_2D; }
    5757    IntSize textureSize() const { return m_textureSize; }
    5858    void updateContents(Image*, const IntRect&, const IntPoint&, UpdateContentsFlag) override;
    5959    void updateContents(const void*, const IntRect& target, const IntPoint& sourceOffset, int bytesPerLine, UpdateContentsFlag) override;
    60     void updateContentsNoSwizzle(const void*, const IntRect& target, const IntPoint& sourceOffset, int bytesPerLine, unsigned bytesPerPixel = 4, Platform3DObject glFormat = GraphicsContext3D::RGBA);
     60    void updateContentsNoSwizzle(const void*, const IntRect& target, const IntPoint& sourceOffset, int bytesPerLine, unsigned bytesPerPixel = 4, GLuint glFormat = GL_RGBA);
    6161    bool isBackedByOpenGL() const override { return true; }
    6262
     
    7676    ClipStack& clipStack() { return m_clipStack; }
    7777
    78     GC3Dint internalFormat() const { return m_internalFormat; }
     78    GLint internalFormat() const { return m_internalFormat; }
    7979
    80     void copyFromExternalTexture(Platform3DObject textureID);
     80    void copyFromExternalTexture(GLuint textureID);
    8181
    8282private:
    83     BitmapTextureGL(const TextureMapperContextAttributes&, RefPtr<GraphicsContext3D>&&, const Flags, GC3Dint internalFormat);
     83    BitmapTextureGL(const TextureMapperContextAttributes&, const Flags, GLint internalFormat);
    8484
    85     Platform3DObject m_id { 0 };
     85    GLuint m_id { 0 };
    8686    IntSize m_textureSize;
    8787    IntRect m_dirtyRect;
    88     Platform3DObject m_fbo { 0 };
    89     Platform3DObject m_rbo { 0 };
    90     Platform3DObject m_depthBufferObject { 0 };
     88    GLuint m_fbo { 0 };
     89    GLuint m_rbo { 0 };
     90    GLuint m_depthBufferObject { 0 };
    9191    bool m_shouldClear { true };
    9292    ClipStack m_clipStack;
    9393    TextureMapperContextAttributes m_contextAttributes;
    94     RefPtr<GraphicsContext3D> m_context3D;
    9594
    9695    void clearIfNeeded();
     
    9998    FilterInfo m_filterInfo;
    10099
    101     GC3Dint m_internalFormat;
    102     GC3Denum m_format;
    103     GC3Denum m_type {
     100    GLint m_internalFormat;
     101    GLenum m_format;
     102    GLenum m_type {
    104103#if OS(DARWIN)
    105104        GL_UNSIGNED_INT_8_8_8_8_REV
    106105#else
    107         GraphicsContext3D::UNSIGNED_BYTE
     106        GL_UNSIGNED_BYTE
    108107#endif
    109108    };
  • trunk/Source/WebCore/platform/graphics/texmap/BitmapTexturePool.cpp

    r220392 r220519  
    9595{
    9696#if USE(TEXTURE_MAPPER_GL)
    97     return BitmapTextureGL::create(m_contextAttributes, *m_context3D, flags);
     97    return BitmapTextureGL::create(m_contextAttributes, flags);
    9898#else
    9999    UNUSED_PARAM(flags);
  • trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp

    r220399 r220519  
    665665    }
    666666
    667     static_cast<BitmapTextureGL*>(surface)->bindAsSurface(m_context3D.get());
     667    static_cast<BitmapTextureGL*>(surface)->bindAsSurface();
    668668    data().projectionMatrix = createProjectionMatrix(surface->size(), true /* mirrored */);
    669669    data().currentSurface = surface;
     
    761761Ref<BitmapTexture> TextureMapperGL::createTexture(GC3Dint internalFormat)
    762762{
    763     return BitmapTextureGL::create(m_contextAttributes, *m_context3D, internalFormat);
     763    return BitmapTextureGL::create(m_contextAttributes, internalFormat);
    764764}
    765765
Note: See TracChangeset for help on using the changeset viewer.