iris_create_compute_state(struct pipe_context *ctx,
const struct pipe_compute_state *state)
{
- assert(state->ir_type == PIPE_SHADER_IR_NIR);
-
struct iris_context *ice = (void *) ctx;
struct iris_screen *screen = (void *) ctx->screen;
+ const nir_shader_compiler_options *options =
+ screen->compiler->glsl_compiler_options[MESA_SHADER_COMPUTE].NirOptions;
+
+ nir_shader *nir;
+ switch (state->ir_type) {
+ case PIPE_SHADER_IR_NIR:
+ nir = (void *)state->prog;
+ break;
+
+ case PIPE_SHADER_IR_NIR_SERIALIZED: {
+ struct blob_reader reader;
+ const struct pipe_binary_program_header *hdr = state->prog;
+ blob_reader_init(&reader, hdr->blob, hdr->num_bytes);
+ nir = nir_deserialize(NULL, options, &reader);
+ break;
+ }
+
+ default:
+ unreachable("Unsupported IR");
+ }
+
struct iris_uncompiled_shader *ish =
- iris_create_uncompiled_shader(ctx, (void *) state->prog, NULL);
+ iris_create_uncompiled_shader(ctx, nir, NULL);
// XXX: disallow more than 64KB of shared variables
case PIPE_SHADER_CAP_PREFERRED_IR:
return PIPE_SHADER_IR_NIR;
case PIPE_SHADER_CAP_SUPPORTED_IRS:
- return 1 << PIPE_SHADER_IR_NIR;
+ return (1 << PIPE_SHADER_IR_NIR) |
+ (1 << PIPE_SHADER_IR_NIR_SERIALIZED);
case PIPE_SHADER_CAP_TGSI_DROUND_SUPPORTED:
case PIPE_SHADER_CAP_TGSI_LDEXP_SUPPORTED:
return 1;