nir/spirv/glsl450: Implement Clamp/SClamp/UClamp.
authorKenneth Graunke <kenneth@whitecape.org>
Tue, 29 Dec 2015 04:40:10 +0000 (20:40 -0800)
committerKenneth Graunke <kenneth@whitecape.org>
Tue, 29 Dec 2015 23:27:03 +0000 (15:27 -0800)
src/glsl/nir/spirv/vtn_glsl450.c

index ecd24c4a3d95b03e2bea40c4cba31acf7e0db6d0..2d5faa7d574dc549f7fc50a399830ac94e4caaad 100644 (file)
@@ -156,8 +156,15 @@ handle_glsl450_alu(struct vtn_builder *b, enum GLSLstd450 entrypoint,
       return;
 
    case GLSLstd450FClamp:
+      val->ssa->def = build_fclamp(nb, src[0], src[1], src[2]);
+      return;
    case GLSLstd450UClamp:
+      val->ssa->def = nir_umin(nb, nir_umax(nb, src[0], src[1]), src[2]);
+      return;
    case GLSLstd450SClamp:
+      val->ssa->def = nir_imin(nb, nir_imax(nb, src[0], src[1]), src[2]);
+      return;
+
    case GLSLstd450Asin:
    case GLSLstd450Acos:
    case GLSLstd450Atan: