nir/spirv: Implement ModfStruct opcode.
authorKenneth Graunke <kenneth@whitecape.org>
Thu, 21 Jan 2016 22:56:34 +0000 (14:56 -0800)
committerKenneth Graunke <kenneth@whitecape.org>
Thu, 21 Jan 2016 22:57:47 +0000 (14:57 -0800)
src/glsl/nir/spirv/vtn_glsl450.c

index afcf8e2a7daa1515d196554b92afeb62f742e066..a675aa4c7f3194918cd51808df468842756df325 100644 (file)
@@ -424,6 +424,13 @@ handle_glsl450_alu(struct vtn_builder *b, enum GLSLstd450 entrypoint,
       return;
    }
 
+   case GLSLstd450ModfStruct: {
+      assert(glsl_type_is_struct(val->ssa->type));
+      val->ssa->elems[0]->def = nir_ffract(nb, src[0]);
+      val->ssa->elems[1]->def = nir_ffloor(nb, src[0]);
+      return;
+   }
+
    case GLSLstd450FMin:        op = nir_op_fmin;       break;
    case GLSLstd450UMin:        op = nir_op_umin;       break;
    case GLSLstd450SMin:        op = nir_op_imin;       break;
@@ -618,7 +625,6 @@ handle_glsl450_alu(struct vtn_builder *b, enum GLSLstd450 entrypoint,
       return;
    }
 
-   case GLSLstd450ModfStruct:
    case GLSLstd450PackDouble2x32:
    case GLSLstd450UnpackDouble2x32:
    case GLSLstd450IMix: