[Mesa-dev] [RFCv0 5/8] freedreno/ir3: drop tokens arg

Rob Clark robdclark at gmail.com
Mon Oct 19 12:54:38 PDT 2015


We can get the tokens from variant->shader so drop the extra arg.  This
will make things easier to support either getting TGSI or NIR as input.
---
 src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c b/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c
index 8c9234b..b4e5483 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c
+++ b/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c
@@ -126,8 +126,8 @@ struct ir3_compile {
 static struct ir3_instruction * create_immed(struct ir3_block *block, uint32_t val);
 static struct ir3_block * get_block(struct ir3_compile *ctx, nir_block *nblock);
 
-static struct nir_shader *to_nir(struct ir3_compile *ctx,
-		const struct tgsi_token *tokens, struct ir3_shader_variant *so)
+static struct nir_shader *
+to_nir(struct ir3_compile *ctx, struct ir3_shader_variant *so)
 {
 	static const nir_shader_compiler_options options = {
 			.lower_fpow = true,
@@ -164,7 +164,7 @@ static struct nir_shader *to_nir(struct ir3_compile *ctx,
 		tex_options.lower_txp = (1 << GLSL_SAMPLER_DIM_3D);
 	}
 
-	struct nir_shader *s = tgsi_to_nir(tokens, &options);
+	struct nir_shader *s = tgsi_to_nir(so->shader->tokens, &options);
 
 	if (fd_mesa_debug & FD_DBG_OPTMSGS) {
 		debug_printf("----------------------\n");
@@ -214,9 +214,7 @@ static struct nir_shader *to_nir(struct ir3_compile *ctx,
 }
 
 static struct ir3_compile *
-compile_init(struct ir3_compiler *compiler,
-		struct ir3_shader_variant *so,
-		const struct tgsi_token *tokens)
+compile_init(struct ir3_compiler *compiler, struct ir3_shader_variant *so)
 {
 	struct ir3_compile *ctx = rzalloc(NULL, struct ir3_compile);
 
@@ -245,7 +243,7 @@ compile_init(struct ir3_compiler *compiler,
 	ctx->block_ht = _mesa_hash_table_create(ctx,
 			_mesa_hash_pointer, _mesa_key_pointer_equal);
 
-	ctx->s = to_nir(ctx, tokens, so);
+	ctx->s = to_nir(ctx, so);
 
 	so->first_driver_param = so->first_immediate = ctx->s->num_uniforms;
 
@@ -2432,7 +2430,7 @@ ir3_compile_shader_nir(struct ir3_compiler *compiler,
 
 	assert(!so->ir);
 
-	ctx = compile_init(compiler, so, so->shader->tokens);
+	ctx = compile_init(compiler, so);
 	if (!ctx) {
 		DBG("INIT failed!");
 		ret = -1;
-- 
2.5.0



More information about the mesa-dev mailing list