Mesa (master): freedreno/ir3: pass variant to ir3_create()

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jun 19 13:49:31 UTC 2020


Module: Mesa
Branch: master
Commit: 6039d083f781b13b420ed7abe1660d353fe3e518
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=6039d083f781b13b420ed7abe1660d353fe3e518

Author: Rob Clark <robdclark at chromium.org>
Date:   Mon Jun 15 11:14:46 2020 -0700

freedreno/ir3: pass variant to ir3_create()

Prep to convert over to ralloc.

Signed-off-by: Rob Clark <robdclark at chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5508>

---

 src/freedreno/ir3/ir3.c              | 5 +++--
 src/freedreno/ir3/ir3.h              | 5 +++--
 src/freedreno/ir3/ir3_compiler_nir.c | 2 +-
 src/freedreno/ir3/ir3_parser.y       | 2 +-
 4 files changed, 8 insertions(+), 6 deletions(-)

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);
 }



More information about the mesa-commit mailing list