On Monday, April 4, 2016 12:05:20 PM PDT Ilia Mirkin wrote: > For those (few, I'm sure) of us who are exceedingly lazy, what [glsl > ir] code ends up getting generated as a result of this? > > int temp; > if (zero == 0) temp = gl_SampleMaskIn[0] > else leave temp undefined?
Running my new samplemaskin-indirect Piglit test, it appears to create:
(assign (x) (var_ref dereference_array_value)
(array_ref (var_ref gl_SampleMaskIn) (constant uint (0))))
a.k.a.
temp = gl_SampleMaskIn[0];
For arrays of size <= 4, lower_variable_index_to_cond_assign() creates
if-ladders that try array indexes sequentially. It also unconditionally
reads the first element.
So, if there were 64 samples, the array size would be [2], and it would
generate:
temp = gl_SampleMaskIn[0]
if (index == 1)
temp = gl_SampleMaskIn[1];
This seems optimal.
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ mesa-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/mesa-dev
