public static bool IsSwizzleValid(ShaderType type, char swizzle)
        {
            var sidx = (swizzle == 'x' || swizzle == 'r' || swizzle == 's') ? 1 :
                       (swizzle == 'y' || swizzle == 'g' || swizzle == 't') ? 2 :
                       (swizzle == 'z' || swizzle == 'b' || swizzle == 'p') ? 3 :
                       (swizzle == 'w' || swizzle == 'a' || swizzle == 'q') ? 4 :
                       0;

            if (sidx == 0)
            {
                return(false);
            }
            return(type.IsVectorType() && (sidx <= type.GetComponentCount()));
        }
 // stype = the type of swizzle   -   0 = position, 1 = color, 2 = texcoord
 public static string GetSwizzle(ShaderType type, int stype)
 {
     if (type.IsScalarType() || type.IsVectorType())
     {
         var cc = type.GetComponentCount();
         if (cc == 1)
         {
             return((stype == 0) ? "x" : (stype == 1) ? "r" : "s");
         }
         if (cc == 2)
         {
             return((stype == 0) ? "xy" : (stype == 1) ? "rg" : "st");
         }
         if (cc == 3)
         {
             return((stype == 0) ? "xyz" : (stype == 1) ? "rgb" : "stp");
         }
         if (cc == 4)
         {
             return((stype == 0) ? "xyzw" : (stype == 1) ? "rgba" : "stpq");
         }
     }
     return(null);
 }