<p dir="ltr"><br>
On May 12, 2016 9:42 PM, "Ilia Mirkin" <<a href="mailto:imirkin@alum.mit.edu">imirkin@alum.mit.edu</a>> wrote:<br>
><br>
> On Fri, May 13, 2016 at 12:41 AM, Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>> wrote:<br>
> ><br>
> > On May 12, 2016 9:29 PM, "Ilia Mirkin" <<a href="mailto:imirkin@alum.mit.edu">imirkin@alum.mit.edu</a>> wrote:<br>
> >><br>
> >> interpolateAt* can only take input variables or an element of an input<br>
> >> variable array. No structs.<br>
> >><br>
> >> Further, GLSL 4.50 relaxes the requirement to allow swizzles, so enable<br>
> >> that as well.<br>
> >><br>
> >> This fixes the following dEQP tests:<br>
> >><br>
> >><br>
> >> dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_sample.negative.interpolate_struct_member<br>
> >><br>
> >> dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_centroid.negative.interpolate_struct_member<br>
> >><br>
> >> dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_offset.negative.interpolate_struct_member<br>
> >><br>
> >> Signed-off-by: Ilia Mirkin <<a href="mailto:imirkin@alum.mit.edu">imirkin@alum.mit.edu</a>><br>
> >> ---<br>
> >> src/compiler/glsl/ast_function.cpp | 26 ++++++++++++++++++--------<br>
> >> 1 file changed, 18 insertions(+), 8 deletions(-)<br>
> >><br>
> >> diff --git a/src/compiler/glsl/ast_function.cpp<br>
> >> b/src/compiler/glsl/ast_function.cpp<br>
> >> index 4db3dd0..281735b 100644<br>
> >> --- a/src/compiler/glsl/ast_function.cpp<br>
> >> +++ b/src/compiler/glsl/ast_function.cpp<br>
> >> @@ -208,17 +208,27 @@ verify_parameter_modes(_mesa_glsl_parse_state<br>
> >> *state,<br>
> >><br>
> >> /* Verify that shader_in parameters are shader inputs */<br>
> >> if (formal->data.must_be_shader_input) {<br>
> >> - ir_variable *var = actual->variable_referenced();<br>
> >> - if (!var || var->data.mode != ir_var_shader_in) {<br>
> >> - _mesa_glsl_error(&loc, state,<br>
> >> - "parameter `%s` must be a shader input",<br>
> >> - formal->name);<br>
> >> - return false;<br>
> >> + const ir_rvalue *val = actual;<br>
> >> +<br>
> >> + // GLSL 4.50 allows swizzles, while earlier GLSL versions do<br>
> >> not.<br>
> >> + if (val->ir_type == ir_type_swizzle) {<br>
> >> + if (!state->is_version(450, 0)) {<br>
> ><br>
> > What about GLSL 4.60? Not that it exists yet but this doesn't look like a<br>
> > greater-equal.<br>
><br>
> state->is_version == at least version X (in this case, at least<br>
> desktop glsl version 450). So 460 should follow the same rules. (The<br>
> second argument is for ES... 0 means "never").</p>
<p dir="ltr">I see. (You can tell how much of this sort of code I've written...).</p>
<p dir="ltr">I don't know that I'd trust me but it looks fine as far add I can see. Thanks for taking care of 4.50 while you were in the neighborhood. For what it's worth,</p>
<p dir="ltr">Reviewed-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>></p>
<p dir="ltr">> ><br>
> >> + _mesa_glsl_error(&loc, state,<br>
> >> + "parameter `%s` must not be swizzled",<br>
> >> + formal->name);<br>
> >> + return false;<br>
> >> + }<br>
> >> + val = ((ir_swizzle *)val)->val;<br>
> >> + }<br>
> >> +<br>
> >> + while (val->ir_type == ir_type_dereference_array) {<br>
> >> + val = ((ir_dereference_array *)val)->array;<br>
> ><br>
> > What about arrays of arrays?<br>
><br>
> That's why it's a while loop.</p>
<p dir="ltr">Yeah... Saw that as soon as I sent the email.</p>
<p dir="ltr">> ><br>
> >> }<br>
> >><br>
> >> - if (actual->ir_type == ir_type_swizzle) {<br>
> >> + if (!val->as_dereference_variable() ||<br>
> >> + val->variable_referenced()->data.mode != ir_var_shader_in) {<br>
> >> _mesa_glsl_error(&loc, state,<br>
> >> - "parameter `%s` must not be swizzled",<br>
> >> + "parameter `%s` must be a shader input",<br>
> >> formal->name);<br>
> >> return false;<br>
> >> }<br>
> >> --<br>
> >> 2.7.3<br>
> >><br>
> >> _______________________________________________<br>
> >> mesa-dev mailing list<br>
> >> <a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
> >> <a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</p>