[Mesa-dev] [Mesa-dev, 2/7] glsl/cs: Add gl_LocalInvocationID variable

Kristian Høgsberg krh at bitplanet.net
Thu Sep 10 10:21:45 PDT 2015


Jordan Justen <jordan.l.justen at intel.com> writes:

> Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
> Reviewed-by: Iago Toral Quiroga <itoral at igalia.com>

Reviewed-by: Kristian Høgsberg <krh at bitplanet.net>

> ---
> src/glsl/builtin_variables.cpp | 2 ++
>  src/glsl/shader_enums.h        | 9 +++++++++
>  2 files changed, 11 insertions(+)
>
> diff --git a/src/glsl/builtin_variables.cpp b/src/glsl/builtin_variables.cpp
> index 0ff3a3f..b2936a5 100644
> --- a/src/glsl/builtin_variables.cpp
> +++ b/src/glsl/builtin_variables.cpp
> @@ -1045,6 +1045,8 @@ builtin_variable_generator::generate_fs_special_vars()
>  void
>  builtin_variable_generator::generate_cs_special_vars()
>  {
> +   add_system_value(SYSTEM_VALUE_LOCAL_INVOCATION_ID, glsl_type::uvec3_type,
> +                    "gl_LocalInvocationID");
>     /* TODO: finish this. */
>  }
>  
> diff --git a/src/glsl/shader_enums.h b/src/glsl/shader_enums.h
> index 3c39416..64e1e46 100644
> --- a/src/glsl/shader_enums.h
> +++ b/src/glsl/shader_enums.h
> @@ -51,6 +51,8 @@ typedef enum
>  #define SYSTEM_BIT_SAMPLE_ID ((uint64_t)1 << SYSTEM_VALUE_SAMPLE_ID)
>  #define SYSTEM_BIT_SAMPLE_POS ((uint64_t)1 << SYSTEM_VALUE_SAMPLE_POS)
>  #define SYSTEM_BIT_SAMPLE_MASK_IN ((uint64_t)1 << SYSTEM_VALUE_SAMPLE_MASK_IN)
> +#define SYSTEM_BIT_LOCAL_INVOCATION_ID ((uint64_t)1 << SYSTEM_VALUE_LOCAL_INVOCATION_ID)
> +
>  /**
>   * If the gl_register_file is PROGRAM_SYSTEM_VALUE, the register index will be
>   * one of these values.  If a NIR variable's mode is nir_var_system_value, it
> @@ -176,6 +178,13 @@ typedef enum
>     SYSTEM_VALUE_TESS_LEVEL_INNER, /**< TES input */
>     /*@}*/
>  
> +   /**
> +    * \name Compute shader system values
> +    */
> +   /*@{*/
> +   SYSTEM_VALUE_LOCAL_INVOCATION_ID,
> +   /*@}*/
> +
>     SYSTEM_VALUE_MAX             /**< Number of values */
>  } gl_system_value;
>  


More information about the mesa-dev mailing list