[Mesa-dev] [PATCH 2/5] tgsi/lowering: stop using TGSI_OPCODE_CLAMP

Dave Airlie airlied at gmail.com
Thu Feb 16 23:00:33 UTC 2017


On 17 February 2017 at 08:00, Marek Olšák <maraeo at gmail.com> wrote:
> From: Marek Olšák <marek.olsak at amd.com>

This doesn't look right to me, shouldn't it be

MIN tmpA.z, src.w, imm{128.0}
MAX tmpA.z tmpA.z. -imm{128.0}

?

Dave.

>
> ---
>  src/gallium/auxiliary/tgsi/tgsi_lowering.c | 17 +++++++++++++----
>  1 file changed, 13 insertions(+), 4 deletions(-)
>
> diff --git a/src/gallium/auxiliary/tgsi/tgsi_lowering.c b/src/gallium/auxiliary/tgsi/tgsi_lowering.c
> index bf6cbb3..dbe5a71 100644
> --- a/src/gallium/auxiliary/tgsi/tgsi_lowering.c
> +++ b/src/gallium/auxiliary/tgsi/tgsi_lowering.c
> @@ -565,30 +565,39 @@ transform_lit(struct tgsi_transform_context *tctx,
>        /* MAX tmpA.xy, src.xy, imm{0.0} */
>        new_inst = tgsi_default_full_instruction();
>        new_inst.Instruction.Opcode = TGSI_OPCODE_MAX;
>        new_inst.Instruction.NumDstRegs = 1;
>        reg_dst(&new_inst.Dst[0], &ctx->tmp[A].dst, TGSI_WRITEMASK_XY);
>        new_inst.Instruction.NumSrcRegs = 2;
>        reg_src(&new_inst.Src[0], src, SWIZ(X, Y, _, _));
>        reg_src(&new_inst.Src[1], &ctx->imm, SWIZ(X, X, _, _));
>        tctx->emit_instruction(tctx, &new_inst);
>
> -      /* CLAMP tmpA.z, src.w, -imm{128.0}, imm{128.0} */
> +      /* MIN tmpA.z, src.w, imm{128.0} */
>        new_inst = tgsi_default_full_instruction();
> -      new_inst.Instruction.Opcode = TGSI_OPCODE_CLAMP;
> +      new_inst.Instruction.Opcode = TGSI_OPCODE_MIN;
>        new_inst.Instruction.NumDstRegs = 1;
>        reg_dst(&new_inst.Dst[0], &ctx->tmp[A].dst, TGSI_WRITEMASK_Z);
> -      new_inst.Instruction.NumSrcRegs = 3;
> +      new_inst.Instruction.NumSrcRegs = 2;
> +      reg_src(&new_inst.Src[0], src, SWIZ(_, _, W, _));
> +      reg_src(&new_inst.Src[1], &ctx->imm, SWIZ(_, _, Z, _));
> +      tctx->emit_instruction(tctx, &new_inst);
> +
> +      /* MAX tmpA.z, src.w, -imm{128.0} */
> +      new_inst = tgsi_default_full_instruction();
> +      new_inst.Instruction.Opcode = TGSI_OPCODE_MAX;
> +      new_inst.Instruction.NumDstRegs = 1;
> +      reg_dst(&new_inst.Dst[0], &ctx->tmp[A].dst, TGSI_WRITEMASK_Z);
> +      new_inst.Instruction.NumSrcRegs = 2;
>        reg_src(&new_inst.Src[0], src, SWIZ(_, _, W, _));
>        reg_src(&new_inst.Src[1], &ctx->imm, SWIZ(_, _, Z, _));
>        new_inst.Src[1].Register.Negate = true;
> -      reg_src(&new_inst.Src[2], &ctx->imm, SWIZ(_, _, Z, _));
>        tctx->emit_instruction(tctx, &new_inst);
>
>        /* LG2 tmpA.y, tmpA.y */
>        new_inst = tgsi_default_full_instruction();
>        new_inst.Instruction.Opcode = TGSI_OPCODE_LG2;
>        new_inst.Instruction.NumDstRegs = 1;
>        reg_dst(&new_inst.Dst[0], &ctx->tmp[A].dst, TGSI_WRITEMASK_Y);
>        new_inst.Instruction.NumSrcRegs = 1;
>        reg_src(&new_inst.Src[0], &ctx->tmp[A].src, SWIZ(Y, _, _, _));
>        tctx->emit_instruction(tctx, &new_inst);
> --
> 2.7.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list