summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965/brw_vec4_gs_nir.cpp
diff options
context:
space:
mode:
authorKenneth Graunke <kenneth@whitecape.org>2015-09-23 15:40:33 -0700
committerKenneth Graunke <kenneth@whitecape.org>2015-09-29 14:19:32 -0700
commit476e6d732f76f1ac1c4560ccade7cbc93f985d09 (patch)
treea76ae08caf7e20d4bbce5896eb7fa9dbfe768afe /src/mesa/drivers/dri/i965/brw_vec4_gs_nir.cpp
parentcb758b892a7e62ff1f6187f2ca9ac543ff70a096 (diff)
downloadexternal_mesa3d-476e6d732f76f1ac1c4560ccade7cbc93f985d09.zip
external_mesa3d-476e6d732f76f1ac1c4560ccade7cbc93f985d09.tar.gz
external_mesa3d-476e6d732f76f1ac1c4560ccade7cbc93f985d09.tar.bz2
nir: Use a system value for gl_PrimitiveIDIn.
At least on Intel hardware, gl_PrimitiveIDIn comes in as a special part of the payload rather than a normal input. This is typically what we use system values for. Dave and Ilia also agree that a system value would be nicer. At some point, we should change it at the GLSL IR level as well. But that requires changing most of the drivers. For now, let's at least make NIR do the right thing, which is easy. v2: Add a comment about not creating a temporary (suggested by Iago). Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_vec4_gs_nir.cpp')
-rw-r--r--src/mesa/drivers/dri/i965/brw_vec4_gs_nir.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_gs_nir.cpp b/src/mesa/drivers/dri/i965/brw_vec4_gs_nir.cpp
index 4f4e1e1..64a90e5 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_gs_nir.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_gs_nir.cpp
@@ -72,6 +72,10 @@ vec4_gs_visitor::nir_setup_system_value_intrinsic(nir_intrinsic_instr *instr)
dst_reg *reg;
switch (instr->intrinsic) {
+ case nir_intrinsic_load_primitive_id:
+ /* We'll just read g1 directly; don't create a temporary. */
+ break;
+
case nir_intrinsic_load_invocation_id:
reg = &this->nir_system_values[SYSTEM_VALUE_INVOCATION_ID];
if (reg->file == BAD_FILE)
@@ -111,6 +115,12 @@ vec4_gs_visitor::nir_emit_intrinsic(nir_intrinsic_instr *instr)
retype(get_nir_src(instr->src[0], 1), BRW_REGISTER_TYPE_UD);
break;
+ case nir_intrinsic_load_primitive_id:
+ assert(c->prog_data.include_primitive_id);
+ dest = get_nir_dest(instr->dest, BRW_REGISTER_TYPE_D);
+ emit(MOV(dest, retype(brw_vec4_grf(1, 0), BRW_REGISTER_TYPE_D)));
+ break;
+
case nir_intrinsic_load_invocation_id: {
src_reg invocation_id =
src_reg(nir_system_values[SYSTEM_VALUE_INVOCATION_ID]);