diff options
Diffstat (limited to 'WebCore/platform/graphics/chromium/LayerRendererChromium.h')
-rw-r--r-- | WebCore/platform/graphics/chromium/LayerRendererChromium.h | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/WebCore/platform/graphics/chromium/LayerRendererChromium.h b/WebCore/platform/graphics/chromium/LayerRendererChromium.h index a2e3427..dc7ea70 100644 --- a/WebCore/platform/graphics/chromium/LayerRendererChromium.h +++ b/WebCore/platform/graphics/chromium/LayerRendererChromium.h @@ -47,6 +47,16 @@ namespace WebCore { class GLES2Context; class Page; +class ShaderProgram { +public: + ShaderProgram(); + + unsigned m_shaderProgramId; + int m_samplerLocation; + int m_matrixLocation; + int m_alphaLocation; +}; + // Class that handles drawing of composited render layers using GL. class LayerRendererChromium : public Noncopyable { public: @@ -74,17 +84,23 @@ public: GraphicsContext* rootLayerGraphicsContext() const { return m_rootLayerGraphicsContext.get(); } private: + enum ShaderProgramType { DebugBorderProgram, ScrollLayerProgram, ContentLayerProgram, WebGLLayerProgram, NumShaderProgramTypes }; + void updateLayersRecursive(LayerChromium* layer, const TransformationMatrix& parentMatrix, float opacity, const IntRect& visibleRect); void drawLayer(LayerChromium*); void drawDebugBorder(LayerChromium*, const TransformationMatrix&); - void drawTexturedQuad(const TransformationMatrix& matrix, float width, float height, float opacity, bool scrolling); + void drawTexturedQuad(const TransformationMatrix& matrix, float width, float height, float opacity); bool isLayerVisible(LayerChromium*, const TransformationMatrix&, const IntRect& visibleRect); - void bindCommonAttribLocation(int location, char* attribName); + bool createLayerShader(ShaderProgramType, const char* vertexShaderSource, const char* fragmentShaderSource); + + void useShaderProgram(ShaderProgramType); + + void bindCommonAttribLocations(ShaderProgramType); enum VboIds { Vertices, LayerElements }; @@ -96,12 +112,9 @@ private: int getTextureId(LayerChromium*); int assignTextureForLayer(LayerChromium*); - // GL shader program object IDs. - unsigned int m_layerProgramObject; - unsigned int m_borderProgramObject; - unsigned int m_scrollProgramObject; + ShaderProgram m_shaderPrograms[NumShaderProgramTypes]; - unsigned int m_rootLayerTextureId; + unsigned m_rootLayerTextureId; int m_rootLayerTextureWidth; int m_rootLayerTextureHeight; @@ -111,13 +124,9 @@ private: int m_samplerLocation; int m_matrixLocation; int m_alphaLocation; - int m_scrollMatrixLocation; - int m_scrollSamplerLocation; - - int m_borderMatrixLocation; int m_borderColorLocation; - unsigned int m_quadVboIds[3]; + unsigned m_quadVboIds[3]; TransformationMatrix m_projectionMatrix; RefPtr<LayerChromium> m_rootLayer; @@ -128,8 +137,10 @@ private: IntPoint m_scrollPosition; bool m_hardwareCompositing; + ShaderProgramType m_currentShaderProgramType; + // Map associating layers with textures ids used by the GL compositor. - typedef HashMap<LayerChromium*, unsigned int> TextureIdMap; + typedef HashMap<LayerChromium*, unsigned> TextureIdMap; TextureIdMap m_textureIdMap; #if PLATFORM(SKIA) |