summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers
diff options
context:
space:
mode:
authorAlejandro PiƱeiro <[email protected]>2015-06-16 21:36:49 +0200
committerJason Ekstrand <[email protected]>2015-08-03 09:40:47 -0700
commite76e8caecd30799500357a45468329f033a93932 (patch)
tree5c4d69776d6a1d6bcd399d4bec5d62a773769a36 /src/mesa/drivers
parent662c4c99065381b8e265310d176cfdef6698ca57 (diff)
i965/nir/vec4: Implement intrinsics that load system values
These include: nir_intrinsic_load_vertex_id_zero_base nir_intrinsic_load_base_vertex nir_intrinsic_load_instance_id The source register is fetched from the nir_system_values map initialized during nir_setup_system_values stage. Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r--src/mesa/drivers/dri/i965/brw_vec4_nir.cpp27
1 files changed, 21 insertions, 6 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp b/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp
index 696122d725e..d9af945e2e4 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp
@@ -494,17 +494,32 @@ vec4_visitor::nir_emit_intrinsic(nir_intrinsic_instr *instr)
case nir_intrinsic_load_vertex_id:
unreachable("should be lowered by lower_vertex_id()");
- case nir_intrinsic_load_vertex_id_zero_base:
- /* @TODO: Not yet implemented */
+ case nir_intrinsic_load_vertex_id_zero_base: {
+ src_reg vertex_id =
+ src_reg(nir_system_values[SYSTEM_VALUE_VERTEX_ID_ZERO_BASE]);
+ assert(vertex_id.file != BAD_FILE);
+ dest = get_nir_dest(instr->dest, vertex_id.type);
+ emit(MOV(dest, vertex_id));
break;
+ }
- case nir_intrinsic_load_base_vertex:
- /* @TODO: Not yet implemented */
+ case nir_intrinsic_load_base_vertex: {
+ src_reg base_vertex =
+ src_reg(nir_system_values[SYSTEM_VALUE_BASE_VERTEX]);
+ assert(base_vertex.file != BAD_FILE);
+ dest = get_nir_dest(instr->dest, base_vertex.type);
+ emit(MOV(dest, base_vertex));
break;
+ }
- case nir_intrinsic_load_instance_id:
- /* @TODO: Not yet implemented */
+ case nir_intrinsic_load_instance_id: {
+ src_reg instance_id =
+ src_reg(nir_system_values[SYSTEM_VALUE_INSTANCE_ID]);
+ assert(instance_id.file != BAD_FILE);
+ dest = get_nir_dest(instr->dest, instance_id.type);
+ emit(MOV(dest, instance_id));
break;
+ }
case nir_intrinsic_load_uniform_indirect:
/* fallthrough */