diff options
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_context.h | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_vec4_gs.c | 3 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp | 4 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/gen7_gs_state.c | 2 |
4 files changed, 11 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index 494693cc3a0..5e66567b3cc 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -588,6 +588,8 @@ struct brw_gs_prog_data * Ignored if control_data_header_size is 0. */ unsigned control_data_format; + + bool include_primitive_id; }; /** Number of texture sampler units */ diff --git a/src/mesa/drivers/dri/i965/brw_vec4_gs.c b/src/mesa/drivers/dri/i965/brw_vec4_gs.c index c5261072600..30989c3faef 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4_gs.c +++ b/src/mesa/drivers/dri/i965/brw_vec4_gs.c @@ -45,6 +45,9 @@ do_gs_prog(struct brw_context *brw, c.key = *key; c.gp = gp; + c.prog_data.include_primitive_id = + (gp->program.Base.InputsRead & VARYING_BIT_PRIMITIVE_ID) != 0; + /* Allocate the references to the uniforms that will end up in the * prog_data associated with the compiled program, and which will be freed * by the state cache. diff --git a/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp index cb7de8d17bf..2d3a058ee80 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp +++ b/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp @@ -102,6 +102,10 @@ vec4_gs_visitor::setup_payload() */ reg++; + /* If the shader uses gl_PrimitiveIDIn, that goes in r1. */ + if (c->prog_data.include_primitive_id) + attribute_map[VARYING_SLOT_PRIMITIVE_ID] = reg++; + reg = setup_uniforms(reg); reg = setup_varying_inputs(reg, attribute_map); diff --git a/src/mesa/drivers/dri/i965/gen7_gs_state.c b/src/mesa/drivers/dri/i965/gen7_gs_state.c index 231e3c98910..4f18485381f 100644 --- a/src/mesa/drivers/dri/i965/gen7_gs_state.c +++ b/src/mesa/drivers/dri/i965/gen7_gs_state.c @@ -111,6 +111,8 @@ upload_gs_state(struct brw_context *brw) GEN7_GS_CONTROL_DATA_HEADER_SIZE_SHIFT) | GEN7_GS_DISPATCH_MODE_DUAL_OBJECT | GEN6_GS_STATISTICS_ENABLE | + (brw->gs.prog_data->include_primitive_id ? + GEN7_GS_INCLUDE_PRIMITIVE_ID : 0) | GEN7_GS_ENABLE; if (brw->is_haswell) { |