[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Public WebGL] Need to start getting serious about shaders



One thing to note for the precision qualifiers.. shaders that are otherwise compatible except for a missing precision qualifier can be made to work both with current implementations and future post-validation implementations by just adding:

#ifdef GL_ES
precision mediump float;
#endif

to the start of every fragment shader.  I've been doing that on various demos as I've been testing on mobile, and things largely work fine.

We should have the ANGLE shader validator integrated in the coming few days, and there will be a pref that authors can flip to enable it -- it will default to off initially, but we will flip it on at the same time that we check in the TexImage2D API changes.

    - Vlad

----- "Chris Marrin" <cmarrin@apple.com> wrote:

> I've been going around the web this morning looking at WebGL content
> and I am concerned. There are several examples that have a variety of
> shader problems. The two most notable ones are:
> 
> 1) doing math between floats and ints without an explicit cast
> (allowed on some NVidia drivers but not ATI on Mac)
> 
> 2) Using Features of GLSL 1.2 like float arrays with constructors
> 
> Add to that the fact that NONE of the existing content will work in
> OpenGL ES because they don't have precision qualifiers (at least none
> that I've found).
> 
> So I have a comment and a question. My comment is that pretty much
> everything will break once we turn on shader validation. I know we've
> talked about it, I just wanted to prepare everyone for that fact. My
> question is, I know the ANGLE shader validator will deal with the
> precision qualifier issue, but does it also check for the above two
> errors? I would assume it will correctly reject (2) since that is a
> syntactic problem. But does it validate data types and operations and
> correctly reject (1)?
> 
> -----
> ~Chris
> cmarrin@apple.com
> 
> 
> 
> 
> -----------------------------------------------------------
> You are currently subscribed to public_webgl@khronos.org.
> To unsubscribe, send an email to majordomo@khronos.org with
> the following command in the body of your email:
-----------------------------------------------------------
You are currently subscribed to public_webgl@khronos.org.
To unsubscribe, send an email to majordomo@khronos.org with
the following command in the body of your email: