glsl: add gl_InvocationID variable for ARB_gpu_shader5
authorJordan Justen <jordan.l.justen@intel.com>
Sat, 25 Jan 2014 20:43:26 +0000 (12:43 -0800)
committerJordan Justen <jordan.l.justen@intel.com>
Thu, 20 Feb 2014 18:33:09 +0000 (10:33 -0800)
v2:
 * Make gl_InvocationID a system value

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
src/glsl/builtin_variables.cpp
src/mesa/main/mtypes.h

index 2fa509f..4176ae6 100644 (file)
@@ -854,6 +854,8 @@ builtin_variable_generator::generate_gs_special_vars()
    add_output(VARYING_SLOT_LAYER, int_t, "gl_Layer");
    if (state->ARB_viewport_array_enable)
       add_output(VARYING_SLOT_VIEWPORT, int_t, "gl_ViewportIndex");
+   if (state->ARB_gpu_shader5_enable)
+      add_system_value(SYSTEM_VALUE_INVOCATION_ID, int_t, "gl_InvocationID");
 
    /* Although gl_PrimitiveID appears in tessellation control and tessellation
     * evaluation shaders, it has a different function there than it has in
index bc02969..4c5f028 100644 (file)
@@ -2013,6 +2013,7 @@ typedef enum
    SYSTEM_VALUE_SAMPLE_ID,      /**< Fragment shader only */
    SYSTEM_VALUE_SAMPLE_POS,     /**< Fragment shader only */
    SYSTEM_VALUE_SAMPLE_MASK_IN, /**< Fragment shader only */
+   SYSTEM_VALUE_INVOCATION_ID,  /**< Geometry shader only */
    SYSTEM_VALUE_MAX             /**< Number of values */
 } gl_system_value;