From: Rob Clark Date: Mon, 15 Jun 2020 18:14:46 +0000 (-0700) Subject: freedreno/ir3: pass variant to ir3_create() X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6039d083f781b13b420ed7abe1660d353fe3e518;p=mesa.git freedreno/ir3: pass variant to ir3_create() Prep to convert over to ralloc. Signed-off-by: Rob Clark Part-of: --- diff --git a/src/freedreno/ir3/ir3.c b/src/freedreno/ir3/ir3.c index fd2b8eab9cc..3d41a7b5cc4 100644 --- a/src/freedreno/ir3/ir3.c +++ b/src/freedreno/ir3/ir3.c @@ -45,12 +45,13 @@ void * ir3_alloc(struct ir3 *shader, int sz) return rzalloc_size(shader, sz); /* TODO: don't use rzalloc */ } -struct ir3 * ir3_create(struct ir3_compiler *compiler, gl_shader_stage type) +struct ir3 * ir3_create(struct ir3_compiler *compiler, + struct ir3_shader_variant *v) { struct ir3 *shader = rzalloc(NULL, struct ir3); shader->compiler = compiler; - shader->type = type; + shader->type = v->type; list_inithead(&shader->block_list); list_inithead(&shader->array_list); diff --git a/src/freedreno/ir3/ir3.h b/src/freedreno/ir3/ir3.h index 48e340d09cd..51315a5f361 100644 --- a/src/freedreno/ir3/ir3.h +++ b/src/freedreno/ir3/ir3.h @@ -554,10 +554,11 @@ block_id(struct ir3_block *block) #endif } -struct ir3 * ir3_create(struct ir3_compiler *compiler, gl_shader_stage type); +struct ir3_shader_variant; + +struct ir3 * ir3_create(struct ir3_compiler *compiler, struct ir3_shader_variant *v); void ir3_destroy(struct ir3 *shader); -struct ir3_shader_variant; void * ir3_assemble(struct ir3_shader_variant *v); void * ir3_alloc(struct ir3 *shader, int sz); diff --git a/src/freedreno/ir3/ir3_compiler_nir.c b/src/freedreno/ir3/ir3_compiler_nir.c index bb45ba2c049..3c8007f5da3 100644 --- a/src/freedreno/ir3/ir3_compiler_nir.c +++ b/src/freedreno/ir3/ir3_compiler_nir.c @@ -3248,7 +3248,7 @@ emit_instructions(struct ir3_context *ctx) ctx->inputs = rzalloc_array(ctx, struct ir3_instruction *, ctx->ninputs); ctx->outputs = rzalloc_array(ctx, struct ir3_instruction *, ctx->noutputs); - ctx->ir = ir3_create(ctx->compiler, ctx->so->type); + ctx->ir = ir3_create(ctx->compiler, ctx->so); /* Create inputs in first block: */ ctx->block = get_block(ctx, nir_start_block(fxn)); diff --git a/src/freedreno/ir3/ir3_parser.y b/src/freedreno/ir3/ir3_parser.y index fe6cbe8a0ad..2e89d773fc9 100644 --- a/src/freedreno/ir3/ir3_parser.y +++ b/src/freedreno/ir3/ir3_parser.y @@ -89,7 +89,7 @@ static struct ir3_instruction * new_instr(opc_t opc) static void new_shader(void) { - variant->ir = ir3_create(variant->shader->compiler, variant->shader->type); + variant->ir = ir3_create(variant->shader->compiler, variant); block = ir3_block_create(variant->ir); list_addtail(&block->node, &variant->ir->block_list); }