[Mesa-dev] glsl: do_vec_index_to_cond_assign not called; has problems if called

Ian Romanick idr at freedesktop.org
Wed Aug 17 08:17:28 PDT 2011

Hash: SHA1

On 08/17/2011 07:45 AM, Aras Pranckevicius wrote:
> Looks like do_vec_index_to_cond_assing was lost in this commit:
> http://cgit.freedesktop.org/mesa/mesa/commit/?id=2f4fe151681a6f6afe1d452eece6cf4144f44e49

Converting variable indexing of vectors to conditional assignments is a
lowering pass, not an optimization.  We don't do it by default because
some hardware may not need it.

> Not sure if that was intentional or not. However if I try to manually
> call it like it used to be called before (just after
> do_vec_index_to_swizzle), it has problems with some shaders. Same
> problem I reported a while ago here:
> http://lists.freedesktop.org/archives/mesa-dev/2010-August/002337.html
> - but now it aborts in IR validation stage instead of crashing.
> Fragment shader it has problems on:
> vec2 nonInlinedFunction (vec2 a) {
>  if (a.x < 0.0)
>    return -a;
>  return a*2.0;
> }
> void main() {
>  vec2 c = vec2(0.0);
>  for (int j = 0; j < 2; ++j) {
>    c += nonInlinedFunction (vec2(vec2(0.0)[j])); // <- weird, but legit
>  }
>  gl_FragColor = vec4(c,0.0,0.0);
> }

I ran this on the i965 driver with current Mesa master, and it ran just
fine.  Can you provide a backtrace from the abort in IR validate?
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/


More information about the mesa-dev mailing list