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

[css-shaders] Feedback about default fragment shader in CSS shaders proposal

From: <noam.rosenthal@nokia.com>
Date: Wed, 12 Oct 2011 18:10:36 +0000
To: <www-style@w3.org>
Message-ID: <9DCC9DB73CE0234F821B00AF47F30CE7A6791A@008-AM1MPN1-026.mgdnok.nokia.com>
Hi
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 :)
No'am
Received on Friday, 14 October 2011 22:12:05 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:45 GMT