W3C home > Mailing lists > Public > www-style@w3.org > October 2011

[css-shaders] Feedback for the spec's default shader s

From: <noam.rosenthal@nokia.com>
Date: Fri, 14 Oct 2011 19:43:18 +0000
To: <www-style@w3.org>
Message-ID: <9DCC9DB73CE0234F821B00AF47F30CE7A6DBBD@008-AM1MPN1-026.mgdnok.nokia.com>
I've been following the CSS shader proposal, and am very excited about it.
I think one tricky issue that we have to figure out ahead of time in that spec is the default shaders, since those shaders are going to be overridden with the default uniform names in mind etc.

The issue that popped when I saw the default fragment shader is that it doesn't include an opacity uniform. This would mean, that layers with a custom CSS shader plus opacity would have to render the layer into an intermediate buffer (FBO), and then paint them again with opacity. This, in many cases, would be unnecessary overhead.
Therefore, my proposal for the default fragment shader is something along the lines of:

varying vec2 v_texCoord;
uniform sampler2D s_texture;
uniform float u_opacity;
void main()
    gl_FragColor = texture2D(s_texture, v_texCoord) * u_opacity;

There is also an issue with making sure those custom shaders are OpenGL ES2 compliant, in essence allowing percision identifiers (lowp/highp), or another strategy to make sure people create shaders that work across GL and GL ES2.

Hope this piece feedback is sent to the right place :)
Received on Friday, 14 October 2011 22:12:07 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:05 UTC