panfrost: Handle empty shaders
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Mon, 16 Dec 2019 21:45:28 +0000 (16:45 -0500)
committerMarge Bot <eric+marge@anholt.net>
Tue, 17 Dec 2019 17:42:57 +0000 (17:42 +0000)
I didn't realize this was in spec, but it fixes a crash in shaderdb.

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/3125>

src/gallium/drivers/panfrost/pan_assemble.c

index 87127ba945b29cc0c319e1684cff044aa380cd1f..54c5ba7970099a8be6d12a42ca1387fe21143066 100644 (file)
@@ -77,9 +77,14 @@ panfrost_shader_compile(
          * I bet someone just thought that would be a cute pun. At least,
          * that's how I'd do it. */
 
-        state->bo = panfrost_bo_create(screen, size, PAN_BO_EXECUTE);
-        memcpy(state->bo->cpu, dst, size);
-        meta->shader = state->bo->gpu | program.first_tag;
+        if (size) {
+                state->bo = panfrost_bo_create(screen, size, PAN_BO_EXECUTE);
+                memcpy(state->bo->cpu, dst, size);
+                meta->shader = state->bo->gpu | program.first_tag;
+        } else {
+                /* no shader */
+                meta->shader = 0x0;
+        }
 
         util_dynarray_fini(&program.compiled);