Diff
Modified: trunk/Source/WebCore/ChangeLog (88834 => 88835)
--- trunk/Source/WebCore/ChangeLog 2011-06-14 18:31:03 UTC (rev 88834)
+++ trunk/Source/WebCore/ChangeLog 2011-06-14 18:32:36 UTC (rev 88835)
@@ -1,3 +1,59 @@
+2011-06-14 James Robinson <[email protected]>
+
+ Reviewed by Stephen White.
+
+ [chromium] Compositor shader initialization is inefficient
+ https://bugs.webkit.org/show_bug.cgi?id=62618
+
+ This fixes several issues causing slowdowns in compositor shader initialization, mostly due to lack of
+ parallelism:
+
+ - Avoid initializing all programs eagerly. We only use two programs on every page, the other programs depend on
+ content and are constructed on demand.
+
+ - Defer querying uniform locations until draw time. For the eagerly constructed programs (render surface +
+ tiler) this means that the GPU process has a chance to compile the shader while the renderer is busy
+ painting+uploading instead of blocking on shader compilation in order to get uniform locations.
+
+ - Calls to query COMPILE_STATUS/LINK_STATUS moved behind #ifndef NDEBUG guards since these should never fail in
+ release builds and force synchronous compilation/linking.
+
+ This also adds a number of TRACE_EVENT()s to make analysing the performance of this bit of code easier.
+
+ * platform/graphics/chromium/LayerRendererChromium.cpp:
+ (WebCore::LayerRendererChromium::updateLayers):
+ (WebCore::LayerRendererChromium::initializeSharedObjects):
+ (WebCore::LayerRendererChromium::borderProgram):
+ (WebCore::LayerRendererChromium::headsUpDisplayProgram):
+ (WebCore::LayerRendererChromium::renderSurfaceProgram):
+ (WebCore::LayerRendererChromium::renderSurfaceMaskProgram):
+ (WebCore::LayerRendererChromium::tilerProgram):
+ (WebCore::LayerRendererChromium::canvasLayerProgram):
+ (WebCore::LayerRendererChromium::pluginLayerProgram):
+ (WebCore::LayerRendererChromium::videoLayerRGBAProgram):
+ (WebCore::LayerRendererChromium::videoLayerYUVProgram):
+ * platform/graphics/chromium/LayerRendererChromium.h:
+ * platform/graphics/chromium/LayerTextureSubImage.cpp:
+ (WebCore::LayerTextureSubImage::uploadWithTexSubImage):
+ (WebCore::LayerTextureSubImage::uploadWithMapTexSubImage):
+ * platform/graphics/chromium/ProgramBinding.cpp:
+ (WebCore::ProgramBindingBase::init):
+ (WebCore::ProgramBindingBase::loadShader):
+ (WebCore::ProgramBindingBase::createShaderProgram):
+ * platform/graphics/chromium/ProgramBinding.h:
+ (WebCore::ProgramBinding::ProgramBinding):
+ (WebCore::ProgramBinding::initialize):
+ * platform/graphics/chromium/ShaderChromium.cpp:
+ (WebCore::VertexShaderPosTex::init):
+ (WebCore::VertexShaderPosTexYUVStretch::init):
+ (WebCore::VertexShaderPos::init):
+ (WebCore::VertexShaderPosTexTransform::init):
+ (WebCore::FragmentTexAlphaBinding::init):
+ (WebCore::FragmentShaderRGBATexAlphaMask::init):
+ (WebCore::FragmentShaderYUVVideo::init):
+ (WebCore::FragmentShaderColor::init):
+ * platform/graphics/chromium/ShaderChromium.h:
+
2011-06-14 Stephanie Lewis <[email protected]>
Rubber stamped by Oliver Hunt.
Modified: trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp (88834 => 88835)
--- trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp 2011-06-14 18:31:03 UTC (rev 88834)
+++ trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp 2011-06-14 18:32:36 UTC (rev 88835)
@@ -349,7 +349,10 @@
updateCompositorResources(renderSurfaceLayerList);
// Update compositor resources for root layer.
- m_rootLayerContentTiler->updateRect();
+ {
+ TRACE_EVENT("LayerRendererChromium::updateLayer::updateRoot", this, 0);
+ m_rootLayerContentTiler->updateRect();
+ }
// After updateCompositorResources, set/wait latches for all child
// contexts. This will prevent the compositor from using any of the child
@@ -1074,6 +1077,7 @@
bool LayerRendererChromium::initializeSharedObjects()
{
+ TRACE_EVENT("LayerRendererChromium::initializeSharedObjects", this, 0);
makeContextCurrent();
// Get the max texture size supported by the system.
@@ -1083,32 +1087,116 @@
// Create an FBO for doing offscreen rendering.
GLC(m_context.get(), m_offscreenFramebufferId = m_context->createFramebuffer());
+ // We will always need these programs to render, so create the programs eagerly so that the shader compilation can
+ // start while we do other work. Other programs are created lazily on first access.
m_sharedGeometry = adoptPtr(new GeometryBinding(m_context.get()));
- m_borderProgram = adoptPtr(new LayerChromium::BorderProgram(m_context.get()));
- m_headsUpDisplayProgram = adoptPtr(new CCHeadsUpDisplay::Program(m_context.get()));
- m_canvasLayerProgram = adoptPtr(new CCCanvasLayerImpl::Program(m_context.get()));
- m_videoLayerRGBAProgram = adoptPtr(new CCVideoLayerImpl::RGBAProgram(m_context.get()));
- m_videoLayerYUVProgram = adoptPtr(new CCVideoLayerImpl::YUVProgram(m_context.get()));
- m_pluginLayerProgram = adoptPtr(new CCPluginLayerImpl::Program(m_context.get()));
m_renderSurfaceProgram = adoptPtr(new RenderSurfaceChromium::Program(m_context.get()));
- m_renderSurfaceMaskProgram = adoptPtr(new RenderSurfaceChromium::MaskProgram(m_context.get()));
m_tilerProgram = adoptPtr(new LayerTilerChromium::Program(m_context.get()));
- if (!m_sharedGeometry->initialized() || !m_borderProgram->initialized()
- || !m_canvasLayerProgram->initialized()
- || !m_headsUpDisplayProgram->initialized()
- || !m_videoLayerRGBAProgram->initialized() || !m_videoLayerYUVProgram->initialized()
- || !m_pluginLayerProgram->initialized() || !m_renderSurfaceProgram->initialized()
- || !m_renderSurfaceMaskProgram->initialized() || !m_tilerProgram->initialized()) {
- LOG_ERROR("Compositor failed to initialize shaders. Falling back to software.");
- cleanupSharedObjects();
- return false;
- }
+ GLC(m_context.get(), m_context->flush());
m_textureManager = TextureManager::create(m_context.get(), textureMemoryLimitBytes, m_maxTextureSize);
return true;
}
+const LayerChromium::BorderProgram* LayerRendererChromium::borderProgram()
+{
+ if (!m_borderProgram)
+ m_borderProgram = adoptPtr(new LayerChromium::BorderProgram(m_context.get()));
+ if (!m_borderProgram->initialized()) {
+ TRACE_EVENT("LayerRendererChromium::borderProgram::initialize", this, 0);
+ m_borderProgram->initialize();
+ }
+ return m_borderProgram.get();
+}
+
+const CCHeadsUpDisplay::Program* LayerRendererChromium::headsUpDisplayProgram()
+{
+ if (!m_headsUpDisplayProgram)
+ m_headsUpDisplayProgram = adoptPtr(new CCHeadsUpDisplay::Program(m_context.get()));
+ if (!m_headsUpDisplayProgram->initialized()) {
+ TRACE_EVENT("LayerRendererChromium::borderProgram::initialize", this, 0);
+ m_headsUpDisplayProgram->initialize();
+ }
+ return m_headsUpDisplayProgram.get();
+}
+
+const RenderSurfaceChromium::Program* LayerRendererChromium::renderSurfaceProgram()
+{
+ ASSERT(m_renderSurfaceProgram);
+ if (!m_renderSurfaceProgram->initialized()) {
+ TRACE_EVENT("LayerRendererChromium::borderProgram::initialize", this, 0);
+ m_renderSurfaceProgram->initialize();
+ }
+ return m_renderSurfaceProgram.get();
+}
+
+const RenderSurfaceChromium::MaskProgram* LayerRendererChromium::renderSurfaceMaskProgram()
+{
+ if (!m_renderSurfaceMaskProgram)
+ m_renderSurfaceMaskProgram = adoptPtr(new RenderSurfaceChromium::MaskProgram(m_context.get()));
+ if (!m_renderSurfaceMaskProgram->initialized()) {
+ TRACE_EVENT("LayerRendererChromium::borderProgram::initialize", this, 0);
+ m_renderSurfaceMaskProgram->initialize();
+ }
+ return m_renderSurfaceMaskProgram.get();
+}
+
+const LayerTilerChromium::Program* LayerRendererChromium::tilerProgram()
+{
+ ASSERT(m_tilerProgram);
+ if (!m_tilerProgram->initialized()) {
+ TRACE_EVENT("LayerRendererChromium::borderProgram::initialize", this, 0);
+ m_tilerProgram->initialize();
+ }
+ return m_tilerProgram.get();
+}
+
+const CCCanvasLayerImpl::Program* LayerRendererChromium::canvasLayerProgram()
+{
+ if (!m_canvasLayerProgram)
+ m_canvasLayerProgram = adoptPtr(new CCCanvasLayerImpl::Program(m_context.get()));
+ if (!m_canvasLayerProgram->initialized()) {
+ TRACE_EVENT("LayerRendererChromium::borderProgram::initialize", this, 0);
+ m_canvasLayerProgram->initialize();
+ }
+ return m_canvasLayerProgram.get();
+}
+
+const CCPluginLayerImpl::Program* LayerRendererChromium::pluginLayerProgram()
+{
+ if (!m_pluginLayerProgram)
+ m_pluginLayerProgram = adoptPtr(new CCPluginLayerImpl::Program(m_context.get()));
+ if (!m_pluginLayerProgram->initialized()) {
+ TRACE_EVENT("LayerRendererChromium::borderProgram::initialize", this, 0);
+ m_pluginLayerProgram->initialize();
+ }
+ return m_pluginLayerProgram.get();
+}
+
+const CCVideoLayerImpl::RGBAProgram* LayerRendererChromium::videoLayerRGBAProgram()
+{
+ if (!m_videoLayerRGBAProgram)
+ m_videoLayerRGBAProgram = adoptPtr(new CCVideoLayerImpl::RGBAProgram(m_context.get()));
+ if (!m_videoLayerRGBAProgram->initialized()) {
+ TRACE_EVENT("LayerRendererChromium::borderProgram::initialize", this, 0);
+ m_videoLayerRGBAProgram->initialize();
+ }
+ return m_videoLayerRGBAProgram.get();
+}
+
+const CCVideoLayerImpl::YUVProgram* LayerRendererChromium::videoLayerYUVProgram()
+{
+ if (!m_videoLayerYUVProgram)
+ m_videoLayerYUVProgram = adoptPtr(new CCVideoLayerImpl::YUVProgram(m_context.get()));
+ if (!m_videoLayerYUVProgram->initialized()) {
+ TRACE_EVENT("LayerRendererChromium::borderProgram::initialize", this, 0);
+ m_videoLayerYUVProgram->initialize();
+ }
+ return m_videoLayerYUVProgram.get();
+}
+
+
void LayerRendererChromium::cleanupSharedObjects()
{
makeContextCurrent();
Modified: trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h (88834 => 88835)
--- trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h 2011-06-14 18:31:03 UTC (rev 88834)
+++ trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h 2011-06-14 18:32:36 UTC (rev 88835)
@@ -124,15 +124,15 @@
int maxTextureSize() const { return m_maxTextureSize; }
const GeometryBinding* sharedGeometry() const { return m_sharedGeometry.get(); }
- const LayerChromium::BorderProgram* borderProgram() const { return m_borderProgram.get(); }
- const CCHeadsUpDisplay::Program* headsUpDisplayProgram() const { return m_headsUpDisplayProgram.get(); }
- const RenderSurfaceChromium::Program* renderSurfaceProgram() const { return m_renderSurfaceProgram.get(); }
- const RenderSurfaceChromium::MaskProgram* renderSurfaceMaskProgram() const { return m_renderSurfaceMaskProgram.get(); }
- const LayerTilerChromium::Program* tilerProgram() const { return m_tilerProgram.get(); }
- const CCCanvasLayerImpl::Program* canvasLayerProgram() const { return m_canvasLayerProgram.get(); }
- const CCPluginLayerImpl::Program* pluginLayerProgram() const { return m_pluginLayerProgram.get(); }
- const CCVideoLayerImpl::RGBAProgram* videoLayerRGBAProgram() const { return m_videoLayerRGBAProgram.get(); }
- const CCVideoLayerImpl::YUVProgram* videoLayerYUVProgram() const { return m_videoLayerYUVProgram.get(); }
+ const LayerChromium::BorderProgram* borderProgram();
+ const CCHeadsUpDisplay::Program* headsUpDisplayProgram();
+ const RenderSurfaceChromium::Program* renderSurfaceProgram();
+ const RenderSurfaceChromium::MaskProgram* renderSurfaceMaskProgram();
+ const LayerTilerChromium::Program* tilerProgram();
+ const CCCanvasLayerImpl::Program* canvasLayerProgram();
+ const CCPluginLayerImpl::Program* pluginLayerProgram();
+ const CCVideoLayerImpl::RGBAProgram* videoLayerRGBAProgram();
+ const CCVideoLayerImpl::YUVProgram* videoLayerYUVProgram();
void resizeOnscreenContent(const IntSize&);
Modified: trunk/Source/WebCore/platform/graphics/chromium/LayerTextureSubImage.cpp (88834 => 88835)
--- trunk/Source/WebCore/platform/graphics/chromium/LayerTextureSubImage.cpp 2011-06-14 18:31:03 UTC (rev 88834)
+++ trunk/Source/WebCore/platform/graphics/chromium/LayerTextureSubImage.cpp 2011-06-14 18:32:36 UTC (rev 88835)
@@ -31,6 +31,7 @@
#include "Extensions3DChromium.h"
#include "GraphicsContext3D.h"
+#include "TraceEvent.h"
namespace WebCore {
@@ -66,6 +67,7 @@
const IntRect& sourceRect, const IntRect& destRect,
GraphicsContext3D* context)
{
+ TRACE_EVENT("LayerTextureSubImage::uploadWithTexSubImage", this, 0);
if (!m_subImage)
m_subImage = adoptArrayPtr(new uint8_t[m_subImageSize.width() * m_subImageSize.height() * 4]);
@@ -92,6 +94,7 @@
const IntRect& sourceRect, const IntRect& destRect,
GraphicsContext3D* context)
{
+ TRACE_EVENT("LayerTextureSubImage::uploadWithMapTexSubImage", this, 0);
// Offset from image-rect to source-rect.
IntPoint offset(sourceRect.x() - imageRect.x(), sourceRect.y() - imageRect.y());
Modified: trunk/Source/WebCore/platform/graphics/chromium/ProgramBinding.cpp (88834 => 88835)
--- trunk/Source/WebCore/platform/graphics/chromium/ProgramBinding.cpp 2011-06-14 18:31:03 UTC (rev 88834)
+++ trunk/Source/WebCore/platform/graphics/chromium/ProgramBinding.cpp 2011-06-14 18:32:36 UTC (rev 88835)
@@ -33,6 +33,7 @@
#include "GraphicsContext.h"
#include "GraphicsContext3D.h"
#include "LayerRendererChromium.h"
+#include "TraceEvent.h"
namespace WebCore {
@@ -49,14 +50,10 @@
GLC(m_context, m_context->deleteProgram(m_program));
}
-bool ProgramBindingBase::init(const String& vertexShader, const String& fragmentShader)
+void ProgramBindingBase::init(const String& vertexShader, const String& fragmentShader)
{
m_program = createShaderProgram(vertexShader, fragmentShader);
- if (!m_program) {
- LOG_ERROR("Failed to create shader program");
- return false;
- }
- return true;
+ ASSERT(m_program);
}
unsigned ProgramBindingBase::loadShader(unsigned type, const String& shaderSource)
@@ -67,17 +64,20 @@
String sourceString(shaderSource);
GLC(m_context, m_context->shaderSource(shader, sourceString));
GLC(m_context, m_context->compileShader(shader));
+#ifndef NDEBUG
int compiled = 0;
GLC(m_context, m_context->getShaderiv(shader, GraphicsContext3D::COMPILE_STATUS, &compiled));
if (!compiled) {
GLC(m_context, m_context->deleteShader(shader));
return 0;
}
+#endif
return shader;
}
unsigned ProgramBindingBase::createShaderProgram(const String& vertexShaderSource, const String& fragmentShaderSource)
{
+ TRACE_EVENT("ProgramBindingBase::createShaderProgram", this, 0);
unsigned vertexShader = loadShader(GraphicsContext3D::VERTEX_SHADER, vertexShaderSource);
if (!vertexShader) {
LOG_ERROR("Failed to create vertex shader");
@@ -105,6 +105,7 @@
GLC(m_context, m_context->bindAttribLocation(programObject, GeometryBinding::texCoordAttribLocation(), "a_texCoord"));
GLC(m_context, m_context->linkProgram(programObject));
+#ifndef NDEBUG
int linked = 0;
GLC(m_context, m_context->getProgramiv(programObject, GraphicsContext3D::LINK_STATUS, &linked));
if (!linked) {
@@ -112,6 +113,7 @@
GLC(m_context, m_context->deleteProgram(programObject));
return 0;
}
+#endif
GLC(m_context, m_context->deleteShader(vertexShader));
GLC(m_context, m_context->deleteShader(fragmentShader));
Modified: trunk/Source/WebCore/platform/graphics/chromium/ProgramBinding.h (88834 => 88835)
--- trunk/Source/WebCore/platform/graphics/chromium/ProgramBinding.h 2011-06-14 18:31:03 UTC (rev 88834)
+++ trunk/Source/WebCore/platform/graphics/chromium/ProgramBinding.h 2011-06-14 18:32:36 UTC (rev 88835)
@@ -29,6 +29,7 @@
#if USE(ACCELERATED_COMPOSITING)
#include "PlatformString.h"
+#include "TraceEvent.h"
namespace WebCore {
@@ -39,7 +40,7 @@
explicit ProgramBindingBase(GraphicsContext3D*);
~ProgramBindingBase();
- bool init(const String& vertexShader, const String& fragmentShader);
+ void init(const String& vertexShader, const String& fragmentShader);
unsigned program() const { return m_program; }
bool initialized() const { return m_initialized; }
@@ -60,12 +61,13 @@
explicit ProgramBinding(GraphicsContext3D* context)
: ProgramBindingBase(context)
{
- if (!ProgramBindingBase::init(m_vertexShader.getShaderString(), m_fragmentShader.getShaderString()))
- return;
- if (!m_vertexShader.init(m_context, m_program))
- return;
- if (!m_fragmentShader.init(m_context, m_program))
- return;
+ ProgramBindingBase::init(m_vertexShader.getShaderString(), m_fragmentShader.getShaderString());
+ }
+
+ void initialize()
+ {
+ m_vertexShader.init(m_context, m_program);
+ m_fragmentShader.init(m_context, m_program);
m_initialized = true;
}
Modified: trunk/Source/WebCore/platform/graphics/chromium/ShaderChromium.cpp (88834 => 88835)
--- trunk/Source/WebCore/platform/graphics/chromium/ShaderChromium.cpp 2011-06-14 18:31:03 UTC (rev 88834)
+++ trunk/Source/WebCore/platform/graphics/chromium/ShaderChromium.cpp 2011-06-14 18:32:36 UTC (rev 88835)
@@ -42,10 +42,10 @@
{
}
-bool VertexShaderPosTex::init(GraphicsContext3D* context, unsigned program)
+void VertexShaderPosTex::init(GraphicsContext3D* context, unsigned program)
{
m_matrixLocation = context->getUniformLocation(program, "matrix");
- return m_matrixLocation != -1;
+ ASSERT(m_matrixLocation != -1);
}
String VertexShaderPosTex::getShaderString() const
@@ -70,12 +70,12 @@
{
}
-bool VertexShaderPosTexYUVStretch::init(GraphicsContext3D* context, unsigned program)
+void VertexShaderPosTexYUVStretch::init(GraphicsContext3D* context, unsigned program)
{
m_matrixLocation = context->getUniformLocation(program, "matrix");
m_yWidthScaleFactorLocation = context->getUniformLocation(program, "y_widthScaleFactor");
m_uvWidthScaleFactorLocation = context->getUniformLocation(program, "uv_widthScaleFactor");
- return m_matrixLocation != -1 && m_yWidthScaleFactorLocation != -1 && m_uvWidthScaleFactorLocation != -1;
+ ASSERT(m_matrixLocation != -1 && m_yWidthScaleFactorLocation != -1 && m_uvWidthScaleFactorLocation != -1);
}
String VertexShaderPosTexYUVStretch::getShaderString() const
@@ -103,10 +103,10 @@
{
}
-bool VertexShaderPos::init(GraphicsContext3D* context, unsigned program)
+void VertexShaderPos::init(GraphicsContext3D* context, unsigned program)
{
m_matrixLocation = context->getUniformLocation(program, "matrix");
- return m_matrixLocation != -1;
+ ASSERT(m_matrixLocation != -1);
}
String VertexShaderPos::getShaderString() const
@@ -127,11 +127,11 @@
{
}
-bool VertexShaderPosTexTransform::init(GraphicsContext3D* context, unsigned program)
+void VertexShaderPosTexTransform::init(GraphicsContext3D* context, unsigned program)
{
m_matrixLocation = context->getUniformLocation(program, "matrix");
m_texTransformLocation = context->getUniformLocation(program, "texTransform");
- return m_matrixLocation != -1 && m_texTransformLocation != -1;
+ ASSERT(m_matrixLocation != -1 && m_texTransformLocation != -1);
}
String VertexShaderPosTexTransform::getShaderString() const
@@ -156,12 +156,12 @@
{
}
-bool FragmentTexAlphaBinding::init(GraphicsContext3D* context, unsigned program)
+void FragmentTexAlphaBinding::init(GraphicsContext3D* context, unsigned program)
{
m_samplerLocation = context->getUniformLocation(program, "s_texture");
m_alphaLocation = context->getUniformLocation(program, "alpha");
- return m_samplerLocation != -1 && m_alphaLocation != -1;
+ ASSERT(m_samplerLocation != -1 && m_alphaLocation != -1);
}
String FragmentShaderRGBATexFlipAlpha::getShaderString() const
@@ -216,13 +216,12 @@
{
}
-bool FragmentShaderRGBATexAlphaMask::init(GraphicsContext3D* context, unsigned program)
+void FragmentShaderRGBATexAlphaMask::init(GraphicsContext3D* context, unsigned program)
{
m_samplerLocation = context->getUniformLocation(program, "s_texture");
m_maskSamplerLocation = context->getUniformLocation(program, "s_mask");
m_alphaLocation = context->getUniformLocation(program, "alpha");
-
- return m_samplerLocation != -1 && m_maskSamplerLocation != -1 && m_alphaLocation != -1;
+ ASSERT(m_samplerLocation != -1 && m_maskSamplerLocation != -1 && m_alphaLocation != -1);
}
String FragmentShaderRGBATexAlphaMask::getShaderString() const
@@ -252,7 +251,7 @@
{
}
-bool FragmentShaderYUVVideo::init(GraphicsContext3D* context, unsigned program)
+void FragmentShaderYUVVideo::init(GraphicsContext3D* context, unsigned program)
{
m_yTextureLocation = context->getUniformLocation(program, "y_texture");
m_uTextureLocation = context->getUniformLocation(program, "u_texture");
@@ -261,8 +260,8 @@
m_ccMatrixLocation = context->getUniformLocation(program, "cc_matrix");
m_yuvAdjLocation = context->getUniformLocation(program, "yuv_adj");
- return m_yTextureLocation != -1 && m_uTextureLocation != -1 && m_vTextureLocation != -1
- && m_alphaLocation != -1 && m_ccMatrixLocation != -1 && m_yuvAdjLocation != -1;
+ ASSERT(m_yTextureLocation != -1 && m_uTextureLocation != -1 && m_vTextureLocation != -1
+ && m_alphaLocation != -1 && m_ccMatrixLocation != -1 && m_yuvAdjLocation != -1);
}
String FragmentShaderYUVVideo::getShaderString() const
@@ -295,10 +294,10 @@
{
}
-bool FragmentShaderColor::init(GraphicsContext3D* context, unsigned program)
+void FragmentShaderColor::init(GraphicsContext3D* context, unsigned program)
{
m_colorLocation = context->getUniformLocation(program, "color");
- return m_colorLocation != -1;
+ ASSERT(m_colorLocation != -1);
}
String FragmentShaderColor::getShaderString() const
Modified: trunk/Source/WebCore/platform/graphics/chromium/ShaderChromium.h (88834 => 88835)
--- trunk/Source/WebCore/platform/graphics/chromium/ShaderChromium.h 2011-06-14 18:31:03 UTC (rev 88834)
+++ trunk/Source/WebCore/platform/graphics/chromium/ShaderChromium.h 2011-06-14 18:32:36 UTC (rev 88835)
@@ -42,7 +42,7 @@
public:
VertexShaderPosTex();
- bool init(GraphicsContext3D*, unsigned program);
+ void init(GraphicsContext3D*, unsigned program);
String getShaderString() const;
int matrixLocation() const { return m_matrixLocation; }
@@ -55,7 +55,7 @@
public:
VertexShaderPosTexYUVStretch();
- bool init(GraphicsContext3D*, unsigned program);
+ void init(GraphicsContext3D*, unsigned program);
String getShaderString() const;
int matrixLocation() const { return m_matrixLocation; }
@@ -72,7 +72,7 @@
public:
VertexShaderPos();
- bool init(GraphicsContext3D*, unsigned program);
+ void init(GraphicsContext3D*, unsigned program);
String getShaderString() const;
int matrixLocation() const { return m_matrixLocation; }
@@ -85,7 +85,7 @@
public:
VertexShaderPosTexTransform();
- bool init(GraphicsContext3D*, unsigned program);
+ void init(GraphicsContext3D*, unsigned program);
String getShaderString() const;
int matrixLocation() const { return m_matrixLocation; }
@@ -100,7 +100,7 @@
public:
FragmentTexAlphaBinding();
- bool init(GraphicsContext3D*, unsigned program);
+ void init(GraphicsContext3D*, unsigned program);
int alphaLocation() const { return m_alphaLocation; }
int samplerLocation() const { return m_samplerLocation; }
@@ -129,7 +129,7 @@
FragmentShaderRGBATexAlphaMask();
String getShaderString() const;
- bool init(GraphicsContext3D*, unsigned program);
+ void init(GraphicsContext3D*, unsigned program);
int alphaLocation() const { return m_alphaLocation; }
int samplerLocation() const { return m_samplerLocation; }
int maskSamplerLocation() const { return m_maskSamplerLocation; }
@@ -151,7 +151,7 @@
FragmentShaderYUVVideo();
String getShaderString() const;
- bool init(GraphicsContext3D*, unsigned program);
+ void init(GraphicsContext3D*, unsigned program);
int yTextureLocation() const { return m_yTextureLocation; }
int uTextureLocation() const { return m_uTextureLocation; }
@@ -174,7 +174,7 @@
FragmentShaderColor();
String getShaderString() const;
- bool init(GraphicsContext3D*, unsigned program);
+ void init(GraphicsContext3D*, unsigned program);
int colorLocation() const { return m_colorLocation; }
private:
Modified: trunk/Source/WebKit/chromium/ChangeLog (88834 => 88835)
--- trunk/Source/WebKit/chromium/ChangeLog 2011-06-14 18:31:03 UTC (rev 88834)
+++ trunk/Source/WebKit/chromium/ChangeLog 2011-06-14 18:32:36 UTC (rev 88835)
@@ -1,3 +1,15 @@
+2011-06-14 James Robinson <[email protected]>
+
+ Reviewed by Stephen White.
+
+ [chromium] Compositor shader initialization is inefficient
+ https://bugs.webkit.org/show_bug.cgi?id=62618
+
+ Add a TRACE_EVENT() around initial compositor initialization.
+
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::setIsAcceleratedCompositingActive):
+
2011-06-14 Adam Barth <[email protected]>
Reviewed by Darin Fisher.
Modified: trunk/Source/WebKit/chromium/src/WebViewImpl.cpp (88834 => 88835)
--- trunk/Source/WebKit/chromium/src/WebViewImpl.cpp 2011-06-14 18:31:03 UTC (rev 88834)
+++ trunk/Source/WebKit/chromium/src/WebViewImpl.cpp 2011-06-14 18:32:36 UTC (rev 88835)
@@ -2497,6 +2497,7 @@
m_client->didActivateAcceleratedCompositing(true);
} else {
+ TRACE_EVENT("WebViewImpl::setIsAcceleratedCompositingActive(true)", this, 0);
RefPtr<GraphicsContext3D> context = m_temporaryOnscreenGraphicsContext3D.release();
if (!context) {
context = GraphicsContext3D::create(getCompositorContextAttributes(), m_page->chrome(), GraphicsContext3D::RenderDirectlyToHostWindow);