| Index: third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp
|
| diff --git a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp
|
| index e6864d459e5de4d37a5b0bcc7d79035ee0167144..e23fd131b29d83212f79edc7d535dd7f7848e27e 100644
|
| --- a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp
|
| +++ b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp
|
| @@ -276,12 +276,7 @@ bool DrawingBuffer::prepareMailbox(WebExternalTextureMailbox* outMailbox, WebExt
|
|
|
| // No buffer available to recycle, create a new one.
|
| if (!frontColorBufferMailbox) {
|
| - TextureInfo newTexture = createTextureAndAllocateMemory(m_size);
|
| - // Bad things happened, abandon ship.
|
| - if (!newTexture.textureId)
|
| - return false;
|
| -
|
| - frontColorBufferMailbox = createNewMailbox(newTexture);
|
| + frontColorBufferMailbox = createNewMailbox(createTextureAndAllocateMemory(m_size));
|
| }
|
|
|
| if (m_preserveDrawingBuffer == Discard) {
|
| @@ -439,7 +434,7 @@ void DrawingBuffer::deleteMailbox(const WebExternalTextureMailbox& mailbox)
|
|
|
| deleteChromiumImageForTexture(&m_textureMailboxes[i]->textureInfo);
|
|
|
| - m_context->deleteTexture(m_textureMailboxes[i]->textureInfo.textureId);
|
| + m_gl->DeleteTextures(1, &m_textureMailboxes[i]->textureInfo.textureId);
|
| m_textureMailboxes.remove(i);
|
| return;
|
| }
|
| @@ -469,7 +464,7 @@ bool DrawingBuffer::initialize(const IntSize& size)
|
| }
|
| m_sampleCount = std::min(4, maxSampleCount);
|
|
|
| - m_fbo = m_context->createFramebuffer();
|
| + m_gl->GenFramebuffers(1, &m_fbo);
|
|
|
| m_gl->BindFramebuffer(GL_FRAMEBUFFER, m_fbo);
|
| createSecondaryBuffers();
|
| @@ -550,7 +545,7 @@ bool DrawingBuffer::copyToPlatformTexture(WebGraphicsContext3D* context, gpu::gl
|
|
|
| gl->CopyTextureCHROMIUM(sourceTexture, texture, internalFormat, destType, flipY, unpackPremultiplyAlphaNeeded, unpackUnpremultiplyAlphaNeeded);
|
|
|
| - context->deleteTexture(sourceTexture);
|
| + gl->DeleteTextures(1, &sourceTexture);
|
|
|
| const GLuint64 fenceSync = gl->InsertFenceSyncCHROMIUM();
|
|
|
| @@ -601,20 +596,20 @@ void DrawingBuffer::beginDestruction()
|
| deleteMailbox(m_recycledMailboxQueue.takeLast());
|
|
|
| if (m_multisampleFBO)
|
| - m_context->deleteFramebuffer(m_multisampleFBO);
|
| + m_gl->DeleteFramebuffers(1, &m_multisampleFBO);
|
|
|
| if (m_fbo)
|
| - m_context->deleteFramebuffer(m_fbo);
|
| + m_gl->DeleteFramebuffers(1, &m_fbo);
|
|
|
| if (m_multisampleColorBuffer)
|
| - m_context->deleteRenderbuffer(m_multisampleColorBuffer);
|
| + m_gl->DeleteRenderbuffers(1, &m_multisampleColorBuffer);
|
|
|
| if (m_depthStencilBuffer)
|
| - m_context->deleteRenderbuffer(m_depthStencilBuffer);
|
| + m_gl->DeleteRenderbuffers(1, &m_depthStencilBuffer);
|
|
|
| if (m_colorBuffer.textureId) {
|
| deleteChromiumImageForTexture(&m_colorBuffer);
|
| - m_context->deleteTexture(m_colorBuffer.textureId);
|
| + m_gl->DeleteTextures(1, &m_colorBuffer.textureId);
|
| }
|
|
|
| setSize(IntSize());
|
| @@ -632,16 +627,13 @@ void DrawingBuffer::beginDestruction()
|
|
|
| WebGLId DrawingBuffer::createColorTexture(const TextureParameters& parameters)
|
| {
|
| - WebGLId offscreenColorTexture = m_context->createTexture();
|
| - if (!offscreenColorTexture)
|
| - return 0;
|
| -
|
| + GLuint offscreenColorTexture;
|
| + m_gl->GenTextures(1, &offscreenColorTexture);
|
| m_gl->BindTexture(parameters.target, offscreenColorTexture);
|
| m_gl->TexParameteri(parameters.target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
| m_gl->TexParameteri(parameters.target, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
| m_gl->TexParameteri(parameters.target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
| m_gl->TexParameteri(parameters.target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
| -
|
| return offscreenColorTexture;
|
| }
|
|
|
| @@ -649,9 +641,9 @@ void DrawingBuffer::createSecondaryBuffers()
|
| {
|
| // create a multisample FBO
|
| if (m_antiAliasingMode == MSAAExplicitResolve) {
|
| - m_multisampleFBO = m_context->createFramebuffer();
|
| + m_gl->GenFramebuffers(1, &m_multisampleFBO);
|
| m_gl->BindFramebuffer(GL_FRAMEBUFFER, m_multisampleFBO);
|
| - m_multisampleColorBuffer = m_context->createRenderbuffer();
|
| + m_gl->GenRenderbuffers(1, &m_multisampleColorBuffer);
|
| }
|
| }
|
|
|
| @@ -692,7 +684,7 @@ void DrawingBuffer::resizeDepthStencil(const IntSize& size)
|
| return;
|
|
|
| if (!m_depthStencilBuffer)
|
| - m_depthStencilBuffer = m_context->createRenderbuffer();
|
| + m_gl->GenRenderbuffers(1, &m_depthStencilBuffer);
|
| m_gl->BindRenderbuffer(GL_RENDERBUFFER, m_depthStencilBuffer);
|
| if (m_antiAliasingMode == MSAAImplicitResolve)
|
| m_gl->RenderbufferStorageMultisampleEXT(GL_RENDERBUFFER, m_sampleCount, GL_DEPTH24_STENCIL8_OES, size.width(), size.height());
|
| @@ -878,9 +870,9 @@ bool DrawingBuffer::paintRenderingResultsToImageData(int& width, int& height, So
|
|
|
| WTF::ArrayBufferContents pixels(width * height, 4, WTF::ArrayBufferContents::NotShared, WTF::ArrayBufferContents::DontInitialize);
|
|
|
| - GLint fbo = 0;
|
| + GLuint fbo = 0;
|
| if (sourceBuffer == FrontBuffer && m_frontColorBuffer.texInfo.textureId) {
|
| - fbo = m_context->createFramebuffer();
|
| + m_gl->GenFramebuffers(1, &fbo);
|
| m_gl->BindFramebuffer(GL_FRAMEBUFFER, fbo);
|
| m_gl->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, m_frontColorBuffer.texInfo.parameters.target, m_frontColorBuffer.texInfo.textureId, 0);
|
| } else {
|
| @@ -892,7 +884,7 @@ bool DrawingBuffer::paintRenderingResultsToImageData(int& width, int& height, So
|
|
|
| if (fbo) {
|
| m_gl->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, m_frontColorBuffer.texInfo.parameters.target, 0, 0);
|
| - m_context->deleteFramebuffer(fbo);
|
| + m_gl->DeleteFramebuffers(1, &fbo);
|
| }
|
|
|
| restoreFramebufferBindings();
|
| @@ -982,11 +974,6 @@ DrawingBuffer::TextureInfo DrawingBuffer::createTextureAndAllocateMemory(const I
|
| return createDefaultTextureAndAllocateMemory(size);
|
|
|
| WebGLId textureId = createColorTexture(parameters);
|
| - if (!textureId) {
|
| - m_gl->DestroyImageCHROMIUM(imageId);
|
| - return createDefaultTextureAndAllocateMemory(size);
|
| - }
|
| -
|
| m_gl->BindTexImage2DCHROMIUM(parameters.target, imageId);
|
|
|
| TextureInfo info;
|
|
|