summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimur Kristóf <[email protected]>2019-02-08 22:15:56 +0100
committerEric Anholt <[email protected]>2019-03-05 19:13:27 +0000
commit840c7d1ebd08785b7fff5efdfc1a7fb2a8ff94b1 (patch)
treec349109c20cc1f19d7046a445a95a57edc9512ae
parent9a834447d652ea50864bb6c32f4ff99ac10d39bf (diff)
tgsi_to_nir: Restructure system value loads.
Minor cleanup to the way system value loads work in tgsi_to_nir. Signed-Off-By: Timur Kristóf <[email protected]> Tested-by: Andre Heider <[email protected]> Tested-by: Rob Clark <[email protected]> Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
-rw-r--r--src/gallium/auxiliary/nir/tgsi_to_nir.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/gallium/auxiliary/nir/tgsi_to_nir.c b/src/gallium/auxiliary/nir/tgsi_to_nir.c
index 11c16d43615..67058b398ae 100644
--- a/src/gallium/auxiliary/nir/tgsi_to_nir.c
+++ b/src/gallium/auxiliary/nir/tgsi_to_nir.c
@@ -479,9 +479,8 @@ ttn_src_for_file_and_index(struct ttn_compile *c, unsigned file, unsigned index,
break;
case TGSI_FILE_SYSTEM_VALUE: {
- nir_intrinsic_instr *load;
nir_intrinsic_op op;
- unsigned ncomp = 1;
+ nir_ssa_def *load;
assert(!indirect);
assert(!dim);
@@ -489,28 +488,25 @@ ttn_src_for_file_and_index(struct ttn_compile *c, unsigned file, unsigned index,
switch (c->scan->system_value_semantic_name[index]) {
case TGSI_SEMANTIC_VERTEXID_NOBASE:
op = nir_intrinsic_load_vertex_id_zero_base;
+ load = nir_load_vertex_id_zero_base(b);
break;
case TGSI_SEMANTIC_VERTEXID:
op = nir_intrinsic_load_vertex_id;
+ load = nir_load_vertex_id(b);
break;
case TGSI_SEMANTIC_BASEVERTEX:
op = nir_intrinsic_load_base_vertex;
+ load = nir_load_base_vertex(b);
break;
case TGSI_SEMANTIC_INSTANCEID:
op = nir_intrinsic_load_instance_id;
+ load = nir_load_instance_id(b);
break;
default:
unreachable("bad system value");
}
- load = nir_intrinsic_instr_create(b->shader, op);
- load->num_components = ncomp;
-
- nir_ssa_dest_init(&load->instr, &load->dest, ncomp, 32, NULL);
- nir_builder_instr_insert(b, &load->instr);
-
- src = nir_src_for_ssa(&load->dest.ssa);
-
+ src = nir_src_for_ssa(load);
b->shader->info.system_values_read |=
(1 << nir_system_value_from_intrinsic(op));