pan/bi: Fix empty shader handling

Fixes INSTR_INVALID_ENC fault on dEQP-GLES31.functional.compute.basic.empty

Fixes: bfcdc8f174 ("pan/bi: Add some zero bytes after shaders on Bifrost")
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9011>
This commit is contained in:
Alyssa Rosenzweig 2021-02-12 08:21:45 -05:00 committed by Marge Bot
parent a805d999c0
commit 9bf8bfe3c8

View file

@ -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;