W3C home > Mailing lists > Public > public-fx@w3.org > October to December 2011

Re: [css-shaders] GLSL implementation defined limits

From: Vincent Hardy <vhardy@adobe.com>
Date: Fri, 18 Nov 2011 18:25:59 -0800
To: "Gregg Tavares (wrk)" <gman@google.com>, Chris Marrin <cmarrin@apple.com>
CC: "public-fx@w3.org" <public-fx@w3.org>
Message-ID: <CAEC533D.22D35%vhardy@adobe.com>
Hi Greg, Chris,

Thanks for providing the examples. I'll add this discussion to the WebKit bug so that we can add a suggestion like Chris' to the next draft.

Cheers,
Vincent.

From: "Gregg Tavares (wrk)" <gman@google.com<mailto:gman@google.com>>
Date: Fri, 18 Nov 2011 13:40:55 -0800
To: Chris Marrin <cmarrin@apple.com<mailto:cmarrin@apple.com>>
Cc: Adobe Systems <vhardy@adobe.com<mailto:vhardy@adobe.com>>, "public-fx@w3.org<mailto:public-fx@w3.org>" <public-fx@w3.org<mailto:public-fx@w3.org>>
Subject: Re: [css-shaders] GLSL implementation defined limits



On Fri, Nov 18, 2011 at 11:27 AM, Chris Marrin <cmarrin@apple.com<mailto:cmarrin@apple.com>> wrote:

On Nov 18, 2011, at 9:54 AM, Gregg Tavares (wrk) wrote:

> 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.

And so the question is, where did they fail? I assume they failed somewhere in the compile/link cycle, in which case an @supports type of scheme where an alternative can be selected after such failures, would work, right?

Yes, the shaders in question failed in the compile/link cycle as they used too many instructions 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.

-----
~Chris
cmarrin@apple.com<mailto:cmarrin@apple.com>
Received on Saturday, 19 November 2011 02:26:41 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 19 November 2011 02:26:43 GMT