Re: [css-shaders] GLSL implementation defined limits

On Nov 11, 2011, at 2:54 PM, Tab Atkins Jr. wrote:

>>> ...We do have some feature-level fallbacks, but they have to be defined
>>> explicitly.  The 'font-family' property takes a list of fonts and uses
>>> the first one it can find that has the correct glyph.  The 'image()'
>>> function defined in CSS3 Image Values takes a list of images and
>>> represents the first one that the browser understands.  One could
>>> design something similar for shaders, but I'd want a clear explanation
>>> of the use-cases, but I don't think copying the 'image()' solution
>>> would help Gregg.
>> 
>> Well, maybe it would though. You could do something like:
>> 
>>        .filtered {
>>                filter: shader(program url(complex.vs) url(complex.fs), program url(simple.vs) url(simple.fs), ...);
>>        }
>> 
>> The new 'program' parameter groups a vs and fs. The first set that succeeds is used. Isn't that similar to what image() does? This doesn't allow a fallback to something that is not a shader, but I think that's probably ok. You just need to supply a shader that you're confident will run on all platforms. In fact, this would give authors a pretty powerful tool. They could go pretty nuts with exotic shaders, and as long as they also provide something more tame, everyone will see something reasonable.
> 
> This doesn't address Gregg's use-cases, where multiple filters may be
> working together and be useless or harmful if only one isn't runnable,
> or where script may be running in conjunction with the filter that
> assumes the filter is working.

True, but I'm not sure we can solve every problem that this brings up. There are other places in CSS where properties work together to get a desired effect and if they're not all supported you get something less than useful. I think there needs to be a more general CSS solution for that problem. What I was trying to do was to give authors the ability to use more complex shaders and still work everywhere. I can imagine many cases where the fallback shader can be made to do enough of the effect to make it look right in combination.

-----
~Chris
cmarrin@apple.com

Received on Friday, 11 November 2011 23:03:27 UTC