[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Public WebGL] Unused varyings.
On Fri, Dec 10, 2010 at 10:42 AM, Kenneth Waters <firstname.lastname@example.org> wrote:
>> vec3 NeverCalled ()
>> return NeverUsed ;
> I believe this is considered reading the variable, even though this code is
> unreachable. You're asking the compiler to solve the halting problem.
Without recursion, pointers, first-class functions, or real loops,
isn't ESSL decidable? What good is a shading language that is designed
to specify stream processing kernels but admits no proofs of
> spec isn't 100% clear, but I think you're asking to much given the following
> "Likewise a varying in a fragment shader may be either a) not declared, b)
> declared but not read, c) declared and read in some paths or d) declared and
> read in all paths."
> "The compiler should not attempt to discover if a varying is read or written
> in all possible paths. This is considered too complex for ES." -- The OpenGL
> ES Shading Language section 10.12.
> For better or worse drivers tend to accept a superset of what the spec
The crucial detail here is the difference between all paths and no
paths. Elementary control flow analysis would show that NeverCalled
is, well, never called. The resolution at the end of that section
The only error case is when a varying is declared and read by the
fragment shader but is
not declared in the vertex shader.
If it can be shown that the value of NeverUsed will never affect
control flow or resultant data, then it is provably never read.
Without an actually intelligent linker that lets shader authors link
multiple vertex and fragment shaders into a single program (Is this
possible with some sort of XHR loading but not script tags?), control
flow and tainting analysis should be done at compile or an optional
more aggressive recompile after a linker error. Such is the plight of
the globally-scoped-language compiler writer...
> -- Kenneth Waters
You are currently subscribed to email@example.com.
To unsubscribe, send an email to firstname.lastname@example.org with
the following command in the body of your email: