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

Iago Toral itoral at igalia.com
Thu Sep 10 07:45:03 PDT 2015


On Thu, 2015-09-10 at 16:38 +0200, Iago Toral wrote:
> Reviewed-by: Iago Toral Quiroga <itoral at igalia.com>
> 
> On Mon, 2015-08-03 at 23:00 -0700, Jordan Justen wrote:
> > Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
> > ---
> >  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");

Probably not relevant, but since this caught my eye I figured I would
mention it: I see that other parts of this file do not use glsl_type::*
directly, instead they use the *_t class members defined in
builtin_variable_generator... which it inits in the class constructor.
To be honest, I don't see the point of this, but in case there is a
reason for it you might want to do that for uvec3 too.

Iago

> >     /* 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