[Mesa-dev] [PATCH v2 07/29] spirv/glsl450: fix reflect(denorm, denorm) FTZ = 0.0 case
Samuel Iglesias Gonsálvez
siglesias at igalia.com
Tue Dec 18 10:34:02 UTC 2018
Signed-off-by: Samuel Iglesias Gonsálvez <siglesias at igalia.com>
---
src/compiler/spirv/vtn_glsl450.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/src/compiler/spirv/vtn_glsl450.c b/src/compiler/spirv/vtn_glsl450.c
index 82cc7dc909c..c40594290a3 100644
--- a/src/compiler/spirv/vtn_glsl450.c
+++ b/src/compiler/spirv/vtn_glsl450.c
@@ -671,13 +671,18 @@ handle_glsl450_alu(struct vtn_builder *b, enum GLSLstd450 entrypoint,
src[0], nir_fneg(nb, src[0]));
return;
- case GLSLstd450Reflect:
+ case GLSLstd450Reflect: {
/* I - 2 * dot(N, I) * N */
- val->ssa->def =
+ nir_ssa_def *reflect =
nir_fsub(nb, src[0], nir_fmul(nb, NIR_IMM_FP(nb, 2.0),
- nir_fmul(nb, nir_fdot(nb, src[0], src[1]),
- src[1])));
+ nir_fmul(nb, nir_fdot(nb, src[0], src[1]),
+ src[1])));
+ nir_ssa_def *zero = NIR_IMM_FP(nb, 0.0);
+ val->ssa->def = nir_bcsel(nb, nir_iand(nb,
+ nir_feq(nb, src[0], zero),
+ nir_feq(nb, src[1], zero)), zero, reflect);
return;
+ }
case GLSLstd450Refract: {
nir_ssa_def *I = src[0];
--
2.19.1
More information about the mesa-dev
mailing list