diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c b/src/gallium/drivers/freedreno/freedreno_screen.c index 495b456698b..3402366541d 100644 --- a/src/gallium/drivers/freedreno/freedreno_screen.c +++ b/src/gallium/drivers/freedreno/freedreno_screen.c @@ -666,7 +666,10 @@ fd_screen_get_shader_param(struct pipe_screen *pscreen, case PIPE_SHADER_CAP_PREFERRED_IR: return PIPE_SHADER_IR_NIR; case PIPE_SHADER_CAP_SUPPORTED_IRS: - return (1 << PIPE_SHADER_IR_NIR) | (1 << PIPE_SHADER_IR_TGSI); + return (1 << PIPE_SHADER_IR_NIR) | + COND(has_compute(screen) && (shader == PIPE_SHADER_COMPUTE), + (1 << PIPE_SHADER_IR_NIR_SERIALIZED)) | + (1 << PIPE_SHADER_IR_TGSI); case PIPE_SHADER_CAP_MAX_UNROLL_ITERATIONS_HINT: return 32; case PIPE_SHADER_CAP_MAX_SHADER_BUFFERS: diff --git a/src/gallium/drivers/freedreno/ir3/ir3_gallium.c b/src/gallium/drivers/freedreno/ir3/ir3_gallium.c index f26e8103421..06ea8fec32c 100644 --- a/src/gallium/drivers/freedreno/ir3/ir3_gallium.c +++ b/src/gallium/drivers/freedreno/ir3/ir3_gallium.c @@ -34,6 +34,7 @@ #include "util/u_string.h" #include "nir/tgsi_to_nir.h" +#include "nir_serialize.h" #include "freedreno_context.h" #include "freedreno_util.h" @@ -288,6 +289,16 @@ ir3_shader_compute_state_create(struct pipe_context *pctx, if (cso->ir_type == PIPE_SHADER_IR_NIR) { /* we take ownership of the reference: */ nir = (nir_shader *)cso->prog; + } else if (cso->ir_type == PIPE_SHADER_IR_NIR_SERIALIZED) { + const nir_shader_compiler_options *options = + ir3_get_compiler_options(compiler); + const struct pipe_binary_program_header *hdr = cso->prog; + struct blob_reader reader; + + blob_reader_init(&reader, hdr->blob, hdr->num_bytes); + nir = nir_deserialize(NULL, options, &reader); + + ir3_finalize_nir(compiler, nir); } else { debug_assert(cso->ir_type == PIPE_SHADER_IR_TGSI); if (ir3_shader_debug & IR3_DBG_DISASM) {