[Mesa-dev] [PATCH 5/7] glsl: add gl_InvocationID variable for ARB_gpu_shader5
Jordan Justen
jordan.l.justen at intel.com
Sun Jan 26 12:52:07 PST 2014
Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
---
src/glsl/builtin_variables.cpp | 2 ++
src/mesa/main/mtypes.h | 2 ++
src/mesa/program/prog_print.c | 10 ++++++----
3 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/src/glsl/builtin_variables.cpp b/src/glsl/builtin_variables.cpp
index d6bc3c0..ef5bd96 100644
--- a/src/glsl/builtin_variables.cpp
+++ b/src/glsl/builtin_variables.cpp
@@ -782,6 +782,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_input(VARYING_SLOT_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
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index d92bb88..5d2e7d1 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -236,6 +236,7 @@ typedef enum
VARYING_SLOT_PRIMITIVE_ID, /* Does not appear in VS */
VARYING_SLOT_LAYER, /* Appears as VS or GS output */
VARYING_SLOT_VIEWPORT, /* Appears as VS or GS output */
+ VARYING_SLOT_INVOCATION_ID, /* Appears as a GS input */
VARYING_SLOT_FACE, /* FS only */
VARYING_SLOT_PNTC, /* FS only */
VARYING_SLOT_VAR0, /* First generic varying slot */
@@ -272,6 +273,7 @@ typedef enum
#define VARYING_BIT_PRIMITIVE_ID BITFIELD64_BIT(VARYING_SLOT_PRIMITIVE_ID)
#define VARYING_BIT_LAYER BITFIELD64_BIT(VARYING_SLOT_LAYER)
#define VARYING_BIT_VIEWPORT BITFIELD64_BIT(VARYING_SLOT_VIEWPORT)
+#define VARYING_BIT_INVOCATION_ID BITFIELD64_BIT(VARYING_SLOT_INVOCATION_ID)
#define VARYING_BIT_FACE BITFIELD64_BIT(VARYING_SLOT_FACE)
#define VARYING_BIT_PNTC BITFIELD64_BIT(VARYING_SLOT_PNTC)
#define VARYING_BIT_VAR(V) BITFIELD64_BIT(VARYING_SLOT_VAR0 + (V))
diff --git a/src/mesa/program/prog_print.c b/src/mesa/program/prog_print.c
index 02ba01e..1d60f8b 100644
--- a/src/mesa/program/prog_print.c
+++ b/src/mesa/program/prog_print.c
@@ -145,8 +145,9 @@ arb_input_attrib_string(GLint index, GLenum progType)
"fragment.(nineteen)", /* VARYING_SLOT_PRIMITIVE_ID */
"fragment.(twenty)", /* VARYING_SLOT_LAYER */
"fragment.(twenty-one)", /* VARYING_SLOT_VIEWPORT */
- "fragment.(twenty-two)", /* VARYING_SLOT_FACE */
- "fragment.(twenty-three)", /* VARYING_SLOT_PNTC */
+ "fragment.(twenty-two)", /* VARYING_SLOT_INVOCATION_ID */
+ "fragment.(twenty-three)", /* VARYING_SLOT_FACE */
+ "fragment.(twenty-four)", /* VARYING_SLOT_PNTC */
"fragment.varying[0]",
"fragment.varying[1]",
"fragment.varying[2]",
@@ -270,8 +271,9 @@ arb_output_attrib_string(GLint index, GLenum progType)
"result.(nineteen)", /* VARYING_SLOT_PRIMITIVE_ID */
"result.(twenty)", /* VARYING_SLOT_LAYER */
"result.(twenty-one)", /* VARYING_SLOT_VIEWPORT */
- "result.(twenty-two)", /* VARYING_SLOT_FACE */
- "result.(twenty-three)", /* VARYING_SLOT_PNTC */
+ "result.(twenty-two)", /* VARYING_SLOT_INVOCATION_ID */
+ "result.(twenty-three)", /* VARYING_SLOT_FACE */
+ "result.(twenty-four)", /* VARYING_SLOT_PNTC */
"result.varying[0]",
"result.varying[1]",
"result.varying[2]",
--
1.8.5.3
More information about the mesa-dev
mailing list