Example #1
0
 private static Class[] getValidBufferTypes(Class type) {
   if (type.equals(IntBuffer.class)) return new Class[] {cl_int.class, cl_uint.class};
   else if (type.equals(FloatBuffer.class)) return new Class[] {cl_float.class};
   else if (type.equals(ByteBuffer.class))
     return new Class[] {cl_byte.class, cl_char.class, cl_uchar.class, cl_void.class};
   else if (type.equals(ShortBuffer.class)) return new Class[] {cl_short.class};
   else if (type.equals(DoubleBuffer.class)) return new Class[] {cl_double.class};
   else if (type.equals(LongBuffer.class)) return new Class[] {cl_long.class};
   else if (type.equals(PointerBuffer.class)) return new Class[] {size_t.class};
   else return new Class[] {};
 }
Example #2
0
 @Override
 public Class[] getValidAnnotationTypes(Class type) {
   Class[] valid_types;
   if (Buffer.class.isAssignableFrom(type) || PointerBuffer.class.isAssignableFrom(type))
     valid_types = getValidBufferTypes(type);
   else if (type.isPrimitive()) valid_types = getValidPrimitiveTypes(type);
   else if (String.class.equals(type)) valid_types = new Class[] {cl_byte.class};
   else if (org.lwjgl.PointerWrapper.class.isAssignableFrom(type))
     valid_types = new Class[] {PointerWrapper.class};
   else if (ByteBuffer[].class == type) valid_types = new Class[] {cl_char.class, cl_uchar.class};
   else if (void.class.equals(type)) valid_types = new Class[] {GLreturn.class};
   else valid_types = new Class[] {};
   return valid_types;
 }
Example #3
0
 @Override
 public String translateAnnotation(Class annotation_type) {
   if (annotation_type.equals(cl_uint.class) || annotation_type.equals(cl_int.class)) return "i";
   else if (annotation_type.equals(cl_short.class)) return "s";
   else if (annotation_type.equals(cl_byte.class)) return "b";
   else if (annotation_type.equals(cl_float.class)) return "f";
   else if (annotation_type.equals(cl_double.class)) return "d";
   else throw new RuntimeException(annotation_type + " is not allowed");
 }
Example #4
0
 private static Class[] getValidPrimitiveTypes(Class type) {
   if (type.equals(long.class))
     return new Class[] {cl_long.class, size_t.class, cl_bitfield.class};
   else if (type.equals(int.class))
     return new Class[] {cl_int.class, cl_uint.class, cl_bool.class};
   else if (type.equals(double.class)) return new Class[] {cl_double.class};
   else if (type.equals(float.class)) return new Class[] {cl_float.class};
   else if (type.equals(short.class)) return new Class[] {cl_short.class};
   else if (type.equals(byte.class))
     return new Class[] {cl_byte.class, cl_char.class, cl_uchar.class};
   else if (type.equals(boolean.class)) return new Class[] {cl_bool.class};
   else if (type.equals(void.class)) return new Class[] {cl_void.class};
   else return new Class[] {};
 }