Mesa (master): pan/bi: Fix empty shader handling
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Feb 12 16:59:46 UTC 2021
Module: Mesa
Branch: master
Commit: 9bf8bfe3c8db1a0e10eb0471fa6916f924e06e1c
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=9bf8bfe3c8db1a0e10eb0471fa6916f924e06e1c
Author: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Date: Fri Feb 12 08:21:45 2021 -0500
pan/bi: Fix empty shader handling
Fixes INSTR_INVALID_ENC fault on dEQP-GLES31.functional.compute.basic.empty
Fixes: bfcdc8f1747 ("pan/bi: Add some zero bytes after shaders on Bifrost")
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9011>
---
src/panfrost/bifrost/bifrost_compile.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/panfrost/bifrost/bifrost_compile.c b/src/panfrost/bifrost/bifrost_compile.c
index 39b8eeacfc5..949aa51b5db 100644
--- a/src/panfrost/bifrost/bifrost_compile.c
+++ b/src/panfrost/bifrost/bifrost_compile.c
@@ -2577,11 +2577,15 @@ bifrost_compile_shader_nir(void *mem_ctx, nir_shader *nir,
bifrost_debug & BIFROST_DBG_VERBOSE);
}
- /* Pad the shader with enough zero bytes to trick the prefetcher */
+ /* Pad the shader with enough zero bytes to trick the prefetcher,
+ * unless we're compiling an empty shader (in which case we don't pad
+ * so the size remains 0) */
unsigned prefetch_size = BIFROST_SHADER_PREFETCH - final_clause;
- memset(util_dynarray_grow(&program->compiled, uint8_t, prefetch_size),
- 0, prefetch_size);
+ if (program->compiled.size) {
+ memset(util_dynarray_grow(&program->compiled, uint8_t, prefetch_size),
+ 0, prefetch_size);
+ }
program->tls_size = ctx->tls_size;
More information about the mesa-commit
mailing list