Open GoogleCodeExporter opened 9 years ago
Sorry, misleading title: I do get errors in the log.
Original comment by murdoch....@gmail.com
on 28 Jun 2013 at 3:32
I've been informed of the cause of this: the page has declarations in the
fragment shader that initialize variables. Apparently (some of?) these
shouldn't be global declarations, they need to be moved inside main():
varying vec4 vCol; // carries alpha
varying vec4 vPosition;
varying vec3 vNormal;
vec3 eye = normalize(-vPosition.xyz);
const vec3 emission = vec3(0., 0., 0.);
const vec3 ambient1 = vec3(0., 0., 0.);
const vec3 specular1 = vec3(1., 1., 1.);// light*material
const float shininess1 = 50.;
vec4 colDiff1 = vec4(vCol.rgb * vec3(1., 1., 1.), vCol.a);
const vec3 lightDir1 = vec3(0., 0., 1.);
vec3 halfVec1 = normalize(lightDir1 + eye);
void main(void) {
When I move all of the initialized variables inside main, things display
properly. That makes sense, though I can't find documentation requiring this,
and other webGL engines cope with the original form.
Original comment by murdoch....@gmail.com
on 5 Jul 2013 at 3:21
I'm able to reproduce this with the latest Chrome Canary. I believe the problem
is that we use HLSL global variables for the attributes, which we initialize to
zero and only assign the actual input values within main(). So any global
expression using attributes will use the zeros, which in this case results in a
division by zero in the optimizer.
Original comment by c...@chromium.org
on 22 May 2014 at 2:40
Original issue reported on code.google.com by
murdoch....@gmail.com
on 28 Jun 2013 at 3:28