From 659a3623b0fa4217fc4e69cccdb3e7a268bca388 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Mon, 28 Dec 2015 23:59:32 -0800 Subject: [PATCH] nir/spirv/glsl450: Implement FaceForward built-in. --- src/glsl/nir/spirv/vtn_glsl450.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/glsl/nir/spirv/vtn_glsl450.c b/src/glsl/nir/spirv/vtn_glsl450.c index 1b7751a6a88..f81f16789be 100644 --- a/src/glsl/nir/spirv/vtn_glsl450.c +++ b/src/glsl/nir/spirv/vtn_glsl450.c @@ -190,6 +190,13 @@ handle_glsl450_alu(struct vtn_builder *b, enum GLSLstd450 entrypoint, return; } + case GLSLstd450FaceForward: + val->ssa->def = + nir_bcsel(nb, nir_flt(nb, nir_fdot(nb, src[2], src[1]), + nir_imm_float(nb, 0.0)), + src[0], nir_fneg(nb, src[0])); + return; + case GLSLstd450Asin: case GLSLstd450Acos: case GLSLstd450Atan: @@ -203,7 +210,6 @@ handle_glsl450_alu(struct vtn_builder *b, enum GLSLstd450 entrypoint, case GLSLstd450Frexp: case GLSLstd450PackDouble2x32: case GLSLstd450UnpackDouble2x32: - case GLSLstd450FaceForward: case GLSLstd450Reflect: case GLSLstd450Refract: case GLSLstd450IMix: -- 2.30.2