From: Nicolai Hähnle <nicolai.haeh...@amd.com> Replace by a simple LLVMGetParam, since ctx->no_prolog is always false. --- src/gallium/drivers/radeonsi/si_shader.c | 54 ++------------------------------ 1 file changed, 2 insertions(+), 52 deletions(-)
diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index 8bd8c80..f3b94d7 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -1293,70 +1293,20 @@ static void interp_fs_input(struct si_shader_context *ctx, args[1] = attr_number; args[2] = prim_mask; args[3] = interp_param; result[chan] = lp_build_intrinsic(gallivm->builder, intr_name, ctx->f32, args, args[3] ? 4 : 3, LLVMReadNoneAttribute); } } } -/* LLVMGetParam with bc_optimize resolved. */ -static LLVMValueRef get_interp_param(struct si_shader_context *ctx, - int interp_param_idx) -{ - LLVMBuilderRef builder = ctx->gallivm.builder; - LLVMValueRef main_fn = ctx->main_fn; - LLVMValueRef param = NULL; - - /* Handle PRIM_MASK[31] (bc_optimize). */ - if (ctx->no_prolog && - ((ctx->shader->key.ps.prolog.bc_optimize_for_persp && - interp_param_idx == SI_PARAM_PERSP_CENTROID) || - (ctx->shader->key.ps.prolog.bc_optimize_for_linear && - interp_param_idx == SI_PARAM_LINEAR_CENTROID))) { - /* The shader should do: if (PRIM_MASK[31]) CENTROID = CENTER; - * The hw doesn't compute CENTROID if the whole wave only - * contains fully-covered quads. - */ - LLVMValueRef bc_optimize = - LLVMGetParam(main_fn, SI_PARAM_PRIM_MASK); - bc_optimize = LLVMBuildLShr(builder, - bc_optimize, - LLVMConstInt(ctx->i32, 31, 0), ""); - bc_optimize = LLVMBuildTrunc(builder, bc_optimize, ctx->i1, ""); - - if (ctx->shader->key.ps.prolog.bc_optimize_for_persp && - interp_param_idx == SI_PARAM_PERSP_CENTROID) { - param = LLVMBuildSelect(builder, bc_optimize, - LLVMGetParam(main_fn, - SI_PARAM_PERSP_CENTER), - LLVMGetParam(main_fn, - SI_PARAM_PERSP_CENTROID), - ""); - } - if (ctx->shader->key.ps.prolog.bc_optimize_for_linear && - interp_param_idx == SI_PARAM_LINEAR_CENTROID) { - param = LLVMBuildSelect(builder, bc_optimize, - LLVMGetParam(main_fn, - SI_PARAM_LINEAR_CENTER), - LLVMGetParam(main_fn, - SI_PARAM_LINEAR_CENTROID), - ""); - } - } - - if (!param) - param = LLVMGetParam(main_fn, interp_param_idx); - return param; -} - static void declare_input_fs( struct si_shader_context *radeon_bld, unsigned input_index, const struct tgsi_full_declaration *decl, LLVMValueRef out[4]) { struct lp_build_context *base = &radeon_bld->soa.bld_base.base; struct si_shader_context *ctx = si_shader_context(&radeon_bld->soa.bld_base); struct si_shader *shader = ctx->shader; @@ -1378,21 +1328,21 @@ static void declare_input_fs( out[2] = mask & 0x4 ? LLVMGetParam(main_fn, offset++) : base->undef; out[3] = mask & 0x8 ? LLVMGetParam(main_fn, offset++) : base->undef; return; } interp_param_idx = lookup_interp_param_index(decl->Interp.Interpolate, decl->Interp.Location); if (interp_param_idx == -1) return; else if (interp_param_idx) { - interp_param = get_interp_param(ctx, interp_param_idx); + interp_param = LLVMGetParam(ctx->main_fn, interp_param_idx); } if (decl->Semantic.Name == TGSI_SEMANTIC_COLOR && decl->Interp.Interpolate == TGSI_INTERPOLATE_COLOR && ctx->shader->key.ps.prolog.flatshade_colors) interp_param = NULL; /* load the constant color */ interp_fs_input(ctx, input_index, decl->Semantic.Name, decl->Semantic.Index, shader->selector->info.num_inputs, shader->selector->info.colors_read, interp_param, @@ -5124,21 +5074,21 @@ static void build_interp_intrinsic(const struct lp_build_tgsi_action *action, if (inst->Instruction.Opcode == TGSI_OPCODE_INTERP_OFFSET || inst->Instruction.Opcode == TGSI_OPCODE_INTERP_SAMPLE) location = TGSI_INTERPOLATE_LOC_CENTER; else location = TGSI_INTERPOLATE_LOC_CENTROID; interp_param_idx = lookup_interp_param_index(interp, location); if (interp_param_idx == -1) return; else if (interp_param_idx) - interp_param = get_interp_param(ctx, interp_param_idx); + interp_param = LLVMGetParam(ctx->main_fn, interp_param_idx); else interp_param = NULL; attr_number = lp_build_const_int32(gallivm, input_index); if (inst->Instruction.Opcode == TGSI_OPCODE_INTERP_OFFSET || inst->Instruction.Opcode == TGSI_OPCODE_INTERP_SAMPLE) { LLVMValueRef ij_out[2]; LLVMValueRef ddxy_out = si_llvm_emit_ddxy_interp(bld_base, interp_param); -- 2.7.4 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev