aco: prevent a division by zero when patch control points is dynamic
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Tue, 30 Aug 2022 15:49:34 +0000 (17:49 +0200)
committerMarge Bot <emma+marge@anholt.net>
Tue, 13 Sep 2022 08:24:14 +0000 (08:24 +0000)
tess_input_vertices is zero if the state is dynamic.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18344>

src/amd/compiler/aco_instruction_selection.cpp

index 8904b21..9b564d6 100644 (file)
@@ -11868,8 +11868,8 @@ select_program(Program* program, unsigned shader_count, struct nir_shader* const
          if (!ngg_gs && !tcs_skip_barrier) {
             sync_scope scope =
                ctx.stage == vertex_tess_control_hs &&
-                     program->wave_size % ctx.options->key.tcs.tess_input_vertices == 0 &&
-                     ctx.options->key.tcs.tess_input_vertices == nir->info.tess.tcs_vertices_out
+                     ctx.options->key.tcs.tess_input_vertices == nir->info.tess.tcs_vertices_out &&
+                     program->wave_size % ctx.options->key.tcs.tess_input_vertices == 0
                   ? scope_subgroup
                   : scope_workgroup;
             bld.barrier(aco_opcode::p_barrier,