[Mesa-dev] [PATCH 06/13] mesa: Replace string comparisons with SYSTEM_VALUE enum checks.

Ian Romanick idr at freedesktop.org
Fri Aug 8 10:44:14 PDT 2014


This patch is

Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

But it raises an interesting question.  If we lower gl_VertexID to
gl_VertexIDMESA + gl_BaseVertex, are we going to report active
attributes incorrectly through the API?

On 08/08/2014 12:31 AM, Kenneth Graunke wrote:
> This is more efficient.
> 
> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
> ---
>  src/mesa/main/shader_query.cpp | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> You can't see it in the diff, but this is in a switch statement on
> var->data.mode, in the ir_var_system_value case.
> 
> diff --git a/src/mesa/main/shader_query.cpp b/src/mesa/main/shader_query.cpp
> index 4267743..4871d09 100644
> --- a/src/mesa/main/shader_query.cpp
> +++ b/src/mesa/main/shader_query.cpp
> @@ -92,8 +92,8 @@ is_active_attrib(const ir_variable *var)
>         * are enumerated, including the special built-in inputs gl_VertexID
>         * and gl_InstanceID."
>         */
> -      return !strcmp(var->name, "gl_VertexID") ||
> -             !strcmp(var->name, "gl_InstanceID");
> +      return var->data.location == SYSTEM_VALUE_VERTEX_ID ||
> +             var->data.location == SYSTEM_VALUE_INSTANCE_ID;
>  
>     default:
>        return false;
> 



More information about the mesa-dev mailing list