Make the CSS Shaders integrate with the accelerated layers pipeline.
(In reply to comment #0)
> Make the CSS Shaders integrate with the accelerated layers pipeline.
I am trying to hardware accelerate CSS Shaders in chromium. As we known, CSS Shaders are only software rendered in WebKit currently. So, its performance is not very good. The bottleneck is that, the result texture of CSS Shaders is in GPU after the shaders were applied. Webkit will read back the texture as a bitmap from GPU to CPU for further rendering. If we active the hardware accelerated path, the result texture read back can be eliminated. The result texture can be directly used for compositing other than being read back and uploaded to GPU again.
I have three ideas in my mind how to do the hardware acceleration in chromium:
Firstly, when there is an element with CSS Shaders style, active the hardware path by creating GraphicsLayer for the RenderLayer containing the element, enabling compositing mode. A tiled_layer is created in chromium compositor for the RenderLayer painting. WebKit applies shaders on the painting result and gets a result texture in GPU. Then the texture is directly used for compositing with some logical modification in chromium compositor for the tiled_layer.
Secondly, a texture_layer is created for the RenderLayer containing an element with CSS Shaders. No much modifications in chromium compositor’s logic. By creating a CSSShadersBridge which is similar to Canvas2DLayerBridge, the applied result texture of CSS Shader can directly used for compositing. CSSShadersBridge is responsible for preparing the result texture.
Thirdly, the RenderLayer is still rendered in the tiled_layer as normal tiled_layers. Then, apply CSS shaders on the result in a seperate render surface which is similar to CSS Filters. Chromium compositor gets shaders from WebKit and create a ShadersRenderer to apply the shaders. ShadersRenderer handles mesh data, programs, and parameters. ShadersRenderer is similar to CustomFilterRenderer in WebKit.
The above ideas are immature. Could anyone give some comments? I am very appreciated for that. Do any guys working on Shaders hardware acceleration in chromium now? I noticed this bug was created long time ago.