From: Kristian Høgsberg Kristensen Date: Wed, 17 Feb 2016 23:28:52 +0000 (-0800) Subject: spirv: Fix SpvOpFwidth, SpvOpFwidthFine and SpvOpFwidthCoarse X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b8da261dc7e842f3a5f5256ea424c403543d40c9;p=mesa.git spirv: Fix SpvOpFwidth, SpvOpFwidthFine and SpvOpFwidthCoarse "Result is the same as computing the sum of the absolute values of OpDPdx and OpDPdy on P." We were doing sum of absolute values of OpDPdx of P and OpDPdx of NULL. --- diff --git a/src/compiler/nir/spirv/vtn_alu.c b/src/compiler/nir/spirv/vtn_alu.c index d866da7445e..450bc158be9 100644 --- a/src/compiler/nir/spirv/vtn_alu.c +++ b/src/compiler/nir/spirv/vtn_alu.c @@ -404,17 +404,17 @@ vtn_handle_alu(struct vtn_builder *b, SpvOp opcode, case SpvOpFwidth: val->ssa->def = nir_fadd(&b->nb, nir_fabs(&b->nb, nir_fddx(&b->nb, src[0])), - nir_fabs(&b->nb, nir_fddx(&b->nb, src[1]))); + nir_fabs(&b->nb, nir_fddy(&b->nb, src[0]))); return; case SpvOpFwidthFine: val->ssa->def = nir_fadd(&b->nb, nir_fabs(&b->nb, nir_fddx_fine(&b->nb, src[0])), - nir_fabs(&b->nb, nir_fddx_fine(&b->nb, src[1]))); + nir_fabs(&b->nb, nir_fddy_fine(&b->nb, src[0]))); return; case SpvOpFwidthCoarse: val->ssa->def = nir_fadd(&b->nb, nir_fabs(&b->nb, nir_fddx_coarse(&b->nb, src[0])), - nir_fabs(&b->nb, nir_fddx_coarse(&b->nb, src[1]))); + nir_fabs(&b->nb, nir_fddy_coarse(&b->nb, src[0]))); return; case SpvOpVectorTimesScalar: