panfrost: Hoist instance_shift/instance_odd fetch
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Fri, 14 Aug 2020 16:25:18 +0000 (12:25 -0400)
committerMarge Bot <eric+marge@anholt.net>
Mon, 17 Aug 2020 11:43:52 +0000 (11:43 +0000)
We'll want to pass it as an argument shortly.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6326>

src/gallium/drivers/panfrost/pan_cmdstream.c

index 1069dab..457c02c 100644 (file)
@@ -1344,6 +1344,9 @@ panfrost_emit_vertex_data(struct panfrost_batch *batch,
         struct panfrost_context *ctx = batch->ctx;
         struct panfrost_vertex_state *so = ctx->vertex;
 
+        unsigned instance_shift = vertex_postfix->instance_shift;
+        unsigned instance_odd = vertex_postfix->instance_odd;
+
         /* Staged mali_attr, and index into them. i =/= k, depending on the
          * vertex buffer mask and instancing. Twice as much room is allocated,
          * for a worst case of NPOT_DIVIDEs which take up extra slot */
@@ -1419,9 +1422,6 @@ panfrost_emit_vertex_data(struct panfrost_batch *batch,
                         /* Normal, non-instanced attributes */
                         attrs[k++].elements |= MALI_ATTR_LINEAR;
                 } else {
-                        unsigned instance_shift = vertex_postfix->instance_shift;
-                        unsigned instance_odd = vertex_postfix->instance_odd;
-
                         k += panfrost_vertex_instanced(ctx->padded_count,
                                                        instance_shift,
                                                        instance_odd,