[Mesa-dev] [PATCH 4/4] i965/nir: Support gl_WorkGroupID variable
Jordan Justen
jordan.l.justen at intel.com
Tue Aug 4 11:24:10 PDT 2015
Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
---
src/mesa/drivers/dri/i965/brw_fs_nir.cpp | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
index 711ace6..a0b20c4 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
@@ -347,6 +347,13 @@ emit_system_values_block(nir_block *block, void *void_visitor)
*reg = *v->emit_cs_local_invocation_id_setup();
break;
+ case nir_intrinsic_load_work_group_id:
+ assert(v->stage == MESA_SHADER_COMPUTE);
+ reg = &v->nir_system_values[SYSTEM_VALUE_WORK_GROUP_ID];
+ if (reg->file == BAD_FILE)
+ *reg = *v->emit_cs_work_group_id_setup();
+ break;
+
default:
break;
}
@@ -1581,6 +1588,15 @@ fs_visitor::nir_emit_intrinsic(const fs_builder &bld, nir_intrinsic_instr *instr
break;
}
+ case nir_intrinsic_load_work_group_id: {
+ fs_reg work_group_id = nir_system_values[SYSTEM_VALUE_WORK_GROUP_ID];
+ assert(work_group_id.file != BAD_FILE);
+ dest.type = work_group_id.type;
+ for (unsigned i = 0; i < 3; i++)
+ bld.MOV(offset(dest, bld, i), offset(work_group_id, bld, i));
+ break;
+ }
+
case nir_intrinsic_barrier:
assert(stage == MESA_SHADER_COMPUTE);
emit_barrier();
--
2.1.4
More information about the mesa-dev
mailing list