diff options
author | Rob Clark <[email protected]> | 2015-09-17 13:35:33 -0400 |
---|---|---|
committer | Rob Clark <[email protected]> | 2015-09-18 21:07:50 -0400 |
commit | 9ffc1049cae07e4e2d2dc8f4d1f5f113b4b1fdc4 (patch) | |
tree | 4664749c6971988ca271cfa22af2291fb5f3c12c /src/gallium/drivers/freedreno | |
parent | e13ed3ffb4d5267e7b79eece448abf1db1438ea1 (diff) |
freedreno/ir3: use nir two-sided-color lowering
With this, we completely switch over to nir lowering passes instead of
tgsi_lowering. So one step closer to supporting direct glsl or spirv to
nir support for freedreno a3xx/a4xx.
Signed-off-by: Rob Clark <[email protected]>
Diffstat (limited to 'src/gallium/drivers/freedreno')
-rw-r--r-- | src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c | 24 |
1 files changed, 3 insertions, 21 deletions
diff --git a/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c b/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c index c609d3c77fd..7eddbdd3825 100644 --- a/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c +++ b/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c @@ -181,6 +181,8 @@ static struct nir_shader *to_nir(struct ir3_compile *ctx, nir_lower_clip_fs(s, so->key.ucp_enables); } nir_lower_tex(s, &tex_options); + if (so->key.color_two_side) + nir_lower_two_sided_color(s); nir_lower_idiv(s); nir_lower_load_const_to_scalar(s); @@ -212,26 +214,12 @@ static struct nir_shader *to_nir(struct ir3_compile *ctx, return s; } -/* TODO nir doesn't lower everything for us yet, but ideally it would: */ -static const struct tgsi_token * -lower_tgsi(struct ir3_compile *ctx, const struct tgsi_token *tokens, - struct ir3_shader_variant *so) -{ - struct tgsi_shader_info info; - struct tgsi_lowering_config lconfig = { - .color_two_side = so->key.color_two_side, - }; - - return tgsi_transform_lowering(&lconfig, tokens, &info); -} - static struct ir3_compile * compile_init(struct ir3_compiler *compiler, struct ir3_shader_variant *so, const struct tgsi_token *tokens) { struct ir3_compile *ctx = rzalloc(NULL, struct ir3_compile); - const struct tgsi_token *lowered_tokens; if (compiler->gpu_id >= 400) { /* need special handling for "flat" */ @@ -258,13 +246,7 @@ compile_init(struct ir3_compiler *compiler, ctx->block_ht = _mesa_hash_table_create(ctx, _mesa_hash_pointer, _mesa_key_pointer_equal); - lowered_tokens = lower_tgsi(ctx, tokens, so); - if (!lowered_tokens) - lowered_tokens = tokens; - ctx->s = to_nir(ctx, lowered_tokens, so); - - if (lowered_tokens != tokens) - free((void *)lowered_tokens); + ctx->s = to_nir(ctx, tokens, so); so->first_driver_param = so->first_immediate = ctx->s->num_uniforms; |