radeonsi/nir: fix input processing for packed varyings
authorTimothy Arceri <tarceri@itsqueeze.com>
Fri, 23 Mar 2018 01:10:42 +0000 (12:10 +1100)
committerTimothy Arceri <tarceri@itsqueeze.com>
Tue, 27 Mar 2018 22:59:38 +0000 (09:59 +1100)
The location was only being incremented the first time we processed a
location. This meant we would incorrectly skip some elements of
an array if the first element was packed and proccessed previously
but other elements were not.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/gallium/drivers/radeonsi/si_shader_nir.c

index 82b2440d0b5a880601c471f9b8de2359fc764185..6444a8b5ddefb8d7232605cdd7146a7c4d05a5c8 100644 (file)
@@ -852,7 +852,7 @@ bool si_nir_build_llvm(struct si_shader_context *ctx, struct nir_shader *nir)
                                /* Packed components share the same location so skip
                                 * them if we have already processed the location.
                                 */
-                               if (processed_inputs & ((uint64_t)1 << loc)) {
+                               if (processed_inputs & ((uint64_t)1 << (loc + i))) {
                                        input_idx += 4;
                                        continue;
                                }
@@ -870,8 +870,7 @@ bool si_nir_build_llvm(struct si_shader_context *ctx, struct nir_shader *nir)
                                        bitcast_inputs(ctx, data, input_idx);
                                }
 
-                               processed_inputs |= ((uint64_t)1 << loc);
-                               loc++;
+                               processed_inputs |= ((uint64_t)1 << (loc + i));
                                input_idx += 4;
                        }
                }