From b8da261dc7e842f3a5f5256ea424c403543d40c9 Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Kristensen Date: Wed, 17 Feb 2016 15:28:52 -0800 Subject: 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. --- src/compiler/nir/spirv/vtn_alu.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/compiler') 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: -- cgit v1.2.3