diff options
author | Timur Kristóf <[email protected]> | 2020-02-24 15:27:43 +0100 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-03-11 08:34:11 +0000 |
commit | 8c3ab49c6b48299935751009c4109a4d2a3b8912 (patch) | |
tree | 15e20cfaeea5db71941f01604869b0d4bc88bfb3 /src/amd | |
parent | b9695013986d3341e5bb74cfc09dc492204129f5 (diff) |
aco: Don't generate an if when the first part of a merged HS or GS is empty.
In some cases (eg. in a few tessellation CTS tests) the VS part of
a merged HS is completely empty. Let's not generate a divergent if
in these cases. (LLVM also doesn't do it.)
No pipeline DB changes, only affects the CTS.
Signed-off-by: Timur Kristóf <[email protected]>
Reviewed-by: Rhys Perry <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3964>
Diffstat (limited to 'src/amd')
-rw-r--r-- | src/amd/compiler/aco_instruction_selection.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/amd/compiler/aco_instruction_selection.cpp b/src/amd/compiler/aco_instruction_selection.cpp index e8902ecdde6..62d14e6f824 100644 --- a/src/amd/compiler/aco_instruction_selection.cpp +++ b/src/amd/compiler/aco_instruction_selection.cpp @@ -9598,8 +9598,16 @@ void select_program(Program *program, split_arguments(&ctx, startpgm); } + /* In a merged VS+TCS HS, the VS implementation can be completely empty. */ + nir_function_impl *func = nir_shader_get_entrypoint(nir); + bool empty_shader = nir_cf_list_is_empty_block(&func->body) && + ((nir->info.stage == MESA_SHADER_VERTEX && + (ctx.stage == vertex_tess_control_hs || ctx.stage == vertex_geometry_gs)) || + (nir->info.stage == MESA_SHADER_TESS_EVAL && + ctx.stage == tess_eval_geometry_gs)); + if_context ic; - if (shader_count >= 2) { + if (shader_count >= 2 && !empty_shader) { Builder bld(ctx.program, ctx.block); Temp count = bld.sop2(aco_opcode::s_bfe_u32, bld.def(s1), bld.def(s1, scc), get_arg(&ctx, args->merged_wave_info), Operand((8u << 16) | (i * 8u))); Temp thread_id = emit_mbcnt(&ctx, bld.def(v1)); @@ -9623,7 +9631,6 @@ void select_program(Program *program, if (ctx.stage == fragment_fs) handle_bc_optimize(&ctx); - nir_function_impl *func = nir_shader_get_entrypoint(nir); visit_cf_list(&ctx, &func->body); if (ctx.program->info->so.num_outputs && (ctx.stage == vertex_vs || ctx.stage == tess_eval_vs)) @@ -9642,7 +9649,7 @@ void select_program(Program *program, if (ctx.stage == fragment_fs) create_fs_exports(&ctx); - if (shader_count >= 2) { + if (shader_count >= 2 && !empty_shader) { begin_divergent_if_else(&ctx, &ic); end_divergent_if(&ctx, &ic); } |