radeonsi/gfx9: fix vertex idx in ES with multiple waves per threadgroup
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Fri, 14 Jul 2017 11:31:49 +0000 (13:31 +0200)
committerNicolai Hähnle <nicolai.haehnle@amd.com>
Thu, 27 Jul 2017 19:16:32 +0000 (21:16 +0200)
Cc: mesa-stable@lists.freedesktop.org
Reviewed: Marek Olšák <marek.olsak@amd.com>

src/gallium/drivers/radeonsi/si_shader.c

index a5baf71b0d037720cce8d7b972418897b69d026c..a153cb778435722e50050f19c1b0a26cf73c0890 100644 (file)
@@ -2879,7 +2879,12 @@ static void si_llvm_emit_es_epilogue(struct lp_build_tgsi_context *bld_base)
 
        if (ctx->screen->b.chip_class >= GFX9 && info->num_outputs) {
                unsigned itemsize_dw = es->selector->esgs_itemsize / 4;
-               lds_base = LLVMBuildMul(gallivm->builder, ac_get_thread_id(&ctx->ac),
+               LLVMValueRef vertex_idx = ac_get_thread_id(&ctx->ac);
+               LLVMValueRef wave_idx = unpack_param(ctx, ctx->param_merged_wave_info, 24, 4);
+               vertex_idx = LLVMBuildOr(gallivm->builder, vertex_idx,
+                                        LLVMBuildMul(gallivm->builder, wave_idx,
+                                                     LLVMConstInt(ctx->i32, 64, false), ""), "");
+               lds_base = LLVMBuildMul(gallivm->builder, vertex_idx,
                                        LLVMConstInt(ctx->i32, itemsize_dw, 0), "");
        }