Good find.

On this sort of issues it's a good idea to search the code for similar cases:

- it looks like this is done differently above:

                case TGSI_OPCODE_ABS:
                        alu.src[0].abs = 1;
                        if (alu.src[0].neg)
                          alu.src[0].neg = 0;
                        break;

  so an inline helper to set abs correctly would be cleaner & more consistent.

- looking at src/gallium/docs/source/tgsi.rst there are other opcodes with |..| 
in their formula which is not observed, in particular 
src/gallium/drivers/r600/r600_shader.c:tgsi_log() does not set abs where the 
spec says it should.

Jose


----- Original Message -----
> Need to clear NEG bit because it applies after ABS, e.g. "RSQ ...,
> -1"
> uses -|1| as operand.
> 
> Signed-off-by: Vadim Girlin <vadimgir...@gmail.com>
> ---
>  src/gallium/drivers/r600/r600_shader.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/src/gallium/drivers/r600/r600_shader.c
> b/src/gallium/drivers/r600/r600_shader.c
> index f3cbf98..5aad3e3 100644
> --- a/src/gallium/drivers/r600/r600_shader.c
> +++ b/src/gallium/drivers/r600/r600_shader.c
> @@ -1506,6 +1506,7 @@ static int tgsi_rsq(struct r600_shader_ctx
> *ctx)
>       for (i = 0; i < inst->Instruction.NumSrcRegs; i++) {
>               r600_bc_src(&alu.src[i], &ctx->src[i], 0);
>               alu.src[i].abs = 1;
> +             alu.src[i].neg = 0;
>       }
>       alu.dst.sel = ctx->temp_reg;
>       alu.dst.write = 1;
> --
> 1.7.6
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
> 
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to