v3d: Only add output slot tracking for the current varying slot.
authorEric Anholt <eric@anholt.net>
Fri, 28 Sep 2018 19:40:32 +0000 (12:40 -0700)
committerEric Anholt <eric@anholt.net>
Tue, 30 Oct 2018 17:46:52 +0000 (10:46 -0700)
We always emit 4 slots per slot because things like color output and
position processing in the epilogue will potentially look up more values
than the variable declaration had.  However, when we get a .location_frac
!= 0, we don't want to overwrite components of the following
.driver_location.

src/broadcom/compiler/nir_to_vir.c

index 4becc97..bb41c1b 100644 (file)
@@ -1396,7 +1396,7 @@ ntq_setup_outputs(struct v3d_compile *c)
                 assert(array_len == 1);
                 (void)array_len;
 
-                for (int i = 0; i < 4; i++) {
+                for (int i = 0; i < 4 - var->data.location_frac; i++) {
                         add_output(c, loc + var->data.location_frac + i,
                                    var->data.location,
                                    var->data.location_frac + i);