From 0b1a436ac83edc939388f22f1a335c28dae8f69e Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Tue, 29 Dec 2015 00:10:39 -0800 Subject: [PATCH] nir/spirv/glsl450: implement Reflect built-in. --- src/glsl/nir/spirv/vtn_glsl450.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/glsl/nir/spirv/vtn_glsl450.c b/src/glsl/nir/spirv/vtn_glsl450.c index f81f16789be..38dea8caa4d 100644 --- a/src/glsl/nir/spirv/vtn_glsl450.c +++ b/src/glsl/nir/spirv/vtn_glsl450.c @@ -197,6 +197,14 @@ handle_glsl450_alu(struct vtn_builder *b, enum GLSLstd450 entrypoint, src[0], nir_fneg(nb, src[0])); return; + case GLSLstd450Reflect: + /* I - 2 * dot(N, I) * N */ + val->ssa->def = + nir_fsub(nb, src[0], nir_fmul(nb, nir_imm_float(nb, 2.0), + nir_fmul(nb, nir_fdot(nb, src[0], src[1]), + src[1]))); + return; + case GLSLstd450Asin: case GLSLstd450Acos: case GLSLstd450Atan: @@ -210,7 +218,6 @@ handle_glsl450_alu(struct vtn_builder *b, enum GLSLstd450 entrypoint, case GLSLstd450Frexp: case GLSLstd450PackDouble2x32: case GLSLstd450UnpackDouble2x32: - case GLSLstd450Reflect: case GLSLstd450Refract: case GLSLstd450IMix: default: -- 2.30.2