summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/nir
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2016-07-19 10:55:47 -0700
committerEric Anholt <[email protected]>2016-07-26 13:47:50 -0700
commit4d0b2c7aaac3cf3de5af8474c83501122841d157 (patch)
treef28b980bad8de7bc366a5865a62e4667f8208ba9 /src/gallium/auxiliary/nir
parent7b9a0f4e38b6b64a91ed0e674410af962b390120 (diff)
ttn: Update shader->info as we generate code.
We could use the nir_shader_gather_info() pass to update it after the fact, but this is what glsl_to_nir and prog_to_nir do. Reviewed-by: Rob Clark <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/nir')
-rw-r--r--src/gallium/auxiliary/nir/tgsi_to_nir.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/nir/tgsi_to_nir.c b/src/gallium/auxiliary/nir/tgsi_to_nir.c
index e1d7c682bf6..65eca6f9e86 100644
--- a/src/gallium/auxiliary/nir/tgsi_to_nir.c
+++ b/src/gallium/auxiliary/nir/tgsi_to_nir.c
@@ -364,6 +364,10 @@ ttn_emit_declaration(struct ttn_compile *c)
}
exec_list_push_tail(&b->shader->inputs, &var->node);
+
+ for (int i = 0; i < array_size; i++)
+ b->shader->info.inputs_read |= 1 << (var->data.location + i);
+
break;
case TGSI_FILE_OUTPUT: {
int semantic_name = decl->Semantic.Name;
@@ -426,6 +430,9 @@ ttn_emit_declaration(struct ttn_compile *c)
}
exec_list_push_tail(&b->shader->outputs, &var->node);
+
+ for (int i = 0; i < array_size; i++)
+ b->shader->info.outputs_written |= 1 << (var->data.location + i);
}
break;
case TGSI_FILE_CONSTANT:
@@ -571,6 +578,10 @@ ttn_src_for_file_and_index(struct ttn_compile *c, unsigned file, unsigned index,
nir_builder_instr_insert(b, &load->instr);
src = nir_src_for_ssa(&load->dest.ssa);
+
+ b->shader->info.system_values_read |=
+ (1 << nir_system_value_from_intrinsic(op));
+
break;
}
@@ -1036,6 +1047,7 @@ ttn_kill(nir_builder *b, nir_op op, nir_alu_dest dest, nir_ssa_def **src)
nir_intrinsic_instr *discard =
nir_intrinsic_instr_create(b->shader, nir_intrinsic_discard);
nir_builder_instr_insert(b, &discard->instr);
+ b->shader->info.fs.uses_discard = true;
}
static void
@@ -1048,6 +1060,7 @@ ttn_kill_if(nir_builder *b, nir_op op, nir_alu_dest dest, nir_ssa_def **src)
nir_intrinsic_instr_create(b->shader, nir_intrinsic_discard_if);
discard->src[0] = nir_src_for_ssa(cmp);
nir_builder_instr_insert(b, &discard->instr);
+ b->shader->info.fs.uses_discard = true;
}
static void