From: Marek Olšák <marek.ol...@amd.com>

---
 src/gallium/drivers/radeonsi/si_shader.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_shader.c 
b/src/gallium/drivers/radeonsi/si_shader.c
index 5e1f59c..0d94bdd 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -2831,26 +2831,34 @@ static void si_llvm_emit_es_epilogue(struct 
lp_build_tgsi_context *bld_base)
 
                        ac_build_buffer_store_dword(&ctx->ac,
                                                    ctx->esgs_ring,
                                                    out_val, 1, NULL, soffset,
                                                    (4 * param_index + chan) * 
4,
                                                    1, 1, true, true);
                }
        }
 }
 
+static LLVMValueRef si_get_gs_wave_id(struct si_shader_context *ctx)
+{
+       if (ctx->screen->b.chip_class >= GFX9)
+               return unpack_param(ctx, ctx->param_merged_wave_info, 16, 8);
+       else
+               return LLVMGetParam(ctx->main_fn, ctx->param_gs_wave_id);
+}
+
 static void si_llvm_emit_gs_epilogue(struct lp_build_tgsi_context *bld_base)
 {
        struct si_shader_context *ctx = si_shader_context(bld_base);
 
        ac_build_sendmsg(&ctx->ac, AC_SENDMSG_GS_OP_NOP | AC_SENDMSG_GS_DONE,
-                        LLVMGetParam(ctx->main_fn, ctx->param_gs_wave_id));
+                        si_get_gs_wave_id(ctx));
 }
 
 static void si_llvm_emit_vs_epilogue(struct lp_build_tgsi_context *bld_base)
 {
        struct si_shader_context *ctx = si_shader_context(bld_base);
        struct gallivm_state *gallivm = &ctx->gallivm;
        struct tgsi_shader_info *info = &ctx->shader->selector->info;
        struct si_shader_output_values *outputs = NULL;
        int i,j;
 
@@ -5530,38 +5538,38 @@ static void si_llvm_emit_vertex(
                }
        }
 
        gs_next_vertex = lp_build_add(uint, gs_next_vertex,
                                      ctx->i32_1);
 
        LLVMBuildStore(gallivm->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),
-                        LLVMGetParam(ctx->main_fn, ctx->param_gs_wave_id));
+                        si_get_gs_wave_id(ctx));
        if (!use_kill)
                lp_build_endif(&if_state);
 }
 
 /* Cut one primitive from the geometry shader */
 static void si_llvm_emit_primitive(
        const struct lp_build_tgsi_action *action,
        struct lp_build_tgsi_context *bld_base,
        struct lp_build_emit_data *emit_data)
 {
        struct si_shader_context *ctx = si_shader_context(bld_base);
        unsigned stream;
 
        /* Signal primitive cut */
        stream = si_llvm_get_stream(bld_base, emit_data);
        ac_build_sendmsg(&ctx->ac, AC_SENDMSG_GS_OP_CUT | AC_SENDMSG_GS | 
(stream << 8),
-                        LLVMGetParam(ctx->main_fn, ctx->param_gs_wave_id));
+                        si_get_gs_wave_id(ctx));
 }
 
 static void si_llvm_emit_barrier(const struct lp_build_tgsi_action *action,
                                 struct lp_build_tgsi_context *bld_base,
                                 struct lp_build_emit_data *emit_data)
 {
        struct si_shader_context *ctx = si_shader_context(bld_base);
        struct gallivm_state *gallivm = &ctx->gallivm;
 
        /* SI only (thanks to a hw bug workaround):
-- 
2.7.4

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to