summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2015-12-08 17:18:37 -0800
committerEric Anholt <eric@anholt.net>2015-12-11 17:03:51 -0800
commitecf2885d7f6b015127c8e2a73818fc7aa37903d3 (patch)
tree03bfad70b0c1a2f590d54fb913a007ba14fabca6
parentfc59ca406488ce1a4a760b015545b5612ebcee1c (diff)
vc4: Fix handling of sample_mask output.
I apparently broke this in a late refactor, in such a way that I decided its tests were some of those interminable ones that I should just blacklist from my testing. As a result, the refactors related to it were totally wrong. (cherry picked from commit 53b2523c6ed8202ba44596bee7ec7ba8420c4e92)
-rw-r--r--src/gallium/drivers/vc4/vc4_nir_lower_blend.c9
-rw-r--r--src/gallium/drivers/vc4/vc4_nir_lower_io.c3
2 files changed, 6 insertions, 6 deletions
diff --git a/src/gallium/drivers/vc4/vc4_nir_lower_blend.c b/src/gallium/drivers/vc4/vc4_nir_lower_blend.c
index 38676cff6b7..f1ba46a9a0a 100644
--- a/src/gallium/drivers/vc4/vc4_nir_lower_blend.c
+++ b/src/gallium/drivers/vc4/vc4_nir_lower_blend.c
@@ -588,10 +588,10 @@ vc4_nir_next_output_driver_location(nir_shader *s)
{
int maxloc = -1;
- nir_foreach_variable(var, &s->inputs)
- maxloc = MAX2(maxloc, var->data.driver_location);
+ nir_foreach_variable(var, &s->outputs)
+ maxloc = MAX2(maxloc, (int)var->data.driver_location);
- return maxloc;
+ return maxloc + 1;
}
static void
@@ -604,12 +604,11 @@ vc4_nir_store_sample_mask(struct vc4_compile *c, nir_builder *b,
sample_mask->data.driver_location =
vc4_nir_next_output_driver_location(c->s);
sample_mask->data.location = FRAG_RESULT_SAMPLE_MASK;
- exec_list_push_tail(&c->s->outputs, &sample_mask->node);
nir_intrinsic_instr *intr =
nir_intrinsic_instr_create(c->s, nir_intrinsic_store_output);
intr->num_components = 1;
- intr->const_index[0] = sample_mask->data.location;
+ intr->const_index[0] = sample_mask->data.driver_location;
intr->src[0] = nir_src_for_ssa(val);
nir_builder_instr_insert(b, &intr->instr);
diff --git a/src/gallium/drivers/vc4/vc4_nir_lower_io.c b/src/gallium/drivers/vc4/vc4_nir_lower_io.c
index 72a514756fd..7d36e9dd1db 100644
--- a/src/gallium/drivers/vc4/vc4_nir_lower_io.c
+++ b/src/gallium/drivers/vc4/vc4_nir_lower_io.c
@@ -311,7 +311,8 @@ vc4_nir_lower_output(struct vc4_compile *c, nir_builder *b,
/* Color output is lowered by vc4_nir_lower_blend(). */
if (c->stage == QSTAGE_FRAG &&
(output_var->data.location == FRAG_RESULT_COLOR ||
- output_var->data.location == FRAG_RESULT_DATA0)) {
+ output_var->data.location == FRAG_RESULT_DATA0 ||
+ output_var->data.location == FRAG_RESULT_SAMPLE_MASK)) {
intr->const_index[0] *= 4;
return;
}