radeonsi: avoid sending GS_EMIT in shaders without outputs
authorJózef Kucia <joseph.kucia@gmail.com>
Sun, 23 Sep 2018 22:44:00 +0000 (00:44 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Tue, 2 Oct 2018 21:13:52 +0000 (17:13 -0400)
Fixes GPU hangs.

Cc: 18.1 18.2 <mesa-stable@lists.freedesktop.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107857
Signed-off-by: Józef Kucia <joseph.kucia@gmail.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
src/gallium/drivers/radeonsi/si_shader.c

index 36f58e2ce52ca7621e6b3781c259cbfb0ebe1474..fedc616ebf6139c3785b328f27aee29f8658009b 100644 (file)
@@ -4326,9 +4326,12 @@ static void si_llvm_emit_vertex(struct ac_shader_abi *abi,
        gs_next_vertex = LLVMBuildAdd(ctx->ac.builder, gs_next_vertex, ctx->i32_1, "");
        LLVMBuildStore(ctx->ac.builder, gs_next_vertex, ctx->gs_next_vertex[stream]);
 
-       /* Signal vertex emission */
-       ac_build_sendmsg(&ctx->ac, AC_SENDMSG_GS_OP_EMIT | AC_SENDMSG_GS | (stream << 8),
-                        si_get_gs_wave_id(ctx));
+       /* Signal vertex emission if vertex data was written. */
+       if (offset) {
+               ac_build_sendmsg(&ctx->ac, AC_SENDMSG_GS_OP_EMIT | AC_SENDMSG_GS | (stream << 8),
+                                si_get_gs_wave_id(ctx));
+       }
+
        if (!use_kill)
                lp_build_endif(&if_state);
 }