summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJordan Justen <[email protected]>2015-03-13 11:34:48 -0700
committerJordan Justen <[email protected]>2015-09-13 09:53:16 -0700
commit49f999b9cb6ecb32cb27d10b47d234a176ae4c77 (patch)
tree3752b5daffdfe0fee42eb89fc344647bd7993518
parent43624361df1d5647665db793a38e229d89dfb851 (diff)
i965/nir: Support gl_LocalInvocationID variable
Signed-off-by: Jordan Justen <[email protected]> Reviewed-by: Kristian Høgsberg <[email protected]>
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs_nir.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
index 8c3c4aed707..286ec283584 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
@@ -337,6 +337,13 @@ emit_system_values_block(nir_block *block, void *void_visitor)
BRW_REGISTER_TYPE_D));
break;
+ case nir_intrinsic_load_local_invocation_id:
+ assert(v->stage == MESA_SHADER_COMPUTE);
+ reg = &v->nir_system_values[SYSTEM_VALUE_LOCAL_INVOCATION_ID];
+ if (reg->file == BAD_FILE)
+ *reg = *v->emit_cs_local_invocation_id_setup();
+ break;
+
default:
break;
}
@@ -1709,6 +1716,16 @@ fs_visitor::nir_emit_intrinsic(const fs_builder &bld, nir_intrinsic_instr *instr
((struct brw_cs_prog_data *) prog_data)->uses_barrier = true;
break;
+ case nir_intrinsic_load_local_invocation_id: {
+ gl_system_value sv = nir_system_value_from_intrinsic(instr->intrinsic);
+ fs_reg val = nir_system_values[sv];
+ assert(val.file != BAD_FILE);
+ dest.type = val.type;
+ for (unsigned i = 0; i < 3; i++)
+ bld.MOV(offset(dest, bld, i), offset(val, bld, i));
+ break;
+ }
+
default:
unreachable("unknown intrinsic");
}