summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp
diff options
context:
space:
mode:
authorPaul Berry <stereotype441@gmail.com>2013-08-12 08:00:10 -0700
committerPaul Berry <stereotype441@gmail.com>2013-09-17 15:18:14 -0700
commit3374dabce7f7d3a8a698acc5354eb512e7a4d1af (patch)
tree7a89d4297b94cbc4b0adfc2059d0f55a0f7437b2 /src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp
parentf67fa8f3c85a991d3d88409a2c3981cd9b2f2120 (diff)
downloadexternal_mesa3d-3374dabce7f7d3a8a698acc5354eb512e7a4d1af.zip
external_mesa3d-3374dabce7f7d3a8a698acc5354eb512e7a4d1af.tar.gz
external_mesa3d-3374dabce7f7d3a8a698acc5354eb512e7a4d1af.tar.bz2
i965/gs: Implement basic gl_PrimitiveIDIn functionality.
If the geometry shader refers to the built-in variable gl_PrimitiveIDIn, we need to set a bit in 3DSTATE_GS to tell the hardware to dispatch primitive ID to r1, and we need to leave room for it when allocating registers. Note: this feature doesn't yet work properly when software primitive restart is in use (the primitive ID counter will incorrectly reset with each primitive restart, since software primitive restart works by performing multiple draw calls). I plan to address that in a future patch series. Fixes piglit test "spec/glsl-1.50/execution/geometry/primitive-id-in". Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp')
-rw-r--r--src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp4
1 files changed, 4 insertions, 0 deletions
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 cb7de8d..2d3a058 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);