Timothy Arceri <tarc...@itsqueeze.com> writes:

>> +
>> +   int last_vert_stage =
>> +      util_last_bit(prog->data->linked_stages &
>> +                    (((1 << (MESA_SHADER_GEOMETRY + 1)) - 1) ^
>> +                     ((1 << MESA_SHADER_VERTEX) - 1)));
>
> Isn't this the same as:
>
>     int last_vert_stage =
>        util_last_bit(prog->data->linked_stages &
>                      ((1 << (MESA_SHADER_GEOMETRY + 1)) - 1));
>
> As ((1 << MESA_SHADER_VERTEX) - 1)) == 0
>
> If you use the above simplification this patch is:
>
> Reviewed-by: Timothy Arceri <tarc...@itsqueeze.com>

This is based on code in link_varyings_and_uniforms which has a loop
over all of the stages from geometry down to vertex to try and find the
last vertex stage. I was trying to mimic this behaviour which is
presumably saying vertex->geometry are the vertex stages and not just
“anything up to and including geometry”.

I don’t really mind either way whether we include the MESA_SHADER_VERTEX
part or not. I guess the cleanest way could be to add a define for the
mask in shader_enums.h to make it most likely not to break if any more
stages are added. But seeing as there is precedent for having this range
be open-coded in the code I guess we can just leave that to another
patch.

Regards,
- Neil

Attachment: signature.asc
Description: PGP signature

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

Reply via email to