iris: Add support for serialized NIR
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6280>
This commit is contained in:
parent
baa4cf9b8e
commit
8d62735b47
|
@ -2376,12 +2376,31 @@ static void *
|
|||
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
|
||||
|
||||
|
|
|
@ -422,7 +422,8 @@ iris_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;
|
||||
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;
|
||||
|
|
Loading…
Reference in New Issue