Modified: trunk/Source/WebCore/ChangeLog (87364 => 87365)
--- trunk/Source/WebCore/ChangeLog 2011-05-26 06:58:55 UTC (rev 87364)
+++ trunk/Source/WebCore/ChangeLog 2011-05-26 07:01:06 UTC (rev 87365)
@@ -1,3 +1,20 @@
+2011-05-26 Alok Priyadarshi <[email protected]>
+
+ Reviewed by James Robinson.
+
+ [chromium] Cannot create stencil render-buffer for accelerated drawing on desktop GL
+ https://bugs.webkit.org/show_bug.cgi?id=61444
+
+ Used DEPTH24_STENCIL8 format for stencil buffer instead of STENCIL_INDEX8.
+ Packed depth-stencil buffer is the most common format supported by graphics cards.
+ It is not very robust to rely on just one format being supported,
+ so long term the task of creating FBO should be delegated to SKIA,
+ which has necessary code to iterate through all possible formats.
+
+ * platform/graphics/chromium/LayerTextureUpdaterCanvas.cpp:
+ (WebCore::LayerTextureUpdaterSkPicture::deleteFrameBuffer):
+ (WebCore::LayerTextureUpdaterSkPicture::createFrameBuffer):
+
2011-05-25 Jer Noble <[email protected]>
Reviewed by Dan Bernstein.
Modified: trunk/Source/WebCore/platform/graphics/chromium/LayerTextureUpdaterCanvas.cpp (87364 => 87365)
--- trunk/Source/WebCore/platform/graphics/chromium/LayerTextureUpdaterCanvas.cpp 2011-05-26 06:58:55 UTC (rev 87364)
+++ trunk/Source/WebCore/platform/graphics/chromium/LayerTextureUpdaterCanvas.cpp 2011-05-26 07:01:06 UTC (rev 87365)
@@ -30,6 +30,7 @@
#include "LayerTextureUpdaterCanvas.h"
+#include "Extensions3D.h"
#include "GraphicsContext.h"
#include "LayerPainterChromium.h"
#include "LayerTexture.h"
@@ -95,7 +96,7 @@
, m_skiaContext(skiaContext)
, m_createFrameBuffer(false)
, m_fbo(0)
- , m_stencilBuffer(0)
+ , m_depthStencilBuffer(0)
{
}
@@ -159,10 +160,14 @@
{
m_canvas.clear();
- if (m_stencilBuffer)
- context()->deleteRenderbuffer(m_stencilBuffer);
- if (m_fbo)
+ if (m_depthStencilBuffer) {
+ context()->deleteRenderbuffer(m_depthStencilBuffer);
+ m_depthStencilBuffer = 0;
+ }
+ if (m_fbo) {
context()->deleteFramebuffer(m_fbo);
+ m_fbo = 0;
+ }
}
bool LayerTextureUpdaterSkPicture::createFrameBuffer()
@@ -176,6 +181,19 @@
if (!contextAttribs.stencil)
return false;
+ // SKIA only needs color and stencil buffers, not depth buffer.
+ // But it is very uncommon for cards to support color + stencil FBO config.
+ // The most common config is color + packed-depth-stencil.
+ // Instead of iterating through all possible FBO configs, we only try the
+ // most common one here.
+ // FIXME: Delegate the task of creating frame-buffer to SKIA.
+ // It has all necessary code to iterate through all possible configs
+ // and choose the one most suitable for its purposes.
+ Extensions3D* extensions = context()->getExtensions();
+ if (!extensions->supports("GL_OES_packed_depth_stencil"))
+ return false;
+ extensions->ensureEnabled("GL_OES_packed_depth_stencil");
+
// Create and bind a frame-buffer-object.
m_fbo = context()->createFramebuffer();
if (!m_fbo)
@@ -185,15 +203,15 @@
// We just need to create a stencil buffer for FBO.
// The color buffer (texture) will be provided by tiles.
// SKIA does not need depth buffer.
- m_stencilBuffer = context()->createRenderbuffer();
- if (!m_stencilBuffer) {
- context()->deleteFramebuffer(m_fbo);
- m_fbo = 0;
+ m_depthStencilBuffer = context()->createRenderbuffer();
+ if (!m_depthStencilBuffer) {
+ deleteFrameBuffer();
return false;
}
- context()->bindRenderbuffer(GraphicsContext3D::RENDERBUFFER, m_stencilBuffer);
- context()->renderbufferStorage(GraphicsContext3D::RENDERBUFFER, GraphicsContext3D::STENCIL_INDEX8, m_bufferSize.width(), m_bufferSize.height());
- context()->framebufferRenderbuffer(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::STENCIL_ATTACHMENT, GraphicsContext3D::RENDERBUFFER, m_stencilBuffer);
+ context()->bindRenderbuffer(GraphicsContext3D::RENDERBUFFER, m_depthStencilBuffer);
+ context()->renderbufferStorage(GraphicsContext3D::RENDERBUFFER, Extensions3D::DEPTH24_STENCIL8, m_bufferSize.width(), m_bufferSize.height());
+ context()->framebufferRenderbuffer(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::STENCIL_ATTACHMENT, GraphicsContext3D::RENDERBUFFER, m_depthStencilBuffer);
+ context()->framebufferRenderbuffer(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::DEPTH_ATTACHMENT, GraphicsContext3D::RENDERBUFFER, m_depthStencilBuffer);
// Create a skia gpu canvas.
GrPlatformSurfaceDesc targetDesc;
Modified: trunk/Source/WebCore/platform/graphics/chromium/LayerTextureUpdaterCanvas.h (87364 => 87365)
--- trunk/Source/WebCore/platform/graphics/chromium/LayerTextureUpdaterCanvas.h 2011-05-26 06:58:55 UTC (rev 87364)
+++ trunk/Source/WebCore/platform/graphics/chromium/LayerTextureUpdaterCanvas.h 2011-05-26 07:01:06 UTC (rev 87365)
@@ -99,7 +99,7 @@
SkPicture m_picture; // Recording canvas.
IntSize m_bufferSize; // Frame buffer size.
Platform3DObject m_fbo; // Frame buffer id.
- Platform3DObject m_stencilBuffer;
+ Platform3DObject m_depthStencilBuffer;
OwnPtr<SkCanvas> m_canvas; // GPU accelerated canvas.
};
#endif // SKIA