diff options
author | Marek Olšák <[email protected]> | 2020-01-03 17:07:38 -0500 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2020-01-20 16:16:11 -0500 |
commit | 943d131e7db4147113ac204e99382a18ce3fc99d (patch) | |
tree | 9fa0a6272ced36927bb5a4798b6934ea69e082aa /src/gallium | |
parent | a966729c840a96af993e9039d9cf09b9d8921c4b (diff) |
radeonsi/gfx10: merge main and pos/param export IF blocks into one if possible
Acked-by: Pierre-Eric Pelloux-Prayer <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/drivers/radeonsi/gfx10_shader_ngg.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/src/gallium/drivers/radeonsi/gfx10_shader_ngg.c b/src/gallium/drivers/radeonsi/gfx10_shader_ngg.c index b8c34634cbe..a25c89bac56 100644 --- a/src/gallium/drivers/radeonsi/gfx10_shader_ngg.c +++ b/src/gallium/drivers/radeonsi/gfx10_shader_ngg.c @@ -629,7 +629,14 @@ void gfx10_emit_ngg_epilogue(struct ac_shader_abi *abi, } } - ac_build_endif(&ctx->ac, ctx->merged_wrap_if_label); + bool unterminated_es_if_block = + gfx10_is_ngg_passthrough(ctx->shader) && + !ctx->screen->use_ngg_streamout && /* no query buffer */ + (ctx->type != PIPE_SHADER_VERTEX || + !ctx->shader->key.mono.u.vs_export_prim_id); + + if (!unterminated_es_if_block) + ac_build_endif(&ctx->ac, ctx->merged_wrap_if_label); LLVMValueRef is_gs_thread = si_is_gs_thread(ctx); LLVMValueRef is_es_thread = si_is_es_thread(ctx); @@ -647,8 +654,9 @@ void gfx10_emit_ngg_epilogue(struct ac_shader_abi *abi, LLVMValueRef emitted_prims = NULL; if (sel->so.num_outputs) { - struct ngg_streamout nggso = {}; + assert(!unterminated_es_if_block); + struct ngg_streamout nggso = {}; nggso.num_vertices = num_vertices_val; nggso.prim_enable[0] = is_gs_thread; @@ -662,6 +670,8 @@ void gfx10_emit_ngg_epilogue(struct ac_shader_abi *abi, LLVMValueRef user_edgeflags[3] = {}; if (sel->info.writes_edgeflag) { + assert(!unterminated_es_if_block); + /* Streamout already inserted the barrier, so don't insert it again. */ if (!sel->so.num_outputs) ac_build_s_barrier(&ctx->ac); @@ -686,6 +696,8 @@ void gfx10_emit_ngg_epilogue(struct ac_shader_abi *abi, */ if (ctx->type == PIPE_SHADER_VERTEX && ctx->shader->key.mono.u.vs_export_prim_id) { + assert(!unterminated_es_if_block); + /* Streamout and edge flags use LDS. Make it idle, so that we can reuse it. */ if (sel->so.num_outputs || sel->info.writes_edgeflag) ac_build_s_barrier(&ctx->ac); @@ -709,6 +721,8 @@ void gfx10_emit_ngg_epilogue(struct ac_shader_abi *abi, /* Update query buffer */ if (ctx->screen->use_ngg_streamout && !info->properties[TGSI_PROPERTY_VS_BLIT_SGPRS_AMD]) { + assert(!unterminated_es_if_block); + tmp = si_unpack_param(ctx, ctx->vs_state_bits, 6, 1); tmp = LLVMBuildTrunc(builder, tmp, ctx->i1, ""); ac_build_ifcc(&ctx->ac, tmp, 5029); /* if (STREAMOUT_QUERY_ENABLED) */ @@ -742,11 +756,14 @@ void gfx10_emit_ngg_epilogue(struct ac_shader_abi *abi, } /* Build the primitive export. */ - if (!gfx10_ngg_export_prim_early(ctx->shader)) + if (!gfx10_ngg_export_prim_early(ctx->shader)) { + assert(!unterminated_es_if_block); gfx10_ngg_build_export_prim(ctx, user_edgeflags); + } /* Export per-vertex data (positions and parameters). */ - ac_build_ifcc(&ctx->ac, is_es_thread, 6002); + if (!unterminated_es_if_block) + ac_build_ifcc(&ctx->ac, is_es_thread, 6002); { unsigned i; |