Module: Mesa
Branch: master
Commit: 0d6019302eb772b1c399cecc3f5abf1940f0c0d0
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=0d6019302eb772b1c399cecc3f5abf1940f0c0d0

Author: Eric Anholt <[email protected]>
Date:   Tue Apr 21 16:15:03 2020 -0700

vc4: Use NIR shader's num_outputs for generating our new output.

Simplifies the code (we don't have struct or matrix varyings that would
have previously made this code break), and makes sure we keep
s->num_outputs accurate.

Reviewed-by: Connor Abbott <[email protected]>
Reviewed-by: Jose Maria Casanova Crespo <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4670>

---

 src/gallium/drivers/vc4/vc4_nir_lower_blend.c | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)

diff --git a/src/gallium/drivers/vc4/vc4_nir_lower_blend.c 
b/src/gallium/drivers/vc4/vc4_nir_lower_blend.c
index 32991ac7845..c915b8c5089 100644
--- a/src/gallium/drivers/vc4/vc4_nir_lower_blend.c
+++ b/src/gallium/drivers/vc4/vc4_nir_lower_blend.c
@@ -512,17 +512,6 @@ vc4_nir_blend_pipeline(struct vc4_compile *c, nir_builder 
*b, nir_ssa_def *src,
                                 nir_imm_int(b, ~colormask)));
 }
 
-static int
-vc4_nir_next_output_driver_location(nir_shader *s)
-{
-        int maxloc = -1;
-
-        nir_foreach_variable(var, &s->outputs)
-                maxloc = MAX2(maxloc, (int)var->data.driver_location);
-
-        return maxloc + 1;
-}
-
 static void
 vc4_nir_store_sample_mask(struct vc4_compile *c, nir_builder *b,
                           nir_ssa_def *val)
@@ -530,8 +519,7 @@ vc4_nir_store_sample_mask(struct vc4_compile *c, 
nir_builder *b,
         nir_variable *sample_mask = nir_variable_create(c->s, 
nir_var_shader_out,
                                                         glsl_uint_type(),
                                                         "sample_mask");
-        sample_mask->data.driver_location =
-                vc4_nir_next_output_driver_location(c->s);
+        sample_mask->data.driver_location = c->s->num_outputs++;
         sample_mask->data.location = FRAG_RESULT_SAMPLE_MASK;
 
         nir_intrinsic_instr *intr =

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to