On Tue, 10 Aug 2010 22:11:22 +0400, randrianas...@gmail.com wrote: > Hello all! > > Today i dived into GLSL for first time, so sorry if i write something stupid. > > One user at #radeon (nick <papillon81>) asked why some shade doesn't work. > > Here is link to vertex shader as i saw it today: > > http://mapserver.flightgear.org/git/gitweb.pl?p=fgdata;a=blob;f=Shaders/3dcloud.vert;h=135658ddb12c83e0652c85181f92575eeb06cf50;hb=HEAD > > With unmodified Mesa master (after commit what enabled OpenGL 2.1/GLSL 1.20 > for r600 in master) there was error:
... > > And finally after modifying shader it compiles sucessfully: > we changed line 40 > from > normalize(mat3x3(gl_ModelViewMatrix) * (- gl_Position.xyz)));; > into > normalize(vec3(gl_ModelViewMatrix * vec4(- gl_Position.xyz,0.0))));; Looks like you've found a workaround for Mesa 7.8. For GLSL2, both versions should work and produce equivalent code. It turns out that a lot of people use your workaround code on the assumption that the mat3x3 constructor is more expensive than the possible extra math, so I added an optimization pass to handle that. You could verify that the code is the same on intel hardware by looking at the output of the app with INTEL_DEBUG=vs in the environment. You can use MESA_GLSL=dump on any hardware, but it dumps out before the copy propagation and dead code elimination of _mesa_optimize_program(), so counting instructions there can be misleading.
pgp8tqF7CsnVG.pgp
Description: PGP signature
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev