summaryrefslogtreecommitdiffstats
path: root/src/glsl/nir/nir.c
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2015-09-10 16:53:08 -0700
committerJason Ekstrand <[email protected]>2015-09-21 09:49:40 -0700
commitd513388c8aa1ef4edb937e97a75b953f1abe16f3 (patch)
treeb1cb699a165a015c5ce150652c9a8f451d387cff /src/glsl/nir/nir.c
parentde7ffdb38343b7f9292184ca827987de9852c80c (diff)
nir: Move system value -> intrinsic mapping into nir.c
This way they're right next to the map going the other direction. Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/glsl/nir/nir.c')
-rw-r--r--src/glsl/nir/nir.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/glsl/nir/nir.c b/src/glsl/nir/nir.c
index 23071eff65b..1206bb4dfcb 100644
--- a/src/glsl/nir/nir.c
+++ b/src/glsl/nir/nir.c
@@ -1461,6 +1461,44 @@ nir_index_instrs(nir_function_impl *impl)
return index;
}
+nir_intrinsic_op
+nir_intrinsic_from_system_value(gl_system_value val)
+{
+ switch (val) {
+ case SYSTEM_VALUE_VERTEX_ID:
+ return nir_intrinsic_load_vertex_id;
+ case SYSTEM_VALUE_INSTANCE_ID:
+ return nir_intrinsic_load_instance_id;
+ case SYSTEM_VALUE_VERTEX_ID_ZERO_BASE:
+ return nir_intrinsic_load_vertex_id_zero_base;
+ case SYSTEM_VALUE_BASE_VERTEX:
+ return nir_intrinsic_load_base_vertex;
+ case SYSTEM_VALUE_INVOCATION_ID:
+ return nir_intrinsic_load_invocation_id;
+ case SYSTEM_VALUE_FRONT_FACE:
+ return nir_intrinsic_load_front_face;
+ case SYSTEM_VALUE_SAMPLE_ID:
+ return nir_intrinsic_load_sample_id;
+ case SYSTEM_VALUE_SAMPLE_POS:
+ return nir_intrinsic_load_sample_pos;
+ case SYSTEM_VALUE_SAMPLE_MASK_IN:
+ return nir_intrinsic_load_sample_mask_in;
+ case SYSTEM_VALUE_LOCAL_INVOCATION_ID:
+ return nir_intrinsic_load_local_invocation_id;
+ case SYSTEM_VALUE_WORK_GROUP_ID:
+ return nir_intrinsic_load_work_group_id;
+ /* FINISHME: Add tessellation intrinsics.
+ case SYSTEM_VALUE_TESS_COORD:
+ case SYSTEM_VALUE_VERTICES_IN:
+ case SYSTEM_VALUE_PRIMITIVE_ID:
+ case SYSTEM_VALUE_TESS_LEVEL_OUTER:
+ case SYSTEM_VALUE_TESS_LEVEL_INNER:
+ */
+ default:
+ unreachable("system value does not directly correspond to intrinsic");
+ }
+}
+
gl_system_value
nir_system_value_from_intrinsic(nir_intrinsic_op intrin)
{