Hi, When Mesa's GLSL compiler is faced with a code like this:
// vec4 packednormal exists vec3 normal; normal.xy = packednormal.wy * 2.0 - 1.0; normal.z = sqrt(1.0 - dot(normal.xy, normal.xy)); // now do not use the "normal" at all anywhere Then the dead code elimination pass will not be able to eliminate the "normal" variable, nor anything that lead to it (possibly sampling textures into packed normal, etc.). This is because variable refcounting visitor sees "normal" as having four references, but only two assignments, and can not consider it dead. Even if these two references are from assignment to normal.z where both LHS & RHS reference the same variable. Any ideas on how to improve this? If the original code was doing something like this, then dead code elimination is able to "properly" eliminate this whole thing: // vec4 packednormal exists vec3 normal; vec2 nxy = packednormal.wy * 2.0 - 1.0; float nz = sqrt(1.0 - dot(nxy, nxy)); normal.xy = nxy; normal.z = nz; // now do not use the "normal" at all anywhere -- Aras Pranckevičius work: http://unity3d.com home: http://aras-p.info
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev