summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorIlia Mirkin <[email protected]>2017-07-11 21:44:12 -0400
committerIlia Mirkin <[email protected]>2017-07-12 19:30:46 -0400
commit87028f863967ec88ef8b7c5722f6cbf7ac6c8db6 (patch)
treeee1e90a45b36b0343983bb11b3d6fe6cc283cd2a /src
parent0e1886efb9e151c8ffd5cb89f54c966a54a4fe74 (diff)
freedreno/ir3: fix load_front_face conversion
The comments are correct - we get -1 and 0. However by adding 1, we convert this into 0,1. This mostly works for conditionals, but when negated, this will yield the wrong result. Instead just negate the values (as they are backwards -- -1 means back instead of front). Fixes tests/shaders/glsl-fs-frontfacing-not.shader_test and dEQP-GLES3.functional.shaders.builtin_variable.frontfacing on A530. The latter also tested on A306 by Rob Clark. Signed-off-by: Ilia Mirkin <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c b/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c
index ba1c64ee37c..764aeb49f1a 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c
+++ b/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c
@@ -1546,14 +1546,11 @@ emit_intrinsic(struct ir3_compile *ctx, nir_intrinsic_instr *intr)
ctx->frag_face = create_input(b, 0);
ctx->frag_face->regs[0]->flags |= IR3_REG_HALF;
}
- /* for fragface, we always get -1 or 0, but that is inverse
- * of what nir expects (where ~0 is true). Unfortunately
- * trying to widen from half to full in add.s seems to do a
- * non-sign-extending widen (resulting in something that
- * gets interpreted as float Inf??)
+ /* for fragface, we get -1 for back and 0 for front. However this is
+ * the inverse of what nir expects (where ~0 is true).
*/
dst[0] = ir3_COV(b, ctx->frag_face, TYPE_S16, TYPE_S32);
- dst[0] = ir3_ADD_S(b, dst[0], 0, create_immed(b, 1), 0);
+ dst[0] = ir3_NOT_B(b, dst[0], 0);
break;
case nir_intrinsic_load_local_invocation_id:
if (!ctx->local_invocation_id) {