From: Nicolai Hähnle <nicolai.haeh...@amd.com> --- src/gallium/drivers/radeonsi/si_shader.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index 12eca9f..37346c6 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -5238,20 +5238,37 @@ static void vote_eq_emit( vote_set = si_emit_ballot(ctx, emit_data->args[0]); all = LLVMBuildICmp(gallivm->builder, LLVMIntEQ, vote_set, active_set, ""); none = LLVMBuildICmp(gallivm->builder, LLVMIntEQ, vote_set, LLVMConstInt(ctx->i64, 0, 0), ""); tmp = LLVMBuildOr(gallivm->builder, all, none, ""); emit_data->output[emit_data->chan] = LLVMBuildSExt(gallivm->builder, tmp, ctx->i32, ""); } +static void ballot_emit( + 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); + LLVMBuilderRef builder = ctx->gallivm.builder; + LLVMValueRef tmp; + + tmp = lp_build_emit_fetch(bld_base, emit_data->inst, 0, TGSI_CHAN_X); + tmp = si_emit_ballot(ctx, tmp); + tmp = LLVMBuildBitCast(builder, tmp, ctx->v2i32, ""); + + emit_data->output[0] = LLVMBuildExtractElement(builder, tmp, ctx->i32_0, ""); + emit_data->output[1] = LLVMBuildExtractElement(builder, tmp, ctx->i32_1, ""); +} + static unsigned si_llvm_get_stream(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 tgsi_src_register src0 = emit_data->inst->Src[0].Register; LLVMValueRef imm; unsigned stream; assert(src0.File == TGSI_FILE_IMMEDIATE); @@ -6690,20 +6707,21 @@ static void si_init_shader_ctx(struct si_shader_context *ctx, bld_base->op_actions[TGSI_OPCODE_CLOCK].emit = clock_emit; bld_base->op_actions[TGSI_OPCODE_DDX].emit = si_llvm_emit_ddxy; bld_base->op_actions[TGSI_OPCODE_DDY].emit = si_llvm_emit_ddxy; bld_base->op_actions[TGSI_OPCODE_DDX_FINE].emit = si_llvm_emit_ddxy; bld_base->op_actions[TGSI_OPCODE_DDY_FINE].emit = si_llvm_emit_ddxy; bld_base->op_actions[TGSI_OPCODE_VOTE_ALL].emit = vote_all_emit; bld_base->op_actions[TGSI_OPCODE_VOTE_ANY].emit = vote_any_emit; bld_base->op_actions[TGSI_OPCODE_VOTE_EQ].emit = vote_eq_emit; + bld_base->op_actions[TGSI_OPCODE_BALLOT].emit = ballot_emit; bld_base->op_actions[TGSI_OPCODE_EMIT].emit = si_llvm_emit_vertex; bld_base->op_actions[TGSI_OPCODE_ENDPRIM].emit = si_llvm_emit_primitive; bld_base->op_actions[TGSI_OPCODE_BARRIER].emit = si_llvm_emit_barrier; } #define EXP_TARGET (HAVE_LLVM >= 0x0500 ? 0 : 3) #define EXP_OUT0 (HAVE_LLVM >= 0x0500 ? 2 : 5) /* Return true if the PARAM export has been eliminated. */ -- 2.9.3 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev