It appears that the copy propagation pass in the GLSL compiler (in
opt_copy_propagation.cpp) doesn't do copy propagation when the
components of a variable are initialized separately, like this:

(declare (temporary ) vec4 vec_ctor)
(assign  (w) (var_ref vec_ctor)  (constant float (1.000000)) )
(assign  (xyz) (var_ref vec_ctor)  (var_ref assignment_tmp@16) )
(assign  (xyzw) (var_ref gl_FragColor)  (var_ref vec_ctor) )

In the past, this wasn't visible in the Mesa IR output because Mesa IR
optimization seems to do the copy propagation.  However, glsl_to_tgsi
doesn't do copy propagation to output registers - in fact, I believe
this is the only case left where ir_to_mesa produces better code than
glsl_to_tgsi.  I'm not very enthusiastic about the idea adding to the
copy propagation pass in glsl_to_tgsi, since this case is something that
should really be optimized by the GLSL compiler before it reaches the IR
backend.

So, is there a reason why the GLSL copy propagation pass doesn't operate
per-component?

Bryan
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to