From: Kenneth Graunke Date: Tue, 29 Dec 2015 08:10:39 +0000 (-0800) Subject: nir/spirv/glsl450: implement Reflect built-in. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0b1a436ac83edc939388f22f1a335c28dae8f69e;p=mesa.git nir/spirv/glsl450: implement Reflect built-in. --- 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: