[Mesa-dev] [PATCH] st_glsl_to_tgsi: add support for prim id fragment shader input

Dave Airlie airlied at gmail.com
Wed Dec 18 00:01:59 PST 2013


From: Dave Airlie <airlied at redhat.com>

For GLSL 1.50 we can get frag shaders with primitive id as an
input, add support to the translator for this.

Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 src/mesa/state_tracker/st_program.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c
index f010e18..0db8af2 100644
--- a/src/mesa/state_tracker/st_program.c
+++ b/src/mesa/state_tracker/st_program.c
@@ -563,6 +563,11 @@ st_translate_fragment_program(struct st_context *st,
             input_semantic_index[slot] = 0;
             interpMode[slot] = TGSI_INTERPOLATE_CONSTANT;
             break;
+         case VARYING_SLOT_PRIMITIVE_ID:
+            input_semantic_name[slot] = TGSI_SEMANTIC_PRIMID;
+            input_semantic_index[slot] = 0;
+            interpMode[slot] = TGSI_INTERPOLATE_CONSTANT;
+            break;
          case VARYING_SLOT_CLIP_DIST0:
             input_semantic_name[slot] = TGSI_SEMANTIC_CLIPDIST;
             input_semantic_index[slot] = 0;
-- 
1.8.3.1



More information about the mesa-dev mailing list