pan/bi: Fix NULL deref with empty shader
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Wed, 3 Feb 2021 19:11:44 +0000 (14:11 -0500)
committerMarge Bot <eric+marge@anholt.net>
Fri, 5 Feb 2021 17:49:44 +0000 (17:49 +0000)
Fixes regression in dEQP-GLES31.functional.compute.basic.empty

Fixes: d0902aa2d4d ("pan/bi: Pass through wait_{6, 7} flags")
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8848>

src/panfrost/bifrost/bifrost_compile.c

index 4177949..f54e122 100644 (file)
@@ -2406,7 +2406,7 @@ bifrost_compile_shader_nir(void *mem_ctx, nir_shader *nir,
         pan_block *first_block = list_first_entry(&ctx->blocks, pan_block, link);
         bi_clause *first_clause = bi_next_clause(ctx, first_block, NULL);
 
-        unsigned first_deps = first_clause->dependencies;
+        unsigned first_deps = first_clause ? first_clause->dependencies : 0;
         program->wait_6 = (first_deps & (1 << 6));
         program->wait_7 = (first_deps & (1 << 7));