fixed formatting 2

define_list_fix
Sebastian Weiß 9 years ago
parent dccec876c5
commit ed68a7b749
  1. 26
      jme3-lwjgl3/src/main/java/com/jme3/opencl/lwjgl/info/CLUtil.java
  2. 591
      jme3-lwjgl3/src/main/java/com/jme3/opencl/lwjgl/info/Info.java
  3. 61
      jme3-lwjgl3/src/main/java/com/jme3/opencl/lwjgl/info/InfoQuery.java
  4. 61
      jme3-lwjgl3/src/main/java/com/jme3/opencl/lwjgl/info/InfoQueryInt.java
  5. 61
      jme3-lwjgl3/src/main/java/com/jme3/opencl/lwjgl/info/InfoQueryObject.java

@ -25,7 +25,9 @@ import static org.lwjgl.system.APIUtil.*;
public final class CLUtil {
/** Maps OpenCL error token values to their String representations. */
/**
* Maps OpenCL error token values to their String representations.
*/
private static final Map<Integer, String> CL_ERROR_TOKENS = apiClassTokens(
new BiPredicate<Field, Integer>() {
private final List<String> EXCLUDE = Arrays.asList("CL_DEVICE_TYPE_ALL", "CL_BUILD_NONE", "CL_BUILD_ERROR", "CL_BUILD_IN_PROGRESS");
@ -50,11 +52,13 @@ public final class CLUtil {
/*, EXTDeviceFission.class*/
);
private CLUtil() {}
private CLUtil() {
}
/**
* Checks the {@code errcode} present in the current position of the specified {@code errcode_ret} buffer and throws an {@link OpenCLException} if it's not
* equal to {@link CL10#CL_SUCCESS}.
* Checks the {@code errcode} present in the current position of the
* specified {@code errcode_ret} buffer and throws an
* {@link OpenCLException} if it's not equal to {@link CL10#CL_SUCCESS}.
*
* @param errcode_ret the {@code errcode} buffer
*
@ -65,8 +69,9 @@ public final class CLUtil {
}
/**
* Checks the {@code errcode} present in the current position of the specified {@code errcode_ret} buffer and throws an {@link OpenCLException} if it's not
* equal to {@link CL10#CL_SUCCESS}.
* Checks the {@code errcode} present in the current position of the
* specified {@code errcode_ret} buffer and throws an
* {@link OpenCLException} if it's not equal to {@link CL10#CL_SUCCESS}.
*
* @param errcode_ret the {@code errcode} buffer
*
@ -77,16 +82,18 @@ public final class CLUtil {
}
/**
* Checks the specified {@code errcode} and throws an {@link OpenCLException} if it's not equal to {@link CL10#CL_SUCCESS}.
* Checks the specified {@code errcode} and throws an
* {@link OpenCLException} if it's not equal to {@link CL10#CL_SUCCESS}.
*
* @param errcode the {@code errcode} to check
*
* @throws OpenCLException
*/
public static void checkCLError(int errcode) {
if ( errcode != CL_SUCCESS )
if (errcode != CL_SUCCESS) {
throw new OpenCLException(getErrcodeName(errcode));
}
}
/**
* Returns the token name of the specified {@code errcode}.
@ -97,8 +104,9 @@ public final class CLUtil {
*/
public static String getErrcodeName(int errcode) {
String errname = CL_ERROR_TOKENS.get(errcode);
if ( errname == null )
if (errname == null) {
errname = apiUnknownToken(errcode);
}
return errname;
}

@ -13,9 +13,11 @@ import static org.lwjgl.opencl.CL20.*;
import static org.lwjgl.opencl.CL10GL.*;
/**
* This class provides methods that can be used to query information about OpenCL objects. These methods are similar to the corresponding
* {@code clGet&lt;Type&gt;Info} function for each object type, except that only a single value is returned. Which one of these methods should be used
* depends on the type of the information being queried.
* This class provides methods that can be used to query information about
* OpenCL objects. These methods are similar to the corresponding
* {@code clGet&lt;Type&gt;Info} function for each object type, except that only
* a single value is returned. Which one of these methods should be used depends
* on the type of the information being queried.
*/
public final class Info {
@ -25,7 +27,6 @@ public final class Info {
// ------------------------------------
// Platform (CL10.clGetPlatformInfo)
// ------------------------------------
private static final InfoQuery PLATFORM = new InfoQuery() {
@Override
protected int get(long pointer, int param_name, long param_value_size, long param_value, long param_value_size_ret) {
@ -33,22 +34,38 @@ public final class Info {
}
};
/** String version of: {@link CL10#clGetPlatformInfo GetPlatformInfo} */
public static String clGetPlatformInfoStringASCII(long platform, int param_name) { return PLATFORM.getStringASCII(platform, param_name); }
/**
* String version of: {@link CL10#clGetPlatformInfo GetPlatformInfo}
*/
public static String clGetPlatformInfoStringASCII(long platform, int param_name) {
return PLATFORM.getStringASCII(platform, param_name);
}
/** String with explicit length version of: {@link CL10#clGetPlatformInfo GetPlatformInfo}*/
public static String clGetPlatformInfoStringASCII(long platform, int param_name, int param_value_size) { return PLATFORM.getStringASCII(platform, param_name, param_value_size); }
/**
* String with explicit length version of: {@link CL10#clGetPlatformInfo GetPlatformInfo}
*/
public static String clGetPlatformInfoStringASCII(long platform, int param_name, int param_value_size) {
return PLATFORM.getStringASCII(platform, param_name, param_value_size);
}
/** UTF-8 string version of: {@link CL10#clGetPlatformInfo GetPlatformInfo} */
public static String clGetPlatformInfoStringUTF8(long platform, int param_name) { return PLATFORM.getStringUTF8(platform, param_name); }
/**
* UTF-8 string version of: {@link CL10#clGetPlatformInfo GetPlatformInfo}
*/
public static String clGetPlatformInfoStringUTF8(long platform, int param_name) {
return PLATFORM.getStringUTF8(platform, param_name);
}
/** UTF-8 string with explicit length version of: {@link CL10#clGetPlatformInfo GetPlatformInfo} */
public static String clGetPlatformInfoStringUTF8(long platform, int param_name, int param_value_size) { return PLATFORM.getStringUTF8(platform, param_name, param_value_size); }
/**
* UTF-8 string with explicit length version of:
* {@link CL10#clGetPlatformInfo GetPlatformInfo}
*/
public static String clGetPlatformInfoStringUTF8(long platform, int param_name, int param_value_size) {
return PLATFORM.getStringUTF8(platform, param_name, param_value_size);
}
// ------------------------------------
// Device (CL10.clGetDeviceInfo)
// ------------------------------------
private static final InfoQuery DEVICE = new InfoQuery() {
@Override
protected int get(long pointer, int param_name, long param_value_size, long param_value, long param_value_size_ret) {
@ -56,37 +73,75 @@ public final class Info {
}
};
/** Single boolean value version of: {@link CL10#clGetDeviceInfo GetDeviceInfo} */
public static boolean clGetDeviceInfoBoolean(long device, int param_name) { return DEVICE.getBoolean(device, param_name); }
/**
* Single boolean value version of:
* {@link CL10#clGetDeviceInfo GetDeviceInfo}
*/
public static boolean clGetDeviceInfoBoolean(long device, int param_name) {
return DEVICE.getBoolean(device, param_name);
}
/** Single int value version of: {@link CL10#clGetDeviceInfo GetDeviceInfo} */
public static int clGetDeviceInfoInt(long device, int param_name) { return DEVICE.getInt(device, param_name); }
/**
* Single int value version of: {@link CL10#clGetDeviceInfo GetDeviceInfo}
*/
public static int clGetDeviceInfoInt(long device, int param_name) {
return DEVICE.getInt(device, param_name);
}
/** Single long value version of: {@link CL10#clGetDeviceInfo GetDeviceInfo} */
public static long clGetDeviceInfoLong(long device, int param_name) { return DEVICE.getLong(device, param_name); }
/**
* Single long value version of: {@link CL10#clGetDeviceInfo GetDeviceInfo}
*/
public static long clGetDeviceInfoLong(long device, int param_name) {
return DEVICE.getLong(device, param_name);
}
/** Single pointer value version of: {@link CL10#clGetDeviceInfo GetDeviceInfo} */
public static long clGetDeviceInfoPointer(long device, int param_name) { return DEVICE.getPointer(device, param_name); }
/**
* Single pointer value version of:
* {@link CL10#clGetDeviceInfo GetDeviceInfo}
*/
public static long clGetDeviceInfoPointer(long device, int param_name) {
return DEVICE.getPointer(device, param_name);
}
/** PointBuffer version of: {@link CL10#clGetDeviceInfo GetDeviceInfo} */
public static int clGetDeviceInfoPointers(long device, int param_name, PointerBuffer target) { return DEVICE.getPointers(device, param_name, target); }
/**
* PointBuffer version of: {@link CL10#clGetDeviceInfo GetDeviceInfo}
*/
public static int clGetDeviceInfoPointers(long device, int param_name, PointerBuffer target) {
return DEVICE.getPointers(device, param_name, target);
}
/** String version of: {@link CL10#clGetDeviceInfo GetDeviceInfo} */
public static String clGetDeviceInfoStringASCII(long device, int param_name) { return DEVICE.getStringASCII(device, param_name); }
/**
* String version of: {@link CL10#clGetDeviceInfo GetDeviceInfo}
*/
public static String clGetDeviceInfoStringASCII(long device, int param_name) {
return DEVICE.getStringASCII(device, param_name);
}
/** String with explicit length version of: {@link CL10#clGetDeviceInfo GetDeviceInfo}*/
public static String clGetDeviceInfoStringASCII(long device, int param_name, int param_value_size) { return DEVICE.getStringASCII(device, param_name, param_value_size); }
/**
* String with explicit length version of: {@link CL10#clGetDeviceInfo GetDeviceInfo}
*/
public static String clGetDeviceInfoStringASCII(long device, int param_name, int param_value_size) {
return DEVICE.getStringASCII(device, param_name, param_value_size);
}
/** UTF-8 string version of: {@link CL10#clGetDeviceInfo GetDeviceInfo} */
public static String clGetDeviceInfoStringUTF8(long device, int param_name) { return DEVICE.getStringUTF8(device, param_name); }
/**
* UTF-8 string version of: {@link CL10#clGetDeviceInfo GetDeviceInfo}
*/
public static String clGetDeviceInfoStringUTF8(long device, int param_name) {
return DEVICE.getStringUTF8(device, param_name);
}
/** UTF-8 string with explicit length version of: {@link CL10#clGetDeviceInfo GetDeviceInfo} */
public static String clGetDeviceInfoStringUTF8(long device, int param_name, int param_value_size) { return DEVICE.getStringUTF8(device, param_name, param_value_size); }
/**
* UTF-8 string with explicit length version of:
* {@link CL10#clGetDeviceInfo GetDeviceInfo}
*/
public static String clGetDeviceInfoStringUTF8(long device, int param_name, int param_value_size) {
return DEVICE.getStringUTF8(device, param_name, param_value_size);
}
// ------------------------------------
// Context (CL10.clGetContextInfo)
// ------------------------------------
private static final InfoQuery CONTEXT = new InfoQuery() {
@Override
protected int get(long pointer, int param_name, long param_value_size, long param_value, long param_value_size_ret) {
@ -94,19 +149,31 @@ public final class Info {
}
};
/** Single int value version of: {@link CL10#clGetContextInfo GetContextInfo} */
public static int clGetContextInfoInt(long context, int param_name) { return CONTEXT.getInt(context, param_name); }
/**
* Single int value version of: {@link CL10#clGetContextInfo GetContextInfo}
*/
public static int clGetContextInfoInt(long context, int param_name) {
return CONTEXT.getInt(context, param_name);
}
/** Single pointer value version of: {@link CL10#clGetContextInfo GetContextInfo} */
public static long clGetContextInfoPointer(long context, int param_name) { return CONTEXT.getPointer(context, param_name); }
/**
* Single pointer value version of:
* {@link CL10#clGetContextInfo GetContextInfo}
*/
public static long clGetContextInfoPointer(long context, int param_name) {
return CONTEXT.getPointer(context, param_name);
}
/** PointBuffer version of: {@link CL10#clGetContextInfo GetContextInfo} */
public static int clGetContextInfoPointers(long context, int param_name, PointerBuffer target) { return CONTEXT.getPointers(context, param_name, target); }
/**
* PointBuffer version of: {@link CL10#clGetContextInfo GetContextInfo}
*/
public static int clGetContextInfoPointers(long context, int param_name, PointerBuffer target) {
return CONTEXT.getPointers(context, param_name, target);
}
// ------------------------------------
// Command Queue (CL10.clGetCommandQueueInfo)
// ------------------------------------
private static final InfoQuery COMMAND_QUEUE = new InfoQuery() {
@Override
protected int get(long pointer, int param_name, long param_value_size, long param_value, long param_value_size_ret) {
@ -114,19 +181,33 @@ public final class Info {
}
};
/** Single int value version of: {@link CL10#clGetCommandQueueInfo GetCommandQueueInfo} */
public static int clGetCommandQueueInfoInt(long command_queue, int param_name) { return COMMAND_QUEUE.getInt(command_queue, param_name); }
/**
* Single int value version of:
* {@link CL10#clGetCommandQueueInfo GetCommandQueueInfo}
*/
public static int clGetCommandQueueInfoInt(long command_queue, int param_name) {
return COMMAND_QUEUE.getInt(command_queue, param_name);
}
/** Single pointer value version of: {@link CL10#clGetCommandQueueInfo GetCommandQueueInfo} */
public static long clGetCommandQueueInfoPointer(long command_queue, int param_name) { return COMMAND_QUEUE.getPointer(command_queue, param_name); }
/**
* Single pointer value version of:
* {@link CL10#clGetCommandQueueInfo GetCommandQueueInfo}
*/
public static long clGetCommandQueueInfoPointer(long command_queue, int param_name) {
return COMMAND_QUEUE.getPointer(command_queue, param_name);
}
/** PointBuffer version of: {@link CL10#clGetCommandQueueInfo GetCommandQueueInfo} */
public static int clGetCommandQueueInfoPointers(long command_queue, int param_name, PointerBuffer target) { return COMMAND_QUEUE.getPointers(command_queue, param_name, target); }
/**
* PointBuffer version of:
* {@link CL10#clGetCommandQueueInfo GetCommandQueueInfo}
*/
public static int clGetCommandQueueInfoPointers(long command_queue, int param_name, PointerBuffer target) {
return COMMAND_QUEUE.getPointers(command_queue, param_name, target);
}
// ------------------------------------
// Mem Object (CL10.clGetMemObjectInfo)
// ------------------------------------
private static final InfoQuery MEM_OBJECT = new InfoQuery() {
@Override
protected int get(long pointer, int param_name, long param_value_size, long param_value, long param_value_size_ret) {
@ -134,25 +215,48 @@ public final class Info {
}
};
/** Single boolean value version of: {@link CL10#clGetMemObjectInfo GetMemObjectInfo} */
public static boolean clGetMemObjectInfoBoolean(long memobj, int param_name) { return MEM_OBJECT.getBoolean(memobj, param_name); }
/**
* Single boolean value version of:
* {@link CL10#clGetMemObjectInfo GetMemObjectInfo}
*/
public static boolean clGetMemObjectInfoBoolean(long memobj, int param_name) {
return MEM_OBJECT.getBoolean(memobj, param_name);
}
/** Single int value version of: {@link CL10#clGetMemObjectInfo GetMemObjectInfo} */
public static int clGetMemObjectInfoInt(long memobj, int param_name) { return MEM_OBJECT.getInt(memobj, param_name); }
/**
* Single int value version of:
* {@link CL10#clGetMemObjectInfo GetMemObjectInfo}
*/
public static int clGetMemObjectInfoInt(long memobj, int param_name) {
return MEM_OBJECT.getInt(memobj, param_name);
}
/** Single long value version of: {@link CL10#clGetMemObjectInfo GetMemObjectInfo} */
public static long clGetMemObjectInfoLong(long memobj, int param_name) { return MEM_OBJECT.getLong(memobj, param_name); }
/**
* Single long value version of:
* {@link CL10#clGetMemObjectInfo GetMemObjectInfo}
*/
public static long clGetMemObjectInfoLong(long memobj, int param_name) {
return MEM_OBJECT.getLong(memobj, param_name);
}
/** Single pointer value version of: {@link CL10#clGetMemObjectInfo GetMemObjectInfo} */
public static long clGetMemObjectInfoPointer(long memobj, int param_name) { return MEM_OBJECT.getPointer(memobj, param_name); }
/**
* Single pointer value version of:
* {@link CL10#clGetMemObjectInfo GetMemObjectInfo}
*/
public static long clGetMemObjectInfoPointer(long memobj, int param_name) {
return MEM_OBJECT.getPointer(memobj, param_name);
}
/** PointBuffer version of: {@link CL10#clGetMemObjectInfo GetMemObjectInfo} */
public static int clGetMemObjectInfoPointers(long memobj, int param_name, PointerBuffer target) { return MEM_OBJECT.getPointers(memobj, param_name, target); }
/**
* PointBuffer version of: {@link CL10#clGetMemObjectInfo GetMemObjectInfo}
*/
public static int clGetMemObjectInfoPointers(long memobj, int param_name, PointerBuffer target) {
return MEM_OBJECT.getPointers(memobj, param_name, target);
}
// ------------------------------------
// Image (CL10.clGetImageInfo)
// ------------------------------------
private static final InfoQuery IMAGE = new InfoQuery() {
@Override
protected int get(long pointer, int param_name, long param_value_size, long param_value, long param_value_size_ret) {
@ -160,19 +264,30 @@ public final class Info {
}
};
/** Single int value version of: {@link CL10#clGetImageInfo GetImageInfo} */
public static int clGetImageInfoInt(long image, int param_name) { return IMAGE.getInt(image, param_name); }
/**
* Single int value version of: {@link CL10#clGetImageInfo GetImageInfo}
*/
public static int clGetImageInfoInt(long image, int param_name) {
return IMAGE.getInt(image, param_name);
}
/** Single pointer value version of: {@link CL10#clGetImageInfo GetImageInfo} */
public static long clGetImageInfoPointer(long image, int param_name) { return IMAGE.getPointer(image, param_name); }
/**
* Single pointer value version of: {@link CL10#clGetImageInfo GetImageInfo}
*/
public static long clGetImageInfoPointer(long image, int param_name) {
return IMAGE.getPointer(image, param_name);
}
/** PointBuffer version of: {@link CL10#clGetImageInfo GetImageInfo} */
public static int clGetImageInfoPointers(long image, int param_name, PointerBuffer target) { return IMAGE.getPointers(image, param_name, target); }
/**
* PointBuffer version of: {@link CL10#clGetImageInfo GetImageInfo}
*/
public static int clGetImageInfoPointers(long image, int param_name, PointerBuffer target) {
return IMAGE.getPointers(image, param_name, target);
}
// ------------------------------------
// Pipe (CL20.clGetPipeInfo)
// ------------------------------------
private static final InfoQuery PIPE = new InfoQuery() {
@Override
protected int get(long pointer, int param_name, long param_value_size, long param_value, long param_value_size_ret) {
@ -180,13 +295,16 @@ public final class Info {
}
};
/** Single int value version of: {@link CL20#clGetPipeInfo GetPipeInfo} */
public static int clGetPipeInfoInt(long pipe, int param_name) { return PIPE.getInt(pipe, param_name); }
/**
* Single int value version of: {@link CL20#clGetPipeInfo GetPipeInfo}
*/
public static int clGetPipeInfoInt(long pipe, int param_name) {
return PIPE.getInt(pipe, param_name);
}
// ------------------------------------
// Program (CL10.clGetProgramInfo)
// ------------------------------------
private static final InfoQuery PROGRAM = new InfoQuery() {
@Override
protected int get(long pointer, int param_name, long param_value_size, long param_value, long param_value_size_ret) {
@ -194,31 +312,60 @@ public final class Info {
}
};
/** Single int value version of: {@link CL10#clGetProgramInfo GetProgramInfo} */
public static int clGetProgramInfoInt(long program, int param_name) { return PROGRAM.getInt(program, param_name); }
/**
* Single int value version of: {@link CL10#clGetProgramInfo GetProgramInfo}
*/
public static int clGetProgramInfoInt(long program, int param_name) {
return PROGRAM.getInt(program, param_name);
}
/** Single pointer value version of: {@link CL10#clGetProgramInfo GetProgramInfo} */
public static long clGetProgramInfoPointer(long program, int param_name) { return PROGRAM.getPointer(program, param_name); }
/**
* Single pointer value version of:
* {@link CL10#clGetProgramInfo GetProgramInfo}
*/
public static long clGetProgramInfoPointer(long program, int param_name) {
return PROGRAM.getPointer(program, param_name);
}
/** PointBuffer version of: {@link CL10#clGetProgramInfo GetProgramInfo} */
public static int clGetProgramInfoPointers(long program, int param_name, PointerBuffer target) { return PROGRAM.getPointers(program, param_name, target); }
/**
* PointBuffer version of: {@link CL10#clGetProgramInfo GetProgramInfo}
*/
public static int clGetProgramInfoPointers(long program, int param_name, PointerBuffer target) {
return PROGRAM.getPointers(program, param_name, target);
}
/** String version of: {@link CL10#clGetProgramInfo GetProgramInfo} */
public static String clGetProgramInfoStringASCII(long program, int param_name) { return PROGRAM.getStringASCII(program, param_name); }
/**
* String version of: {@link CL10#clGetProgramInfo GetProgramInfo}
*/
public static String clGetProgramInfoStringASCII(long program, int param_name) {
return PROGRAM.getStringASCII(program, param_name);
}
/** String with explicit length version of: {@link CL10#clGetProgramInfo GetProgramInfo}*/
public static String clGetProgramInfoStringASCII(long program, int param_name, int param_value_size) { return PROGRAM.getStringASCII(program, param_name, param_value_size); }
/**
* String with explicit length version of: {@link CL10#clGetProgramInfo GetProgramInfo}
*/
public static String clGetProgramInfoStringASCII(long program, int param_name, int param_value_size) {
return PROGRAM.getStringASCII(program, param_name, param_value_size);
}
/** UTF-8 string version of: {@link CL10#clGetProgramInfo GetProgramInfo} */
public static String clGetProgramInfoStringUTF8(long program, int param_name) { return PROGRAM.getStringUTF8(program, param_name); }
/**
* UTF-8 string version of: {@link CL10#clGetProgramInfo GetProgramInfo}
*/
public static String clGetProgramInfoStringUTF8(long program, int param_name) {
return PROGRAM.getStringUTF8(program, param_name);
}
/** UTF-8 string with explicit length version of: {@link CL10#clGetProgramInfo GetProgramInfo} */
public static String clGetProgramInfoStringUTF8(long program, int param_name, int param_value_size) { return PROGRAM.getStringUTF8(program, param_name, param_value_size); }
/**
* UTF-8 string with explicit length version of:
* {@link CL10#clGetProgramInfo GetProgramInfo}
*/
public static String clGetProgramInfoStringUTF8(long program, int param_name, int param_value_size) {
return PROGRAM.getStringUTF8(program, param_name, param_value_size);
}
// ------------------------------------
// Program Build (CL10.clGetProgramBuildInfo)
// ------------------------------------
private static final InfoQueryObject PROGRAM_BUILD = new InfoQueryObject() {
@Override
protected int get(long pointer, long arg, int param_name, long param_value_size, long param_value, long param_value_size_ret) {
@ -226,31 +373,63 @@ public final class Info {
}
};
/** Single int value version of: {@link CL10#clGetProgramBuildInfo GetProgramBuildInfo} */
public static int clGetProgramBuildInfoInt(long program, long device, int param_name) { return PROGRAM_BUILD.getInt(program, device, param_name); }
/**
* Single int value version of:
* {@link CL10#clGetProgramBuildInfo GetProgramBuildInfo}
*/
public static int clGetProgramBuildInfoInt(long program, long device, int param_name) {
return PROGRAM_BUILD.getInt(program, device, param_name);
}
/** Single pointer value version of: {@link CL10#clGetProgramBuildInfo GetProgramBuildInfo} */
public static long clGetProgramBuildInfoPointer(long program, long device, int param_name) { return PROGRAM_BUILD.getPointer(program, device, param_name); }
/**
* Single pointer value version of:
* {@link CL10#clGetProgramBuildInfo GetProgramBuildInfo}
*/
public static long clGetProgramBuildInfoPointer(long program, long device, int param_name) {
return PROGRAM_BUILD.getPointer(program, device, param_name);
}
/** PointBuffer version of: {@link CL10#clGetProgramBuildInfo GetProgramBuildInfo} */
public static int clGetProgramBuildInfoPointers(long program, long device, int param_name, PointerBuffer target) { return PROGRAM_BUILD.getPointers(program, device, param_name, target); }
/**
* PointBuffer version of:
* {@link CL10#clGetProgramBuildInfo GetProgramBuildInfo}
*/
public static int clGetProgramBuildInfoPointers(long program, long device, int param_name, PointerBuffer target) {
return PROGRAM_BUILD.getPointers(program, device, param_name, target);
}
/** String version of: {@link CL10#clGetProgramBuildInfo GetProgramBuildInfo} */
public static String clGetProgramBuildInfoStringASCII(long program, long device, int param_name) { return PROGRAM_BUILD.getStringASCII(program, device, param_name); }
/**
* String version of: {@link CL10#clGetProgramBuildInfo GetProgramBuildInfo}
*/
public static String clGetProgramBuildInfoStringASCII(long program, long device, int param_name) {
return PROGRAM_BUILD.getStringASCII(program, device, param_name);
}
/** String with explicit length version of: {@link CL10#clGetProgramBuildInfo GetProgramBuildInfo}*/
public static String clGetProgramBuildInfoStringASCII(long program, long device, int param_name, int param_value_size) { return PROGRAM_BUILD.getStringASCII(program, device, param_name, param_value_size); }
/**
* String with explicit length version of: {@link CL10#clGetProgramBuildInfo GetProgramBuildInfo}
*/
public static String clGetProgramBuildInfoStringASCII(long program, long device, int param_name, int param_value_size) {
return PROGRAM_BUILD.getStringASCII(program, device, param_name, param_value_size);
}
/** UTF-8 string version of: {@link CL10#clGetProgramBuildInfo GetProgramBuildInfo} */
public static String clGetProgramBuildInfoStringUTF8(long program, long device, int param_name) { return PROGRAM_BUILD.getStringUTF8(program, device, param_name); }
/**
* UTF-8 string version of:
* {@link CL10#clGetProgramBuildInfo GetProgramBuildInfo}
*/
public static String clGetProgramBuildInfoStringUTF8(long program, long device, int param_name) {
return PROGRAM_BUILD.getStringUTF8(program, device, param_name);
}
/** UTF-8 string with explicit length version of: {@link CL10#clGetProgramBuildInfo GetProgramBuildInfo} */
public static String clGetProgramBuildInfoStringUTF8(long program, long device, int param_name, int param_value_size) { return PROGRAM_BUILD.getStringUTF8(program, device, param_name, param_value_size); }
/**
* UTF-8 string with explicit length version of:
* {@link CL10#clGetProgramBuildInfo GetProgramBuildInfo}
*/
public static String clGetProgramBuildInfoStringUTF8(long program, long device, int param_name, int param_value_size) {
return PROGRAM_BUILD.getStringUTF8(program, device, param_name, param_value_size);
}
// ------------------------------------
// Kernel (CL10.clGetKernelInfo)
// ------------------------------------
private static final InfoQuery KERNEL = new InfoQuery() {
@Override
protected int get(long pointer, int param_name, long param_value_size, long param_value, long param_value_size_ret) {
@ -258,31 +437,60 @@ public final class Info {
}
};
/** Single int value version of: {@link CL10#clGetKernelInfo GetKernelInfo} */
public static int clGetKernelInfoInt(long kernel, int param_name) { return KERNEL.getInt(kernel, param_name); }
/**
* Single int value version of: {@link CL10#clGetKernelInfo GetKernelInfo}
*/
public static int clGetKernelInfoInt(long kernel, int param_name) {
return KERNEL.getInt(kernel, param_name);
}
/** Single pointer value version of: {@link CL10#clGetKernelInfo GetKernelInfo} */
public static long clGetKernelInfoPointer(long kernel, int param_name) { return KERNEL.getPointer(kernel, param_name); }
/**
* Single pointer value version of:
* {@link CL10#clGetKernelInfo GetKernelInfo}
*/
public static long clGetKernelInfoPointer(long kernel, int param_name) {
return KERNEL.getPointer(kernel, param_name);
}
/** PointBuffer version of: {@link CL10#clGetKernelInfo GetKernelInfo} */
public static int clGetKernelInfoPointers(long kernel, int param_name, PointerBuffer target) { return KERNEL.getPointers(kernel, param_name, target); }
/**
* PointBuffer version of: {@link CL10#clGetKernelInfo GetKernelInfo}
*/
public static int clGetKernelInfoPointers(long kernel, int param_name, PointerBuffer target) {
return KERNEL.getPointers(kernel, param_name, target);
}
/** String version of: {@link CL10#clGetKernelInfo GetKernelInfo} */
public static String clGetKernelInfoStringASCII(long kernel, int param_name) { return KERNEL.getStringASCII(kernel, param_name); }
/**
* String version of: {@link CL10#clGetKernelInfo GetKernelInfo}
*/
public static String clGetKernelInfoStringASCII(long kernel, int param_name) {
return KERNEL.getStringASCII(kernel, param_name);
}
/** String with explicit length version of: {@link CL10#clGetKernelInfo GetKernelInfo}*/
public static String clGetKernelInfoStringASCII(long kernel, int param_name, int param_value_size) { return KERNEL.getStringASCII(kernel, param_name, param_value_size); }
/**
* String with explicit length version of: {@link CL10#clGetKernelInfo GetKernelInfo}
*/
public static String clGetKernelInfoStringASCII(long kernel, int param_name, int param_value_size) {
return KERNEL.getStringASCII(kernel, param_name, param_value_size);
}
/** UTF-8 string version of: {@link CL10#clGetKernelInfo GetKernelInfo} */
public static String clGetKernelInfoStringUTF8(long kernel, int param_name) { return KERNEL.getStringUTF8(kernel, param_name); }
/**
* UTF-8 string version of: {@link CL10#clGetKernelInfo GetKernelInfo}
*/
public static String clGetKernelInfoStringUTF8(long kernel, int param_name) {
return KERNEL.getStringUTF8(kernel, param_name);
}
/** UTF-8 string with explicit length version of: {@link CL10#clGetKernelInfo GetKernelInfo} */
public static String clGetKernelInfoStringUTF8(long kernel, int param_name, int param_value_size) { return KERNEL.getStringUTF8(kernel, param_name, param_value_size); }
/**
* UTF-8 string with explicit length version of:
* {@link CL10#clGetKernelInfo GetKernelInfo}
*/
public static String clGetKernelInfoStringUTF8(long kernel, int param_name, int param_value_size) {
return KERNEL.getStringUTF8(kernel, param_name, param_value_size);
}
// ------------------------------------
// Kernel WorkGroup (CL10.clGetKernelWorkGroupInfo)
// ------------------------------------
private static final InfoQueryObject KERNEL_WORKGROUP = new InfoQueryObject() {
@Override
protected int get(long pointer, long arg, int param_name, long param_value_size, long param_value, long param_value_size_ret) {
@ -290,19 +498,33 @@ public final class Info {
}
};
/** Single long value version of: {@link CL10#clGetKernelWorkGroupInfo GetKernelWorkGroupInfo} */
public static long clGetKernelWorkGroupInfoLong(long kernel, long device, int param_name) { return KERNEL_WORKGROUP.getLong(kernel, device, param_name); }
/**
* Single long value version of:
* {@link CL10#clGetKernelWorkGroupInfo GetKernelWorkGroupInfo}
*/
public static long clGetKernelWorkGroupInfoLong(long kernel, long device, int param_name) {
return KERNEL_WORKGROUP.getLong(kernel, device, param_name);
}
/** Single pointer value version of: {@link CL10#clGetKernelWorkGroupInfo GetKernelWorkGroupInfo} */
public static long clGetKernelWorkGroupInfoPointer(long kernel, long device, int param_name) { return KERNEL_WORKGROUP.getPointer(kernel, device, param_name); }
/**
* Single pointer value version of:
* {@link CL10#clGetKernelWorkGroupInfo GetKernelWorkGroupInfo}
*/
public static long clGetKernelWorkGroupInfoPointer(long kernel, long device, int param_name) {
return KERNEL_WORKGROUP.getPointer(kernel, device, param_name);
}
/** PointBuffer version of: {@link CL10#clGetKernelWorkGroupInfo GetKernelWorkGroupInfo} */
public static int clGetKernelWorkGroupInfoPointers(long kernel, long device, int param_name, PointerBuffer target) { return KERNEL_WORKGROUP.getPointers(kernel, device, param_name, target); }
/**
* PointBuffer version of:
* {@link CL10#clGetKernelWorkGroupInfo GetKernelWorkGroupInfo}
*/
public static int clGetKernelWorkGroupInfoPointers(long kernel, long device, int param_name, PointerBuffer target) {
return KERNEL_WORKGROUP.getPointers(kernel, device, param_name, target);
}
// ------------------------------------
// Kernel Arg (CL12.clGetKernelArgInfo)
// ------------------------------------
private static final InfoQueryInt KERNEL_ARG = new InfoQueryInt() {
@Override
protected int get(long pointer, int arg, int param_name, long param_value_size, long param_value, long param_value_size_ret) {
@ -310,28 +532,54 @@ public final class Info {
}
};
/** Single int value version of: {@link CL12#clGetKernelArgInfo GetKernelArgInfo} */
public static int clGetKernelArgInfoInt(long kernel, int arg_indx, int param_name) { return KERNEL_ARG.getInt(kernel, arg_indx, param_name); }
/**
* Single int value version of:
* {@link CL12#clGetKernelArgInfo GetKernelArgInfo}
*/
public static int clGetKernelArgInfoInt(long kernel, int arg_indx, int param_name) {
return KERNEL_ARG.getInt(kernel, arg_indx, param_name);
}
/** Single long value version of: {@link CL12#clGetKernelArgInfo GetKernelArgInfo} */
public static long clGetKernelArgInfoLong(long kernel, int arg_indx, int param_name) { return KERNEL_ARG.getLong(kernel, arg_indx, param_name); }
/**
* Single long value version of:
* {@link CL12#clGetKernelArgInfo GetKernelArgInfo}
*/
public static long clGetKernelArgInfoLong(long kernel, int arg_indx, int param_name) {
return KERNEL_ARG.getLong(kernel, arg_indx, param_name);
}
/** String version of: {@link CL12#clGetKernelArgInfo GetKernelArgInfo} */
public static String clGetKernelArgInfoStringASCII(long kernel, int arg_indx, int param_name) { return KERNEL_ARG.getStringASCII(kernel, arg_indx, param_name); }
/**
* String version of: {@link CL12#clGetKernelArgInfo GetKernelArgInfo}
*/
public static String clGetKernelArgInfoStringASCII(long kernel, int arg_indx, int param_name) {
return KERNEL_ARG.getStringASCII(kernel, arg_indx, param_name);
}
/** String with explicit length version of: {@link CL12#clGetKernelArgInfo GetKernelArgInfo}*/
public static String clGetKernelArgInfoStringASCII(long kernel, int arg_indx, int param_name, int param_value_size) { return KERNEL_ARG.getStringASCII(kernel, arg_indx, param_name, param_value_size); }
/**
* String with explicit length version of: {@link CL12#clGetKernelArgInfo GetKernelArgInfo}
*/
public static String clGetKernelArgInfoStringASCII(long kernel, int arg_indx, int param_name, int param_value_size) {
return KERNEL_ARG.getStringASCII(kernel, arg_indx, param_name, param_value_size);
}
/** UTF-8 string version of: {@link CL12#clGetKernelArgInfo GetKernelArgInfo} */
public static String clGetKernelArgInfoStringUTF8(long kernel, int arg_indx, int param_name) { return KERNEL_ARG.getStringUTF8(kernel, arg_indx, param_name); }
/**
* UTF-8 string version of: {@link CL12#clGetKernelArgInfo GetKernelArgInfo}
*/
public static String clGetKernelArgInfoStringUTF8(long kernel, int arg_indx, int param_name) {
return KERNEL_ARG.getStringUTF8(kernel, arg_indx, param_name);
}
/** UTF-8 string with explicit length version of: {@link CL12#clGetKernelArgInfo GetKernelArgInfo} */
public static String clGetKernelArgInfoStringUTF8(long kernel, int arg_indx, int param_name, int param_value_size) { return KERNEL_ARG.getStringUTF8(kernel, arg_indx, param_name, param_value_size); }
/**
* UTF-8 string with explicit length version of:
* {@link CL12#clGetKernelArgInfo GetKernelArgInfo}
*/
public static String clGetKernelArgInfoStringUTF8(long kernel, int arg_indx, int param_name, int param_value_size) {
return KERNEL_ARG.getStringUTF8(kernel, arg_indx, param_name, param_value_size);
}
// ------------------------------------
// Sampler (CL10.clGetSamplerInfo)
// ------------------------------------
private static final InfoQuery SAMPLER = new InfoQuery() {
@Override
protected int get(long pointer, int param_name, long param_value_size, long param_value, long param_value_size_ret) {
@ -339,22 +587,39 @@ public final class Info {
}
};
/** Single boolean value version of: {@link CL10#clGetSamplerInfo GetSamplerInfo} */
public static boolean clGetSamplerInfoBoolean(long sampler, int param_name) { return SAMPLER.getBoolean(sampler, param_name); }
/**
* Single boolean value version of:
* {@link CL10#clGetSamplerInfo GetSamplerInfo}
*/
public static boolean clGetSamplerInfoBoolean(long sampler, int param_name) {
return SAMPLER.getBoolean(sampler, param_name);
}
/** Single int value version of: {@link CL10#clGetSamplerInfo GetSamplerInfo} */
public static int clGetSamplerInfoInt(long sampler, int param_name) { return SAMPLER.getInt(sampler, param_name); }
/**
* Single int value version of: {@link CL10#clGetSamplerInfo GetSamplerInfo}
*/
public static int clGetSamplerInfoInt(long sampler, int param_name) {
return SAMPLER.getInt(sampler, param_name);
}
/** Single pointer value version of: {@link CL10#clGetSamplerInfo GetSamplerInfo} */
public static long clGetSamplerInfoPointer(long sampler, int param_name) { return SAMPLER.getPointer(sampler, param_name); }
/**
* Single pointer value version of:
* {@link CL10#clGetSamplerInfo GetSamplerInfo}
*/
public static long clGetSamplerInfoPointer(long sampler, int param_name) {
return SAMPLER.getPointer(sampler, param_name);
}
/** PointBuffer version of: {@link CL10#clGetSamplerInfo GetSamplerInfo} */
public static int clGetSamplerInfoPointers(long sampler, int param_name, PointerBuffer target) { return SAMPLER.getPointers(sampler, param_name, target); }
/**
* PointBuffer version of: {@link CL10#clGetSamplerInfo GetSamplerInfo}
*/
public static int clGetSamplerInfoPointers(long sampler, int param_name, PointerBuffer target) {
return SAMPLER.getPointers(sampler, param_name, target);
}
// ------------------------------------
// Event (CL10.clGetEventInfo)
// ------------------------------------
private static final InfoQuery EVENT = new InfoQuery() {
@Override
protected int get(long pointer, int param_name, long param_value_size, long param_value, long param_value_size_ret) {
@ -362,19 +627,30 @@ public final class Info {
}
};
/** Single int value version of: {@link CL10#clGetEventInfo GetEventInfo} */
public static int clGetEventInfoInt(long event, int param_name) { return EVENT.getInt(event, param_name); }
/**
* Single int value version of: {@link CL10#clGetEventInfo GetEventInfo}
*/
public static int clGetEventInfoInt(long event, int param_name) {
return EVENT.getInt(event, param_name);
}
/** Single pointer value version of: {@link CL10#clGetEventInfo GetEventInfo} */
public static long clGetEventInfoPointer(long event, int param_name) { return EVENT.getPointer(event, param_name); }
/**
* Single pointer value version of: {@link CL10#clGetEventInfo GetEventInfo}
*/
public static long clGetEventInfoPointer(long event, int param_name) {
return EVENT.getPointer(event, param_name);
}
/** PointBuffer version of: {@link CL10#clGetEventInfo GetEventInfo} */
public static int clGetEventInfoPointers(long event, int param_name, PointerBuffer target) { return EVENT.getPointers(event, param_name, target); }
/**
* PointBuffer version of: {@link CL10#clGetEventInfo GetEventInfo}
*/
public static int clGetEventInfoPointers(long event, int param_name, PointerBuffer target) {
return EVENT.getPointers(event, param_name, target);
}
// ------------------------------------
// Event Profiling (CL10.clGetEventProfilingInfo)
// ------------------------------------
private static final InfoQuery EVENT_PROFILING = new InfoQuery() {
@Override
protected int get(long pointer, int param_name, long param_value_size, long param_value, long param_value_size_ret) {
@ -382,13 +658,17 @@ public final class Info {
}
};
/** Single long value version of: {@link CL10#clGetEventProfilingInfo GetEventProfilingInfo} */
public static long clGetEventProfilingInfoLong(long event, int param_name) { return EVENT_PROFILING.getLong(event, param_name); }
/**
* Single long value version of:
* {@link CL10#clGetEventProfilingInfo GetEventProfilingInfo}
*/
public static long clGetEventProfilingInfoLong(long event, int param_name) {
return EVENT_PROFILING.getLong(event, param_name);
}
// ------------------------------------
// GL Texture (CL10GL.clGetGLTextureInfo)
// ------------------------------------
private static final InfoQuery GL_TEXTURE = new InfoQuery() {
@Override
protected int get(long pointer, int param_name, long param_value_size, long param_value, long param_value_size_ret) {
@ -396,7 +676,12 @@ public final class Info {
}
};
/** Single int value version of: {@link CL10GL#clGetGLTextureInfo GetGLTextureInfo} */
public static int clGetGLTextureInfoInt(long memobj, int param_name) { return GL_TEXTURE.getInt(memobj, param_name); }
/**
* Single int value version of:
* {@link CL10GL#clGetGLTextureInfo GetGLTextureInfo}
*/
public static int clGetGLTextureInfoInt(long memobj, int param_name) {
return GL_TEXTURE.getInt(memobj, param_name);
}
}

@ -16,7 +16,8 @@ import static org.lwjgl.system.Pointer.*;
/**
* Base class for OpenCL object information queries.
* <p/>
* All methods require the object being queried (a pointer value) and the integer parameter name.
* All methods require the object being queried (a pointer value) and the
* integer parameter name.
*
* @see Info
*/
@ -28,7 +29,8 @@ abstract class InfoQuery {
}
/**
* Returns the integer value for the specified {@code param_name}, converted to a boolean.
* Returns the integer value for the specified {@code param_name}, converted
* to a boolean.
*
* @param object the object to query
* @param param_name the parameter to query
@ -42,7 +44,8 @@ abstract class InfoQuery {
/**
* Returns the integer value for the specified {@code param_name}.
* <p/>
* For integer parameters that may be 32 or 64 bits (e.g. {@code size_t}), {@link #getPointer} should be used instead.
* For integer parameters that may be 32 or 64 bits (e.g. {@code size_t}),
* {@link #getPointer} should be used instead.
*
* @param object the object to query
* @param param_name the parameter to query
@ -52,15 +55,17 @@ abstract class InfoQuery {
int getInt(long object, int param_name) {
APIBuffer __buffer = apiBuffer();
int errcode = get(object, param_name, 4L, __buffer.address(), NULL);
if ( DEBUG )
if (DEBUG) {
checkCLError(errcode);
}
return __buffer.intValue(0);
}
/**
* Returns the long value for the specified {@code param_name}.
* <p/>
* For integer parameters that may be 32 or 64 bits (e.g. {@code size_t}), {@link #getPointer} should be used instead.
* For integer parameters that may be 32 or 64 bits (e.g. {@code size_t}),
* {@link #getPointer} should be used instead.
*
* @param object the object to query
* @param param_name the parameter to query
@ -70,15 +75,17 @@ abstract class InfoQuery {
long getLong(long object, int param_name) {
APIBuffer __buffer = apiBuffer();
int errcode = get(object, param_name, 8L, __buffer.address(), NULL);
if ( DEBUG )
if (DEBUG) {
checkCLError(errcode);
}
return __buffer.longValue(0);
}
/**
* Returns the pointer value for the specified {@code param_name}.
* <p/>
* This method should also be used for integer parameters that may be 32 or 64 bits (e.g. {@code size_t}).
* This method should also be used for integer parameters that may be 32 or
* 64 bits (e.g. {@code size_t}).
*
* @param object the object to query
* @param param_name the parameter to query
@ -88,15 +95,18 @@ abstract class InfoQuery {
long getPointer(long object, int param_name) {
APIBuffer __buffer = apiBuffer();
int errcode = get(object, param_name, POINTER_SIZE, __buffer.address(), NULL);
if ( DEBUG )
if (DEBUG) {
checkCLError(errcode);
}
return __buffer.pointerValue(0);
}
/**
* Writes the pointer list for the specified {@code param_name} into {@code target}.
* Writes the pointer list for the specified {@code param_name} into
* {@code target}.
* <p/>
* This method should also be used for integer parameters that may be 32 or 64 bits (e.g. {@code size_t}).
* This method should also be used for integer parameters that may be 32 or
* 64 bits (e.g. {@code size_t}).
*
* @param object the object to query
* @param param_name the parameter to query
@ -107,13 +117,15 @@ abstract class InfoQuery {
int getPointers(long object, int param_name, PointerBuffer target) {
APIBuffer __buffer = apiBuffer();
int errcode = get(object, param_name, target.remaining() * POINTER_SIZE, memAddress(target), __buffer.address());
if ( DEBUG )
if (DEBUG) {
checkCLError(errcode);
return (int)(__buffer.pointerValue(0) >> POINTER_SHIFT);
}
return (int) (__buffer.pointerValue(0) >> POINTER_SHIFT);
}
/**
* Returns the string value for the specified {@code param_name}. The raw bytes returned are assumed to be ASCII encoded.
* Returns the string value for the specified {@code param_name}. The raw
* bytes returned are assumed to be ASCII encoded.
*
* @param object the object to query
* @param param_name the parameter to query
@ -127,7 +139,8 @@ abstract class InfoQuery {
}
/**
* Returns the string value for the specified {@code param_name}. The raw bytes returned are assumed to be ASCII encoded and have length equal to {@code
* Returns the string value for the specified {@code param_name}. The raw
* bytes returned are assumed to be ASCII encoded and have length equal to {@code
* param_value_size}.
*
* @param object the object to query
@ -139,13 +152,15 @@ abstract class InfoQuery {
String getStringASCII(long object, int param_name, int param_value_size) {
APIBuffer __buffer = apiBuffer();
int errcode = get(object, param_name, param_value_size, __buffer.address(), NULL);
if ( DEBUG )
if (DEBUG) {
checkCLError(errcode);
}
return __buffer.stringValueASCII(0, param_value_size);
}
/**
* Returns the string value for the specified {@code param_name}. The raw bytes returned are assumed to be UTF-8 encoded.
* Returns the string value for the specified {@code param_name}. The raw
* bytes returned are assumed to be UTF-8 encoded.
*
* @param object the object to query
* @param param_name the parameter to query
@ -159,7 +174,8 @@ abstract class InfoQuery {
}
/**
* Returns the string value for the specified {@code param_name}. The raw bytes returned are assumed to be UTF-8 encoded and have length equal to {@code
* Returns the string value for the specified {@code param_name}. The raw
* bytes returned are assumed to be UTF-8 encoded and have length equal to {@code
* param_value_size}.
*
* @param object the object to query
@ -171,24 +187,27 @@ abstract class InfoQuery {
String getStringUTF8(long object, int param_name, int param_value_size) {
APIBuffer __buffer = apiBuffer();
int errcode = get(object, param_name, param_value_size, __buffer.address(), NULL);
if ( DEBUG )
if (DEBUG) {
checkCLError(errcode);
}
return __buffer.stringValueUTF8(0, param_value_size);
}
private int getString(long object, int param_name, APIBuffer __buffer) {
// Get string length
int errcode = get(object, param_name, 0, NULL, __buffer.address());
if ( DEBUG )
if (DEBUG) {
checkCLError(errcode);
}
int bytes = (int)__buffer.pointerValue(0);
int bytes = (int) __buffer.pointerValue(0);
__buffer.bufferParam(bytes);
// Get string
errcode = get(object, param_name, bytes, __buffer.address(), NULL);
if ( DEBUG )
if (DEBUG) {
checkCLError(errcode);
}
return bytes - 1; // all OpenCL char[] parameters are null-terminated
}

@ -16,7 +16,8 @@ import static org.lwjgl.system.Pointer.*;
/**
* Base class for OpenCL object information queries.
* <p/>
* All methods require the object being queried (a pointer value), a second integer argument and the integer parameter name.
* All methods require the object being queried (a pointer value), a second
* integer argument and the integer parameter name.
*
* @see Info
*/
@ -28,7 +29,8 @@ abstract class InfoQueryInt {
}
/**
* Returns the integer value for the specified {@code param_name}, converted to a boolean.
* Returns the integer value for the specified {@code param_name}, converted
* to a boolean.
*
* @param object the object to query
* @param arg an integer argument
@ -43,7 +45,8 @@ abstract class InfoQueryInt {
/**
* Returns the integer value for the specified {@code param_name}.
* <p/>
* For integer parameters that may be 32 or 64 bits (e.g. {@code size_t}), {@link #getPointer} should be used instead.
* For integer parameters that may be 32 or 64 bits (e.g. {@code size_t}),
* {@link #getPointer} should be used instead.
*
* @param object the object to query
* @param arg an integer argument
@ -54,15 +57,17 @@ abstract class InfoQueryInt {
int getInt(long object, int arg, int param_name) {
APIBuffer __buffer = apiBuffer();
int errcode = get(object, arg, param_name, 4L, __buffer.address(), NULL);
if ( DEBUG )
if (DEBUG) {
checkCLError(errcode);
}
return __buffer.intValue(0);
}
/**
* Returns the long value for the specified {@code param_name}.
* <p/>
* For integer parameters that may be 32 or 64 bits (e.g. {@code size_t}), {@link #getPointer} should be used instead.
* For integer parameters that may be 32 or 64 bits (e.g. {@code size_t}),
* {@link #getPointer} should be used instead.
*
* @param object the object to query
* @param arg an integer argument
@ -73,15 +78,17 @@ abstract class InfoQueryInt {
long getLong(long object, int arg, int param_name) {
APIBuffer __buffer = apiBuffer();
int errcode = get(object, arg, param_name, 8L, __buffer.address(), NULL);
if ( DEBUG )
if (DEBUG) {
checkCLError(errcode);
}
return __buffer.longValue(0);
}
/**
* Returns the pointer value for the specified {@code param_name}.
* <p/>
* This method should also be used for integer parameters that may be 32 or 64 bits (e.g. {@code size_t}).
* This method should also be used for integer parameters that may be 32 or
* 64 bits (e.g. {@code size_t}).
*
* @param object the object to query
* @param arg an integer argument
@ -92,15 +99,18 @@ abstract class InfoQueryInt {
long getPointer(long object, int arg, int param_name) {
APIBuffer __buffer = apiBuffer();
int errcode = get(object, arg, param_name, POINTER_SIZE, __buffer.address(), NULL);
if ( DEBUG )
if (DEBUG) {
checkCLError(errcode);
}
return __buffer.pointerValue(0);
}
/**
* Writes the pointer list for the specified {@code param_name} into {@code target}.
* Writes the pointer list for the specified {@code param_name} into
* {@code target}.
* <p/>
* This method should also be used for integer parameters that may be 32 or 64 bits (e.g. {@code size_t}).
* This method should also be used for integer parameters that may be 32 or
* 64 bits (e.g. {@code size_t}).
*
* @param object the object to query
* @param arg an integer argument
@ -112,13 +122,15 @@ abstract class InfoQueryInt {
int getPointers(long object, int arg, int param_name, PointerBuffer target) {
APIBuffer __buffer = apiBuffer();
int errcode = get(object, arg, param_name, target.remaining() * POINTER_SIZE, memAddress(target), __buffer.address());
if ( DEBUG )
if (DEBUG) {
checkCLError(errcode);
return (int)(__buffer.pointerValue(0) >> POINTER_SHIFT);
}
return (int) (__buffer.pointerValue(0) >> POINTER_SHIFT);
}
/**
* Returns the string value for the specified {@code param_name}. The raw bytes returned are assumed to be ASCII encoded.
* Returns the string value for the specified {@code param_name}. The raw
* bytes returned are assumed to be ASCII encoded.
*
* @param object the object to query
* @param arg an integer argument
@ -133,7 +145,8 @@ abstract class InfoQueryInt {
}
/**
* Returns the string value for the specified {@code param_name}. The raw bytes returned are assumed to be ASCII encoded and have length equal to {@code
* Returns the string value for the specified {@code param_name}. The raw
* bytes returned are assumed to be ASCII encoded and have length equal to {@code
* param_value_size}.
*
* @param object the object to query
@ -146,13 +159,15 @@ abstract class InfoQueryInt {
String getStringASCII(long object, int arg, int param_name, int param_value_size) {
APIBuffer __buffer = apiBuffer();
int errcode = get(object, arg, param_name, param_value_size, __buffer.address(), NULL);
if ( DEBUG )
if (DEBUG) {
checkCLError(errcode);
}
return __buffer.stringValueASCII(0, param_value_size);
}
/**
* Returns the string value for the specified {@code param_name}. The raw bytes returned are assumed to be UTF-8 encoded.
* Returns the string value for the specified {@code param_name}. The raw
* bytes returned are assumed to be UTF-8 encoded.
*
* @param object the object to query
* @param arg an integer argument
@ -167,7 +182,8 @@ abstract class InfoQueryInt {
}
/**
* Returns the string value for the specified {@code param_name}. The raw bytes returned are assumed to be UTF-8 encoded and have length equal to {@code
* Returns the string value for the specified {@code param_name}. The raw
* bytes returned are assumed to be UTF-8 encoded and have length equal to {@code
* param_value_size}.
*
* @param object the object to query
@ -180,24 +196,27 @@ abstract class InfoQueryInt {
String getStringUTF8(long object, int arg, int param_name, int param_value_size) {
APIBuffer __buffer = apiBuffer();
int errcode = get(object, arg, param_name, param_value_size, __buffer.address(), NULL);
if ( DEBUG )
if (DEBUG) {
checkCLError(errcode);
}
return __buffer.stringValueUTF8(0, param_value_size);
}
private int getString(long object, int arg, int param_name, APIBuffer __buffer) {
// Get string length
int errcode = get(object, arg, param_name, 0, NULL, __buffer.address());
if ( DEBUG )
if (DEBUG) {
checkCLError(errcode);
}
int bytes = (int)__buffer.pointerValue(0);
int bytes = (int) __buffer.pointerValue(0);
__buffer.bufferParam(bytes + POINTER_SIZE);
// Get string
errcode = get(object, arg, param_name, bytes, __buffer.address(), NULL);
if ( DEBUG )
if (DEBUG) {
checkCLError(errcode);
}
return bytes - 1; // all OpenCL char[] parameters are null-terminated
}

@ -16,7 +16,8 @@ import static org.lwjgl.system.Pointer.*;
/**
* Base class for OpenCL object information queries.
* <p/>
* All methods require the object being queried (a pointer value), a second object argument (another pointer value) and the integer parameter name.
* All methods require the object being queried (a pointer value), a second
* object argument (another pointer value) and the integer parameter name.
*
* @see org.lwjgl.opencl.Info
*/
@ -28,7 +29,8 @@ abstract class InfoQueryObject {
}
/**
* Returns the integer value for the specified {@code param_name}, converted to a boolean.
* Returns the integer value for the specified {@code param_name}, converted
* to a boolean.
*
* @param object the object to query
* @param arg an object argument
@ -43,7 +45,8 @@ abstract class InfoQueryObject {
/**
* Returns the integer value for the specified {@code param_name}.
* <p/>
* For integer parameters that may be 32 or 64 bits (e.g. {@code size_t}), {@link #getPointer} should be used instead.
* For integer parameters that may be 32 or 64 bits (e.g. {@code size_t}),
* {@link #getPointer} should be used instead.
*
* @param object the object to query
* @param arg an object argument
@ -54,15 +57,17 @@ abstract class InfoQueryObject {
int getInt(long object, long arg, int param_name) {
APIBuffer __buffer = apiBuffer();
int errcode = get(object, arg, param_name, 4L, __buffer.address(), NULL);
if ( DEBUG )
if (DEBUG) {
checkCLError(errcode);
}
return __buffer.intValue(0);
}
/**
* Returns the long value for the specified {@code param_name}.
* <p/>
* For integer parameters that may be 32 or 64 bits (e.g. {@code size_t}), {@link #getPointer} should be used instead.
* For integer parameters that may be 32 or 64 bits (e.g. {@code size_t}),
* {@link #getPointer} should be used instead.
*
* @param object the object to query
* @param arg an object argument
@ -73,15 +78,17 @@ abstract class InfoQueryObject {
long getLong(long object, long arg, int param_name) {
APIBuffer __buffer = apiBuffer();
int errcode = get(object, arg, param_name, 8L, __buffer.address(), NULL);
if ( DEBUG )
if (DEBUG) {
checkCLError(errcode);
}
return __buffer.longValue(0);
}
/**
* Returns the pointer value for the specified {@code param_name}.
* <p/>
* This method should also be used for integer parameters that may be 32 or 64 bits (e.g. {@code size_t}).
* This method should also be used for integer parameters that may be 32 or
* 64 bits (e.g. {@code size_t}).
*
* @param object the object to query
* @param arg an object argument
@ -92,15 +99,18 @@ abstract class InfoQueryObject {
long getPointer(long object, long arg, int param_name) {
APIBuffer __buffer = apiBuffer();
int errcode = get(object, arg, param_name, POINTER_SIZE, __buffer.address(), NULL);
if ( DEBUG )
if (DEBUG) {
checkCLError(errcode);
}
return __buffer.pointerValue(0);
}
/**
* Writes the pointer list for the specified {@code param_name} into {@code target}.
* Writes the pointer list for the specified {@code param_name} into
* {@code target}.
* <p/>
* This method should also be used for integer parameters that may be 32 or 64 bits (e.g. {@code size_t}).
* This method should also be used for integer parameters that may be 32 or
* 64 bits (e.g. {@code size_t}).
*
* @param object the object to query
* @param arg an object argument
@ -112,13 +122,15 @@ abstract class InfoQueryObject {
int getPointers(long object, long arg, int param_name, PointerBuffer target) {
APIBuffer __buffer = apiBuffer();
int errcode = get(object, arg, param_name, target.remaining() * POINTER_SIZE, memAddress(target), __buffer.address());
if ( DEBUG )
if (DEBUG) {
checkCLError(errcode);
return (int)(__buffer.pointerValue(0) >> POINTER_SHIFT);
}
return (int) (__buffer.pointerValue(0) >> POINTER_SHIFT);
}
/**
* Returns the string value for the specified {@code param_name}. The raw bytes returned are assumed to be ASCII encoded.
* Returns the string value for the specified {@code param_name}. The raw
* bytes returned are assumed to be ASCII encoded.
*
* @param object the object to query
* @param arg an object argument
@ -133,7 +145,8 @@ abstract class InfoQueryObject {
}
/**
* Returns the string value for the specified {@code param_name}. The raw bytes returned are assumed to be ASCII encoded and have length equal to {@code
* Returns the string value for the specified {@code param_name}. The raw
* bytes returned are assumed to be ASCII encoded and have length equal to {@code
* param_value_size}.
*
* @param object the object to query
@ -146,13 +159,15 @@ abstract class InfoQueryObject {
String getStringASCII(long object, long arg, int param_name, int param_value_size) {
APIBuffer __buffer = apiBuffer();
int errcode = get(object, arg, param_name, param_value_size, __buffer.address(), NULL);
if ( DEBUG )
if (DEBUG) {
checkCLError(errcode);
}
return __buffer.stringValueASCII(0, param_value_size);
}
/**
* Returns the string value for the specified {@code param_name}. The raw bytes returned are assumed to be UTF-8 encoded.
* Returns the string value for the specified {@code param_name}. The raw
* bytes returned are assumed to be UTF-8 encoded.
*
* @param object the object to query
* @param arg an object argument
@ -167,7 +182,8 @@ abstract class InfoQueryObject {
}
/**
* Returns the string value for the specified {@code param_name}. The raw bytes returned are assumed to be UTF-8 encoded and have length equal to {@code
* Returns the string value for the specified {@code param_name}. The raw
* bytes returned are assumed to be UTF-8 encoded and have length equal to {@code
* param_value_size}.
*
* @param object the object to query
@ -180,24 +196,27 @@ abstract class InfoQueryObject {
String getStringUTF8(long object, long arg, int param_name, int param_value_size) {
APIBuffer __buffer = apiBuffer();
int errcode = get(object, arg, param_name, param_value_size, __buffer.address(), NULL);
if ( DEBUG )
if (DEBUG) {
checkCLError(errcode);
}
return __buffer.stringValueUTF8(0, param_value_size);
}
private int getString(long object, long arg, int param_name, APIBuffer __buffer) {
// Get string length
int errcode = get(object, arg, param_name, 0, NULL, __buffer.address());
if ( DEBUG )
if (DEBUG) {
checkCLError(errcode);
}
int bytes = (int)__buffer.pointerValue(0);
int bytes = (int) __buffer.pointerValue(0);
__buffer.bufferParam(bytes + POINTER_SIZE);
// Get string
errcode = get(object, arg, param_name, bytes, __buffer.address(), NULL);
if ( DEBUG )
if (DEBUG) {
checkCLError(errcode);
}
return bytes - 1; // all OpenCL char[] parameters are null-terminated
}

Loading…
Cancel
Save