Re: [css-shaders] GLSL implementation defined limits

WebGL does not say all valid shaders work. WebGL just defines the language,
"GLSL". After that it's up to the individual hardware/driver's limits.
We've already had to re-write several valid working shaders in the WebGL
conformance tests because while they worked fine on desktop hardware they
were too large for certain mobile hardware.

Some example of platform dependent limits:

*) Max Instructions for a shader. Low-end hardware can be as low as 96
instructions, high end hardware is currently around 32k instructions
*) Max textures you can references in a vertex shader. Low-end limit is 0,
high end is 32
*) Max textures you can reference period. Low-end is 8, high end is 32
*) Max precision. "highp" is optional
*) ...

It's also arguably impossible to know how many instructions a given shader
will take. Some drivers may optimize better than others. Some WebGL
implementations may re-write the shader to work around bugs in drivers. You
could choose some even smaller limit like 64 instructions and then hope
that was enough wiggle room for workarounds. You could also require higher
end hardware with higher limits before allowing CSS shaders to function.
Otherwise you probably need a way for devs to check for failure.

Received on Friday, 18 November 2011 17:55:19 UTC