| Index: Source/platform/graphics/gpu/DrawingBuffer.cpp
|
| diff --git a/Source/platform/graphics/gpu/DrawingBuffer.cpp b/Source/platform/graphics/gpu/DrawingBuffer.cpp
|
| index 007c41bbc667e6ebc322b765ccb90b5195a5beb0..db38a9e5e27a53186642fac4cc624e268a771cbc 100644
|
| --- a/Source/platform/graphics/gpu/DrawingBuffer.cpp
|
| +++ b/Source/platform/graphics/gpu/DrawingBuffer.cpp
|
| @@ -105,6 +105,11 @@ PassRefPtr<DrawingBuffer> DrawingBuffer::create(PassOwnPtr<WebGraphicsContext3D>
|
| extensionsUtil->ensureExtensionEnabled("GL_EXT_discard_framebuffer");
|
|
|
| RefPtr<DrawingBuffer> drawingBuffer = adoptRef(new DrawingBuffer(context, extensionsUtil.release(), multisampleSupported, packedDepthStencilSupported, discardFramebufferSupported, preserve, requestedAttributes));
|
| + Platform::current()->getGPUBlackList(&drawingBuffer->m_gpuBlackList);
|
| + // determineRGBTextureSupport() if GL_RGB not supported
|
| + if (!drawingBuffer->gpuBlackList().IsRGBTextureSupported())
|
| + drawingBuffer->determineRGBTextureSupport();
|
| +
|
| if (!drawingBuffer->initialize(size)) {
|
| drawingBuffer->beginDestruction();
|
| return PassRefPtr<DrawingBuffer>();
|
| @@ -150,6 +155,7 @@ DrawingBuffer::DrawingBuffer(PassOwnPtr<WebGraphicsContext3D> context,
|
| , m_destructionInProgress(false)
|
| , m_isHidden(false)
|
| , m_filterQuality(kLow_SkFilterQuality)
|
| + , m_RGBTextureSupported(true)
|
| {
|
| // Used by browser tests to detect the use of a DrawingBuffer.
|
| TRACE_EVENT_INSTANT0("test_gpu", "DrawingBufferCreation", TRACE_EVENT_SCOPE_GLOBAL);
|
| @@ -403,7 +409,7 @@ bool DrawingBuffer::initialize(const IntSize& size)
|
| return false;
|
| }
|
|
|
| - if (m_requestedAttributes.alpha) {
|
| + if (m_requestedAttributes.alpha || !isRGBTextureSupported()) {
|
| m_internalColorFormat = GL_RGBA;
|
| m_colorFormat = GL_RGBA;
|
| m_internalRenderbufferFormat = GL_RGBA8_OES;
|
| @@ -715,6 +721,9 @@ void DrawingBuffer::clearFramebuffers(GLbitfield clearMask)
|
|
|
| m_context->bindFramebuffer(GL_FRAMEBUFFER, m_multisampleFBO ? m_multisampleFBO : m_fbo);
|
| m_context->clear(clearMask);
|
| +
|
| + if (!m_requestedAttributes.alpha && !isRGBTextureSupported())
|
| + m_context->colorMask(true, true, true, false);
|
| }
|
|
|
| void DrawingBuffer::setSize(const IntSize& size)
|
| @@ -987,4 +996,26 @@ void DrawingBuffer::deleteChromiumImageForTexture(TextureInfo* info)
|
| }
|
| }
|
|
|
| +void DrawingBuffer::determineRGBTextureSupport()
|
| +{
|
| + // One time validation is required for GL_RGB texture
|
| + // so that DrawingBuffer can choose format for the backbuffer correctly.
|
| + // DrawingBuffer tries to allocate GL_RGB texture in case of alpha attribute false
|
| + // and fails because GL_RGB not supported on specific GPU's (e.g Mali- 2/3/400 family).
|
| + Platform3DObject fbo = m_context->createFramebuffer();
|
| + m_context->bindFramebuffer(GL_FRAMEBUFFER, fbo);
|
| + unsigned offscreenRGBTexture = createColorTexture();
|
| + m_context->texImage2D(GL_TEXTURE_2D, 0, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
|
| + m_context->framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, offscreenRGBTexture, 0);
|
| + m_RGBTextureSupported = m_context->checkFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE;
|
| +
|
| + if (fbo) {
|
| + m_context->deleteFramebuffer(fbo);
|
| + m_context->bindFramebuffer(GL_FRAMEBUFFER, 0);
|
| + }
|
| +
|
| + if (offscreenRGBTexture)
|
| + m_context->deleteTexture(offscreenRGBTexture);
|
| +}
|
| +
|
| } // namespace blink
|
|
|