panfrost/midgard: Pipe through varying arrays
authorAlyssa Rosenzweig <alyssa@rosenzweig.io>
Sat, 20 Apr 2019 23:39:29 +0000 (23:39 +0000)
committerAlyssa Rosenzweig <alyssa@rosenzweig.io>
Wed, 24 Apr 2019 02:22:31 +0000 (02:22 +0000)
Varying arrays sometimes are lowered to a series of directly accessed
varyings (which we handled okay), but when indirectly accessed, they
appear as a single array; we need to handle this as well.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
src/gallium/drivers/panfrost/midgard/midgard_compile.c

index 67c1d59d85afa0996fc553c71994868be74d2003..ce758f5555ba91a515d1feb1ad04d72c8a4e8d96 100644 (file)
@@ -3417,7 +3417,11 @@ midgard_compile_shader_nir(nir_shader *nir, midgard_program *program, bool is_bl
 
         nir_foreach_variable(var, varyings) {
                 unsigned loc = var->data.driver_location;
-                program->varyings[loc] = var->data.location;
+                unsigned sz = glsl_type_size(var->type, FALSE);
+
+                for (int c = 0; c < sz; ++c) {
+                        program->varyings[loc + c] = var->data.location;
+                }
         }
 
         /* Lower gl_Position pre-optimisation */