summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKristian Høgsberg Kristensen <[email protected]>2016-02-17 15:28:52 -0800
committerKristian Høgsberg Kristensen <[email protected]>2016-02-17 15:28:52 -0800
commitb8da261dc7e842f3a5f5256ea424c403543d40c9 (patch)
tree0f9f7a824a5d8185e3cf257d138736f1bd9fae3f
parentae3e249d57e10a9bfe261cdff4a6f27052bc580e (diff)
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.
-rw-r--r--src/compiler/nir/spirv/vtn_alu.c6
1 files changed, 3 insertions, 3 deletions
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: