summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRob Clark <[email protected]>2016-05-01 08:06:34 -0400
committerRob Clark <[email protected]>2016-05-02 14:25:38 -0400
commitdcf8c4425a2591504223a7d0a4b154b780af451e (patch)
tree8eec7c179fd062314867fdcd4dea877ccac7d2a5
parent226bd9294541f65c91cad44924ef68b6da18f2a2 (diff)
nir: make lower_clamp_color pass work after lower i/o
Kinda important to work with tgsi_to_nir, which generates nir which already has i/o lowered. Signed-off-by: Rob Clark <[email protected]>
-rw-r--r--src/compiler/nir/nir_lower_clamp_color_outputs.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/compiler/nir/nir_lower_clamp_color_outputs.c b/src/compiler/nir/nir_lower_clamp_color_outputs.c
index 37c4ff00a3d..68bfbed81aa 100644
--- a/src/compiler/nir/nir_lower_clamp_color_outputs.c
+++ b/src/compiler/nir/nir_lower_clamp_color_outputs.c
@@ -62,14 +62,28 @@ is_color_output(lower_state *state, nir_variable *out)
static void
lower_intrinsic(lower_state *state, nir_intrinsic_instr *intr)
{
- nir_variable *out;
+ nir_variable *out = NULL;
nir_builder *b = &state->b;
nir_ssa_def *s;
- if (intr->intrinsic != nir_intrinsic_store_var)
+ switch (intr->intrinsic) {
+ case nir_intrinsic_store_var:
+ out = intr->variables[0]->var;
+ break;
+ case nir_intrinsic_store_output:
+ /* already had i/o lowered.. lookup the matching output var: */
+ nir_foreach_variable(var, &state->shader->outputs) {
+ int drvloc = var->data.driver_location;
+ if (nir_intrinsic_base(intr) == drvloc) {
+ out = var;
+ break;
+ }
+ }
+ assert(out);
+ break;
+ default:
return;
-
- out = intr->variables[0]->var;
+ }
if (out->data.mode != nir_var_shader_out)
return;