pan/bi: Count blocks
authorAlyssa Rosenzweig <alyssa@collabora.com>
Tue, 19 Apr 2022 18:00:01 +0000 (14:00 -0400)
committerMarge Bot <emma+marge@anholt.net>
Tue, 3 May 2022 17:56:16 +0000 (17:56 +0000)
For u_worklist.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16279>

src/panfrost/bifrost/bi_test.h
src/panfrost/bifrost/bifrost_compile.c
src/panfrost/bifrost/compiler.h

index 04e0460..9a745fe 100644 (file)
@@ -37,6 +37,7 @@ bit_builder(void *memctx)
 {
         bi_context *ctx = rzalloc(memctx, bi_context);
         list_inithead(&ctx->blocks);
+        ctx->num_blocks = 1;
 
         bi_block *blk = rzalloc(ctx, bi_block);
 
index f7b6f29..c653530 100644 (file)
@@ -4555,12 +4555,9 @@ bi_compile_variant_nir(nir_shader *nir,
                 break; /* TODO: Multi-function shaders */
         }
 
-        unsigned block_source_count = 0;
-
+        /* Index blocks now that we're done emitting */
         bi_foreach_block(ctx, block) {
-                /* Name blocks now that we're done emitting so the order is
-                 * consistent */
-                block->index = block_source_count++;
+                block->index = ctx->num_blocks++;
         }
 
         bi_validate(ctx, "NIR -> BIR");
index a143dd8..3e9c23e 100644 (file)
@@ -731,6 +731,7 @@ typedef struct {
        uint32_t quirks;
        unsigned arch;
        enum bi_idvs_mode idvs;
+       unsigned num_blocks;
 
        /* In any graphics shader, whether the "IDVS with memory
         * allocation" flow is used. This affects how varyings are loaded and