[Mesa-dev] [PATCH 04/15] mesa/glspirv: Set last_vert_prog

Neil Roberts nroberts at igalia.com
Mon Jul 30 09:23:32 UTC 2018


Timothy Arceri <tarceri at 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 <tarceri at 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180730/2a6e902e/attachment.sig>


More information about the mesa-dev mailing list