You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(134) |
Sep
(52) |
Oct
(13) |
Nov
(342) |
Dec
(163) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
(44) |
Feb
(62) |
Mar
(158) |
Apr
(38) |
May
(70) |
Jun
(58) |
Jul
(104) |
Aug
(207) |
Sep
(83) |
Oct
(122) |
Nov
(23) |
Dec
(49) |
| 2004 |
Jan
(119) |
Feb
(132) |
Mar
(192) |
Apr
(140) |
May
(77) |
Jun
(74) |
Jul
(201) |
Aug
(63) |
Sep
(102) |
Oct
(70) |
Nov
(173) |
Dec
(78) |
| 2005 |
Jan
(174) |
Feb
(197) |
Mar
(105) |
Apr
(59) |
May
(77) |
Jun
(43) |
Jul
(21) |
Aug
(18) |
Sep
(47) |
Oct
(37) |
Nov
(74) |
Dec
(50) |
| 2006 |
Jan
(44) |
Feb
(19) |
Mar
(32) |
Apr
(24) |
May
(31) |
Jun
(55) |
Jul
(138) |
Aug
(28) |
Sep
(12) |
Oct
(41) |
Nov
(58) |
Dec
(24) |
| 2007 |
Jan
(28) |
Feb
(14) |
Mar
(10) |
Apr
(68) |
May
(30) |
Jun
(26) |
Jul
(18) |
Aug
(63) |
Sep
(19) |
Oct
(29) |
Nov
(20) |
Dec
(10) |
| 2008 |
Jan
(38) |
Feb
(7) |
Mar
(37) |
Apr
(120) |
May
(41) |
Jun
(36) |
Jul
(39) |
Aug
(24) |
Sep
(28) |
Oct
(30) |
Nov
(36) |
Dec
(75) |
| 2009 |
Jan
(46) |
Feb
(22) |
Mar
(50) |
Apr
(70) |
May
(134) |
Jun
(105) |
Jul
(75) |
Aug
(34) |
Sep
(38) |
Oct
(34) |
Nov
(19) |
Dec
(20) |
| 2010 |
Jan
(11) |
Feb
(20) |
Mar
(65) |
Apr
(83) |
May
(104) |
Jun
(73) |
Jul
(78) |
Aug
(57) |
Sep
(43) |
Oct
(35) |
Nov
(9) |
Dec
(4) |
| 2011 |
Jan
(21) |
Feb
(11) |
Mar
(18) |
Apr
(10) |
May
(18) |
Jun
(15) |
Jul
(48) |
Aug
(25) |
Sep
(17) |
Oct
(45) |
Nov
(15) |
Dec
(12) |
| 2012 |
Jan
(21) |
Feb
(9) |
Mar
(12) |
Apr
(9) |
May
(9) |
Jun
(5) |
Jul
(1) |
Aug
(10) |
Sep
(12) |
Oct
(1) |
Nov
(28) |
Dec
(5) |
| 2013 |
Jan
(4) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2014 |
Jan
|
Feb
(1) |
Mar
(1) |
Apr
|
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
| 2015 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
|
| 2016 |
Jan
(2) |
Feb
(1) |
Mar
(1) |
Apr
(1) |
May
(2) |
Jun
|
Jul
(1) |
Aug
(2) |
Sep
|
Oct
|
Nov
(1) |
Dec
|
| 2017 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
|
|
|
1
(4) |
2
(2) |
3
|
4
(1) |
|
5
(1) |
6
(1) |
7
(1) |
8
(1) |
9
(2) |
10
(3) |
11
(2) |
|
12
(1) |
13
(2) |
14
(2) |
15
(4) |
16
(1) |
17
|
18
|
|
19
|
20
|
21
(2) |
22
(1) |
23
|
24
|
25
|
|
26
(3) |
27
(3) |
28
(2) |
29
|
30
(4) |
|
|
|
From: <sp...@us...> - 2010-09-30 23:36:48
|
Revision: 3422
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3422&view=rev
Author: spasi
Date: 2010-09-30 23:36:37 +0000 (Thu, 30 Sep 2010)
Log Message:
-----------
Misc CL fixes.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/PointerBuffer.java
trunk/LWJGL/src/java/org/lwjgl/PointerWrapperAbstract.java
trunk/LWJGL/src/java/org/lwjgl/opencl/APIUtil.java
trunk/LWJGL/src/java/org/lwjgl/opencl/CLPlatform.java
trunk/LWJGL/src/java/org/lwjgl/opencl/InfoUtilFactory.java
trunk/LWJGL/src/java/org/lwjgl/test/opencl/HelloOpenCL.java
trunk/LWJGL/src/templates/org/lwjgl/opencl/APPLE_gl_sharing.java
trunk/LWJGL/src/templates/org/lwjgl/opencl/CL10.java
trunk/LWJGL/src/templates/org/lwjgl/opencl/KHR_gl_sharing.java
Modified: trunk/LWJGL/src/java/org/lwjgl/PointerBuffer.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/PointerBuffer.java 2010-09-30 19:04:25 UTC (rev 3421)
+++ trunk/LWJGL/src/java/org/lwjgl/PointerBuffer.java 2010-09-30 23:36:37 UTC (rev 3422)
@@ -290,6 +290,16 @@
}
/**
+ * Returns the number of bytes between the current position and the
+ * limit. </p>
+ *
+ * @return The number of bytes remaining in this buffer
+ */
+ public final int remainingByte() {
+ return remaining() * getPointerSize();
+ }
+
+ /**
* Tells whether there are any elements between the current position and
* the limit. </p>
*
Modified: trunk/LWJGL/src/java/org/lwjgl/PointerWrapperAbstract.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/PointerWrapperAbstract.java 2010-09-30 19:04:25 UTC (rev 3421)
+++ trunk/LWJGL/src/java/org/lwjgl/PointerWrapperAbstract.java 2010-09-30 23:36:37 UTC (rev 3422)
@@ -87,6 +87,6 @@
}
public String toString() {
- return getClass().getSimpleName() + " pointer (0x" + Long.toHexString(pointer) + ")";
+ return getClass().getSimpleName() + " pointer (0x" + Long.toHexString(pointer).toUpperCase() + ")";
}
}
\ No newline at end of file
Modified: trunk/LWJGL/src/java/org/lwjgl/opencl/APIUtil.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opencl/APIUtil.java 2010-09-30 19:04:25 UTC (rev 3421)
+++ trunk/LWJGL/src/java/org/lwjgl/opencl/APIUtil.java 2010-09-30 23:36:37 UTC (rev 3422)
@@ -42,6 +42,11 @@
import java.util.Set;
import java.util.StringTokenizer;
+import static org.lwjgl.opencl.APPLEGLSharing.*;
+import static org.lwjgl.opencl.CL10.*;
+import static org.lwjgl.opencl.EXTDeviceFission.*;
+import static org.lwjgl.opencl.KHRGLSharing.*;
+
/**
* Utility class for OpenCL API calls.
*
@@ -432,6 +437,19 @@
return extensions;
}
+ static boolean isDevicesParam(final int param_name) {
+ switch ( param_name ) {
+ case CL_CONTEXT_DEVICES:
+ case CL_CURRENT_DEVICE_FOR_GL_CONTEXT_KHR:
+ case CL_DEVICES_FOR_GL_CONTEXT_KHR:
+ case CL_CGL_DEVICE_FOR_CURRENT_VIRTUAL_SCREEN_APPLE:
+ case CL_CGL_DEVICES_FOR_SUPPORTED_VIRTUAL_SCREENS_APPLE:
+ return true;
+ }
+
+ return false;
+ }
+
static CLPlatform getCLPlatform(final PointerBuffer properties) {
long platformID = 0;
@@ -441,7 +459,7 @@
if ( key == 0 )
break;
- if ( key == 0x1084 ) { // CL_CONTEXT_PLATFORM
+ if ( key == CL_CONTEXT_PLATFORM ) {
platformID = properties.get((k << 1) + 1);
break;
}
@@ -452,7 +470,7 @@
final CLPlatform platform = CLPlatform.getCLPlatform(platformID);
if ( platform == null )
- throw new IllegalStateException("Could not find a valid CLPlatform. Make sure clGetPlatformIDs has been used before creating a CLContext.");
+ throw new IllegalStateException("Could not find a valid CLPlatform. Make sure clGetPlatformIDs has been used before.");
return platform;
}
@@ -546,25 +564,25 @@
}
private static final ObjectDestructor<CLDevice> DESTRUCTOR_CLSubDevice = new ObjectDestructor<CLDevice>() {
- public void release(final CLDevice object) { EXTDeviceFission.clReleaseDeviceEXT(object); }
+ public void release(final CLDevice object) { clReleaseDeviceEXT(object); }
};
private static final ObjectDestructor<CLMem> DESTRUCTOR_CLMem = new ObjectDestructor<CLMem>() {
- public void release(final CLMem object) { CL10.clReleaseMemObject(object); }
+ public void release(final CLMem object) { clReleaseMemObject(object); }
};
private static final ObjectDestructor<CLCommandQueue> DESTRUCTOR_CLCommandQueue = new ObjectDestructor<CLCommandQueue>() {
- public void release(final CLCommandQueue object) { CL10.clReleaseCommandQueue(object); }
+ public void release(final CLCommandQueue object) { clReleaseCommandQueue(object); }
};
private static final ObjectDestructor<CLSampler> DESTRUCTOR_CLSampler = new ObjectDestructor<CLSampler>() {
- public void release(final CLSampler object) { CL10.clReleaseSampler(object); }
+ public void release(final CLSampler object) { clReleaseSampler(object); }
};
private static final ObjectDestructor<CLProgram> DESTRUCTOR_CLProgram = new ObjectDestructor<CLProgram>() {
- public void release(final CLProgram object) { CL10.clReleaseProgram(object); }
+ public void release(final CLProgram object) { clReleaseProgram(object); }
};
private static final ObjectDestructor<CLKernel> DESTRUCTOR_CLKernel = new ObjectDestructor<CLKernel>() {
- public void release(final CLKernel object) { CL10.clReleaseKernel(object); }
+ public void release(final CLKernel object) { clReleaseKernel(object); }
};
private static final ObjectDestructor<CLEvent> DESTRUCTOR_CLEvent = new ObjectDestructor<CLEvent>() {
- public void release(final CLEvent object) { CL10.clReleaseEvent(object); }
+ public void release(final CLEvent object) { clReleaseEvent(object); }
};
private interface ObjectDestructor<T extends CLObjectChild> {
Modified: trunk/LWJGL/src/java/org/lwjgl/opencl/CLPlatform.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opencl/CLPlatform.java 2010-09-30 19:04:25 UTC (rev 3421)
+++ trunk/LWJGL/src/java/org/lwjgl/opencl/CLPlatform.java 2010-09-30 23:36:37 UTC (rev 3422)
@@ -210,7 +210,7 @@
for ( int i = 0; i < count; i++ ) {
final long id = devices.get(pos + i);
if ( !clDevices.hasObject(id) )
- new CLDevice(devices.get(pos + i), this);
+ new CLDevice(id, this);
}
}
@@ -226,7 +226,7 @@
final int offset = pos + (i * PointerBuffer.getPointerSize());
final long id = PointerBuffer.is64Bit() ? devices.getLong(offset) : devices.getInt(offset);
if ( !clDevices.hasObject(id) )
- new CLDevice(devices.get(pos + i), this);
+ new CLDevice(id, this);
}
}
Modified: trunk/LWJGL/src/java/org/lwjgl/opencl/InfoUtilFactory.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opencl/InfoUtilFactory.java 2010-09-30 19:04:25 UTC (rev 3421)
+++ trunk/LWJGL/src/java/org/lwjgl/opencl/InfoUtilFactory.java 2010-09-30 23:36:37 UTC (rev 3422)
@@ -96,25 +96,31 @@
}
/** Custom clCreateContext implementation (reuses APIUtil.getBufferPointer) */
- public CLContext create(final CLPlatform platform, final List<CLDevice> devices, final CLContextCallback pfn_notify, final Drawable share_drawable, final IntBuffer errcode_ret) throws LWJGLException {
+ public CLContext create(final CLPlatform platform, final List<CLDevice> devices, final CLContextCallback pfn_notify, final Drawable share_drawable, IntBuffer errcode_ret) throws LWJGLException {
final int propertyCount = 2 + (share_drawable == null ? 0 : 4) + 1;
- final PointerBuffer buffer = APIUtil.getBufferPointer(propertyCount + devices.size());
- buffer.put(CL_CONTEXT_PLATFORM).put(platform);
+ final PointerBuffer properties = APIUtil.getBufferPointer(propertyCount + devices.size());
+ properties.put(CL_CONTEXT_PLATFORM).put(platform);
if ( share_drawable != null )
- share_drawable.setCLSharingProperties(buffer);
- buffer.put(0);
+ share_drawable.setCLSharingProperties(properties);
+ properties.put(0);
- buffer.position(propertyCount); // Make sure we're at the right offset, setCLSharingProperties might not use all 4 positions.
+ properties.position(propertyCount); // Make sure we're at the right offset, setCLSharingProperties might not use all 4 positions.
for ( CLDevice device : devices )
- buffer.put(device);
+ properties.put(device);
final long function_pointer = CLCapabilities.clCreateContext;
BufferChecks.checkFunctionAddress(function_pointer);
+ if ( errcode_ret != null )
+ BufferChecks.checkBuffer(errcode_ret, 1);
+ else if ( LWJGLUtil.DEBUG )
+ errcode_ret = APIUtil.getBufferInt();
final long user_data = pfn_notify == null || pfn_notify.isCustom() ? 0 : CallbackUtil.createGlobalRef(pfn_notify);
CLContext __result = null;
try {
- __result = new CLContext(nclCreateContext(buffer.getBuffer(), 0, devices.size(), buffer.getBuffer(), propertyCount * PointerBuffer.getPointerSize(), pfn_notify == null ? 0 : pfn_notify.getPointer(), user_data, errcode_ret, errcode_ret != null ? errcode_ret.position() : 0, function_pointer), platform);
+ __result = new CLContext(nclCreateContext(properties.getBuffer(), 0, devices.size(), properties.getBuffer(), propertyCount * PointerBuffer.getPointerSize(), pfn_notify == null ? 0 : pfn_notify.getPointer(), user_data, errcode_ret, errcode_ret != null ? errcode_ret.position() : 0, function_pointer), platform);
+ if ( LWJGLUtil.DEBUG )
+ Util.checkCLError(errcode_ret.get(0));
return __result;
} finally {
CallbackUtil.registerCallback(__result, user_data);
@@ -282,7 +288,7 @@
return clGetMemObjectInfo(mem, param_name, param_value, param_value_size_ret);
}
- public CLMem createImage2D(final CLContext context, final long flags, final CLImageFormat image_format, final long image_width, final long image_height, final long image_row_pitch, final Buffer host_ptr, final IntBuffer errcode_ret) {
+ public CLMem createImage2D(final CLContext context, final long flags, final CLImageFormat image_format, final long image_width, final long image_height, final long image_row_pitch, final Buffer host_ptr, IntBuffer errcode_ret) {
final ByteBuffer formatBuffer = APIUtil.getBufferByte(2 * 4);
formatBuffer.putInt(0, image_format.getChannelOrder());
formatBuffer.putInt(4, image_format.getChannelType());
@@ -291,12 +297,18 @@
BufferChecks.checkFunctionAddress(function_pointer);
if ( errcode_ret != null )
BufferChecks.checkBuffer(errcode_ret, 1);
- return new CLMem(nclCreateImage2D(context.getPointer(), flags, formatBuffer, 0, image_width, image_height, image_row_pitch, host_ptr,
- host_ptr != null ? BufferChecks.checkBuffer(host_ptr, CLChecks.calculateImage2DSize(formatBuffer, image_width, image_height, image_row_pitch)) : 0,
- errcode_ret, errcode_ret != null ? errcode_ret.position() : 0, function_pointer), context);
+ else if ( LWJGLUtil.DEBUG )
+ errcode_ret = APIUtil.getBufferInt();
+
+ CLMem __result = new CLMem(nclCreateImage2D(context.getPointer(), flags, formatBuffer, 0, image_width, image_height, image_row_pitch, host_ptr,
+ host_ptr != null ? BufferChecks.checkBuffer(host_ptr, CLChecks.calculateImage2DSize(formatBuffer, image_width, image_height, image_row_pitch)) : 0,
+ errcode_ret, errcode_ret != null ? errcode_ret.position() : 0, function_pointer), context);
+ if ( LWJGLUtil.DEBUG )
+ Util.checkCLError(errcode_ret.get(0));
+ return __result;
}
- public CLMem createImage3D(final CLContext context, final long flags, final CLImageFormat image_format, final long image_width, final long image_height, final long image_depth, final long image_row_pitch, final long image_slice_pitch, final Buffer host_ptr, final IntBuffer errcode_ret) {
+ public CLMem createImage3D(final CLContext context, final long flags, final CLImageFormat image_format, final long image_width, final long image_height, final long image_depth, final long image_row_pitch, final long image_slice_pitch, final Buffer host_ptr, IntBuffer errcode_ret) {
final ByteBuffer formatBuffer = APIUtil.getBufferByte(2 * 4);
formatBuffer.putInt(0, image_format.getChannelOrder());
formatBuffer.putInt(4, image_format.getChannelType());
@@ -305,9 +317,15 @@
BufferChecks.checkFunctionAddress(function_pointer);
if ( errcode_ret != null )
BufferChecks.checkBuffer(errcode_ret, 1);
- return new CLMem(nclCreateImage3D(context.getPointer(), flags, formatBuffer, 0, image_width, image_height, image_depth, image_row_pitch, image_slice_pitch, host_ptr,
- host_ptr != null ? BufferChecks.checkBuffer(host_ptr, CLChecks.calculateImage3DSize(formatBuffer, image_width, image_height, image_depth, image_row_pitch, image_slice_pitch)) : 0,
- errcode_ret, errcode_ret != null ? errcode_ret.position() : 0, function_pointer), context);
+ else if ( LWJGLUtil.DEBUG )
+ errcode_ret = APIUtil.getBufferInt();
+
+ CLMem __result = new CLMem(nclCreateImage3D(context.getPointer(), flags, formatBuffer, 0, image_width, image_height, image_depth, image_row_pitch, image_slice_pitch, host_ptr,
+ host_ptr != null ? BufferChecks.checkBuffer(host_ptr, CLChecks.calculateImage3DSize(formatBuffer, image_width, image_height, image_depth, image_row_pitch, image_slice_pitch)) : 0,
+ errcode_ret, errcode_ret != null ? errcode_ret.position() : 0, function_pointer), context);
+ if ( LWJGLUtil.DEBUG )
+ Util.checkCLError(errcode_ret.get(0));
+ return __result;
}
public CLMem createSubBuffer(final CLMem mem, final long flags, final int buffer_create_type, final CLBufferRegion buffer_create_info, final IntBuffer errcode_ret) {
@@ -317,7 +335,6 @@
infoBuffer.put(buffer_create_info.getSize());
return clCreateSubBuffer(mem, flags, buffer_create_type, infoBuffer.getBuffer(), errcode_ret);
-
}
public ByteBuffer getInfoHostBuffer(final CLMem mem) {
Modified: trunk/LWJGL/src/java/org/lwjgl/test/opencl/HelloOpenCL.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/test/opencl/HelloOpenCL.java 2010-09-30 19:04:25 UTC (rev 3421)
+++ trunk/LWJGL/src/java/org/lwjgl/test/opencl/HelloOpenCL.java 2010-09-30 23:36:37 UTC (rev 3422)
@@ -54,6 +54,9 @@
CL.create();
final List<CLPlatform> platforms = CLPlatform.getPlatforms();
+ if ( platforms == null )
+ throw new RuntimeException("No OpenCL platforms found.");
+
for ( CLPlatform platform : platforms ) {
System.out.println("\n-------------------------");
System.out.println("NEW PLATFORM: " + platform.getPointer());
Modified: trunk/LWJGL/src/templates/org/lwjgl/opencl/APPLE_gl_sharing.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opencl/APPLE_gl_sharing.java 2010-09-30 19:04:25 UTC (rev 3421)
+++ trunk/LWJGL/src/templates/org/lwjgl/opencl/APPLE_gl_sharing.java 2010-09-30 23:36:37 UTC (rev 3422)
@@ -67,6 +67,10 @@
/** Error code returned by clGetGLContextInfoAPPLE if an invalid platform_gl_ctx is provided */
int CL_INVALID_GL_CONTEXT_APPLE = -1000;
+ @Code(
+ javaBeforeNative = "\t\tif ( param_value_size_ret == null && APIUtil.isDevicesParam(param_name) ) param_value_size_ret = APIUtil.getBufferPointer();",
+ javaAfterNative = "\t\tif ( __result == CL_SUCCESS && param_value != null && APIUtil.isDevicesParam(param_name) ) context.getParent().registerCLDevices(param_value, param_value_size_ret);"
+ )
@cl_int
int clGetGLContextInfoAPPLE(@PointerWrapper("cl_context") CLContext context,
@Check("1") @NativeType("cl_void") PointerBuffer platform_gl_ctx,
Modified: trunk/LWJGL/src/templates/org/lwjgl/opencl/CL10.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opencl/CL10.java 2010-09-30 19:04:25 UTC (rev 3421)
+++ trunk/LWJGL/src/templates/org/lwjgl/opencl/CL10.java 2010-09-30 23:36:37 UTC (rev 3422)
@@ -456,8 +456,8 @@
int clReleaseContext(@PointerWrapper("cl_context") CLContext context);
@Code(
- javaBeforeNative = "\t\tif ( param_name == CL_CONTEXT_DEVICES && param_value_size_ret == null ) param_value_size_ret = APIUtil.getBufferPointer();",
- javaAfterNative = "\t\tif ( param_name == CL_CONTEXT_DEVICES && __result == CL_SUCCESS && param_value != null ) context.getParent().registerCLDevices(param_value, param_value_size_ret);"
+ javaBeforeNative = "\t\tif ( param_value_size_ret == null && APIUtil.isDevicesParam(param_name) ) param_value_size_ret = APIUtil.getBufferPointer();",
+ javaAfterNative = "\t\tif ( __result == CL_SUCCESS && param_value != null && APIUtil.isDevicesParam(param_name) ) context.getParent().registerCLDevices(param_value, param_value_size_ret);"
)
@cl_int
int clGetContextInfo(@PointerWrapper("cl_context") CLContext context,
@@ -915,7 +915,7 @@
@cl_int
int clGetProgramInfo2(@PointerWrapper("cl_program") CLProgram program,
@Constant("CL_PROGRAM_BINARIES") @NativeType("cl_program_info") int param_name,
- @Constant("sizes.remaining() * PointerBuffer.getPointerSize()") @size_t long param_value_size,
+ @Constant("sizes.remainingByte()") @size_t long param_value_size,
@Helper(passToNative = true) @Check("1") @Const @NativeType("size_t") PointerBuffer sizes,
@OutParameter @Check("APIUtil.getSize(sizes)") @PointerArray(value = "param_value_size", lengths = "sizes") @NativeType("cl_uchar") ByteBuffer param_value,
@OutParameter @Check(value = "1", canBeNull = true) @NativeType("size_t") PointerBuffer param_value_size_ret);
Modified: trunk/LWJGL/src/templates/org/lwjgl/opencl/KHR_gl_sharing.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opencl/KHR_gl_sharing.java 2010-09-30 19:04:25 UTC (rev 3421)
+++ trunk/LWJGL/src/templates/org/lwjgl/opencl/KHR_gl_sharing.java 2010-09-30 23:36:37 UTC (rev 3422)
@@ -63,6 +63,10 @@
CL_WGL_HDC_KHR = 0x200B,
CL_CGL_SHAREGROUP_KHR = 0x200C;
+ @Code(
+ javaBeforeNative = "\t\tif ( param_value_size_ret == null && APIUtil.isDevicesParam(param_name) ) param_value_size_ret = APIUtil.getBufferPointer();",
+ javaAfterNative = "\t\tif ( __result == CL_SUCCESS && param_value != null && APIUtil.isDevicesParam(param_name) ) APIUtil.getCLPlatform(properties).registerCLDevices(param_value, param_value_size_ret);"
+ )
@cl_int
int clGetGLContextInfoKHR(@NullTerminated @Const @NativeType("cl_context_properties") PointerBuffer properties,
@NativeType("cl_gl_context_info") int param_name,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2010-09-30 19:04:31
|
Revision: 3421
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3421&view=rev
Author: spasi
Date: 2010-09-30 19:04:25 +0000 (Thu, 30 Sep 2010)
Log Message:
-----------
Added NV OpenCL extensions.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/test/opencl/HelloOpenCL.java
trunk/LWJGL/src/templates/org/lwjgl/opencl/KHR_fp16.java
Added Paths:
-----------
trunk/LWJGL/src/templates/org/lwjgl/opencl/NV_compiler_options.java
trunk/LWJGL/src/templates/org/lwjgl/opencl/NV_device_attribute_query.java
trunk/LWJGL/src/templates/org/lwjgl/opencl/NV_pragma_unroll.java
Modified: trunk/LWJGL/src/java/org/lwjgl/test/opencl/HelloOpenCL.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/test/opencl/HelloOpenCL.java 2010-09-30 17:52:16 UTC (rev 3420)
+++ trunk/LWJGL/src/java/org/lwjgl/test/opencl/HelloOpenCL.java 2010-09-30 19:04:25 UTC (rev 3421)
@@ -94,6 +94,7 @@
printDeviceInfo(device, "CL_DRIVER_VERSION", CL_DRIVER_VERSION);
printDeviceInfo(device, "CL_DEVICE_PROFILE", CL_DEVICE_PROFILE);
printDeviceInfo(device, "CL_DEVICE_VERSION", CL_DEVICE_VERSION);
+ printDeviceInfo(device, "CL_DEVICE_EXTENSIONS", CL_DEVICE_EXTENSIONS);
if ( caps.OpenCL11 )
printDeviceInfo(device, "CL_DEVICE_OPENCL_C_VERSION", CL_DEVICE_OPENCL_C_VERSION);
Modified: trunk/LWJGL/src/templates/org/lwjgl/opencl/KHR_fp16.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opencl/KHR_fp16.java 2010-09-30 17:52:16 UTC (rev 3420)
+++ trunk/LWJGL/src/templates/org/lwjgl/opencl/KHR_fp16.java 2010-09-30 19:04:25 UTC (rev 3421)
@@ -36,4 +36,7 @@
@CLDeviceExtension
public interface KHR_fp16 {
+ /** cl_device_info */
+ int CL_DEVICE_HALF_FP_CONFIG = 0x1033;
+
}
\ No newline at end of file
Added: trunk/LWJGL/src/templates/org/lwjgl/opencl/NV_compiler_options.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opencl/NV_compiler_options.java (rev 0)
+++ trunk/LWJGL/src/templates/org/lwjgl/opencl/NV_compiler_options.java 2010-09-30 19:04:25 UTC (rev 3421)
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2002-2010 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opencl;
+
+import org.lwjgl.util.generator.opencl.CLDeviceExtension;
+
+@CLDeviceExtension
+public interface NV_compiler_options {
+
+}
\ No newline at end of file
Added: trunk/LWJGL/src/templates/org/lwjgl/opencl/NV_device_attribute_query.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opencl/NV_device_attribute_query.java (rev 0)
+++ trunk/LWJGL/src/templates/org/lwjgl/opencl/NV_device_attribute_query.java 2010-09-30 19:04:25 UTC (rev 3421)
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2002-2010 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opencl;
+
+import org.lwjgl.util.generator.opencl.CLDeviceExtension;
+
+@CLDeviceExtension
+public interface NV_device_attribute_query {
+
+ /** Accepted as the <param_name> parameter of clGetDeviceInfo. */
+ int CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV = 0x4000,
+ CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV = 0x4001,
+ CL_DEVICE_REGISTERS_PER_BLOCK_NV = 0x4002,
+ CL_DEVICE_WARP_SIZE_NV = 0x4003,
+ CL_DEVICE_GPU_OVERLAP_NV = 0x4004,
+ CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV = 0x4005,
+ CL_DEVICE_INTEGRATED_MEMORY_NV = 0x4006;
+
+}
\ No newline at end of file
Added: trunk/LWJGL/src/templates/org/lwjgl/opencl/NV_pragma_unroll.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opencl/NV_pragma_unroll.java (rev 0)
+++ trunk/LWJGL/src/templates/org/lwjgl/opencl/NV_pragma_unroll.java 2010-09-30 19:04:25 UTC (rev 3421)
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2002-2010 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opencl;
+
+import org.lwjgl.util.generator.opencl.CLDeviceExtension;
+
+@CLDeviceExtension
+public interface NV_pragma_unroll {
+
+}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2010-09-30 17:52:22
|
Revision: 3420
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3420&view=rev
Author: spasi
Date: 2010-09-30 17:52:16 +0000 (Thu, 30 Sep 2010)
Log Message:
-----------
Added checks for CL 1.1 stuff.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/test/opencl/HelloOpenCL.java
Modified: trunk/LWJGL/src/java/org/lwjgl/test/opencl/HelloOpenCL.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/test/opencl/HelloOpenCL.java 2010-09-30 17:21:50 UTC (rev 3419)
+++ trunk/LWJGL/src/java/org/lwjgl/test/opencl/HelloOpenCL.java 2010-09-30 17:52:16 UTC (rev 3420)
@@ -35,6 +35,7 @@
import org.lwjgl.LWJGLException;
import org.lwjgl.PointerBuffer;
import org.lwjgl.opencl.*;
+import org.lwjgl.opencl.api.CLBufferRegion;
import java.nio.ByteBuffer;
import java.util.List;
@@ -70,8 +71,10 @@
final List<CLDevice> devices = platform.getDevices(CL_DEVICE_TYPE_ALL);
for ( CLDevice device : devices ) {
+ final CLDeviceCapabilities caps = CLCapabilities.getDeviceCapabilities(device);
+
System.out.println("\n\tNEW DEVICE: " + device.getPointer());
- System.out.println(CLCapabilities.getDeviceCapabilities(device));
+ System.out.println(caps);
System.out.println("\t-------------------------");
System.out.println("\tCL_DEVICE_TYPE = " + device.getInfoInt(CL_DEVICE_TYPE));
@@ -91,7 +94,8 @@
printDeviceInfo(device, "CL_DRIVER_VERSION", CL_DRIVER_VERSION);
printDeviceInfo(device, "CL_DEVICE_PROFILE", CL_DEVICE_PROFILE);
printDeviceInfo(device, "CL_DEVICE_VERSION", CL_DEVICE_VERSION);
- printDeviceInfo(device, "CL_DEVICE_OPENCL_C_VERSION", CL_DEVICE_OPENCL_C_VERSION);
+ if ( caps.OpenCL11 )
+ printDeviceInfo(device, "CL_DEVICE_OPENCL_C_VERSION", CL_DEVICE_OPENCL_C_VERSION);
CLContext context = clCreateContext(ctxProps, device, new CLContextCallback() {
protected void handleMessage(final String errinfo, final ByteBuffer private_info) {
@@ -101,29 +105,29 @@
CLMem buffer = clCreateBuffer(context, CL_MEM_READ_ONLY, 128, null);
- clSetMemObjectDestructorCallback(buffer, new CLMemObjectDestructorCallback() {
- protected void handleMessage(final long memobj) {
- System.out.println("FIRST Buffer destructed: " + memobj);
- }
- });
+ if ( caps.OpenCL11 ) {
+ clSetMemObjectDestructorCallback(buffer, new CLMemObjectDestructorCallback() {
+ protected void handleMessage(final long memobj) {
+ System.out.println("FIRST Buffer destructed: " + memobj);
+ }
+ });
- clSetMemObjectDestructorCallback(buffer, new CLMemObjectDestructorCallback() {
- protected void handleMessage(final long memobj) {
- System.out.println("SECOND Buffer destructed: " + memobj);
- }
- });
+ clSetMemObjectDestructorCallback(buffer, new CLMemObjectDestructorCallback() {
+ protected void handleMessage(final long memobj) {
+ System.out.println("SECOND Buffer destructed: " + memobj);
+ }
+ });
+ }
- ByteBuffer bufferCreateInfo = BufferUtils.createByteBuffer(2 * PointerBuffer.getPointerSize());
- PointerBuffer.put(bufferCreateInfo, 0);
- PointerBuffer.put(bufferCreateInfo, 64);
- bufferCreateInfo.flip();
- CLMem subbuffer = clCreateSubBuffer(buffer, CL10.CL_MEM_READ_ONLY, CL11.CL_BUFFER_CREATE_TYPE_REGION, bufferCreateInfo, null);
+ if ( caps.OpenCL11 ) {
+ CLMem subbuffer = buffer.createSubBuffer(CL_MEM_READ_ONLY, CL_BUFFER_CREATE_TYPE_REGION, new CLBufferRegion(0, 64), null);
- clSetMemObjectDestructorCallback(subbuffer, new CLMemObjectDestructorCallback() {
- protected void handleMessage(final long memobj) {
- System.out.println("Sub Buffer destructed: " + memobj);
- }
- });
+ clSetMemObjectDestructorCallback(subbuffer, new CLMemObjectDestructorCallback() {
+ protected void handleMessage(final long memobj) {
+ System.out.println("Sub Buffer destructed: " + memobj);
+ }
+ });
+ }
clRetainMemObject(buffer);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2010-09-30 17:21:59
|
Revision: 3419
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3419&view=rev
Author: spasi
Date: 2010-09-30 17:21:50 +0000 (Thu, 30 Sep 2010)
Log Message:
-----------
Misc GL/CL fixes and additions.
Made native calls package private, we can now use them from the high-level API.
Added support for "render-to-texture" in the fractal demo.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/BufferChecks.java
trunk/LWJGL/src/java/org/lwjgl/LWJGLUtil.java
trunk/LWJGL/src/java/org/lwjgl/PointerWrapperAbstract.java
trunk/LWJGL/src/java/org/lwjgl/opencl/APIUtil.java
trunk/LWJGL/src/java/org/lwjgl/opencl/CLChecks.java
trunk/LWJGL/src/java/org/lwjgl/opencl/CLContext.java
trunk/LWJGL/src/java/org/lwjgl/opencl/CLMem.java
trunk/LWJGL/src/java/org/lwjgl/opencl/CLProgram.java
trunk/LWJGL/src/java/org/lwjgl/opencl/InfoUtilAbstract.java
trunk/LWJGL/src/java/org/lwjgl/opencl/InfoUtilFactory.java
trunk/LWJGL/src/java/org/lwjgl/opencl/Util.java
trunk/LWJGL/src/java/org/lwjgl/test/opencl/gl/DemoFractal.java
trunk/LWJGL/src/java/org/lwjgl/test/opencl/gl/Mandelbrot.cl
trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_direct_state_access.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/GL40.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_half_float.java
Added Paths:
-----------
trunk/LWJGL/src/java/org/lwjgl/opencl/api/CLBufferRegion.java
trunk/LWJGL/src/java/org/lwjgl/opencl/api/CLImageFormat.java
Modified: trunk/LWJGL/src/java/org/lwjgl/BufferChecks.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/BufferChecks.java 2010-09-28 21:11:35 UTC (rev 3418)
+++ trunk/LWJGL/src/java/org/lwjgl/BufferChecks.java 2010-09-30 17:21:50 UTC (rev 3419)
@@ -31,13 +31,7 @@
*/
package org.lwjgl;
-import java.nio.Buffer;
-import java.nio.ByteBuffer;
-import java.nio.DoubleBuffer;
-import java.nio.FloatBuffer;
-import java.nio.IntBuffer;
-import java.nio.ShortBuffer;
-import java.nio.LongBuffer;
+import java.nio.*;
/**
* <p>A class to check buffer boundaries in general. If there is unsufficient space
@@ -89,21 +83,21 @@
/** Helper method to ensure an IntBuffer is null-terminated */
public static void checkNullTerminated(IntBuffer buf) {
- if ( buf.get(buf.limit() - 1) != 0 ) {
+ if ( LWJGLUtil.CHECKS && buf.get(buf.limit() - 1) != 0 ) {
throw new IllegalArgumentException("Missing null termination");
}
}
/** Helper method to ensure a LongBuffer is null-terminated */
public static void checkNullTerminated(LongBuffer buf) {
- if ( buf.get(buf.limit() - 1) != 0 ) {
+ if ( LWJGLUtil.CHECKS && buf.get(buf.limit() - 1) != 0 ) {
throw new IllegalArgumentException("Missing null termination");
}
}
/** Helper method to ensure a PointerBuffer is null-terminated */
public static void checkNullTerminated(PointerBuffer buf) {
- if ( buf.get(buf.limit() - 1) != 0 ) {
+ if ( LWJGLUtil.CHECKS && buf.get(buf.limit() - 1) != 0 ) {
throw new IllegalArgumentException("Missing null termination");
}
}
@@ -196,6 +190,41 @@
}
}
+ /**
+ * Detects the buffer type and performs the corresponding check
+ * and also returns the buffer position in bytes.
+ *
+ * @param buffer the buffer to check
+ * @param size the size to check
+ *
+ * @return the buffer position in bytes
+ */
+ public static int checkBuffer(final Buffer buffer, final int size) {
+ final int posShift;
+ if ( buffer instanceof ByteBuffer ) {
+ BufferChecks.checkBuffer((ByteBuffer)buffer, size);
+ posShift = 0;
+ } else if ( buffer instanceof ShortBuffer ) {
+ BufferChecks.checkBuffer((ShortBuffer)buffer, size);
+ posShift = 1;
+ } else if ( buffer instanceof IntBuffer ) {
+ BufferChecks.checkBuffer((IntBuffer)buffer, size);
+ posShift = 2;
+ } else if ( buffer instanceof LongBuffer ) {
+ BufferChecks.checkBuffer((LongBuffer)buffer, size);
+ posShift = 4;
+ } else if ( buffer instanceof FloatBuffer ) {
+ BufferChecks.checkBuffer((FloatBuffer)buffer, size);
+ posShift = 2;
+ } else if ( buffer instanceof DoubleBuffer ) {
+ BufferChecks.checkBuffer((DoubleBuffer)buffer, size);
+ posShift = 4;
+ } else
+ throw new IllegalArgumentException("Unsupported Buffer type specified: " + buffer.getClass());
+
+ return buffer.position() << posShift;
+ }
+
public static void checkBuffer(ByteBuffer buf, int size) {
if ( LWJGLUtil.CHECKS ) {
checkBufferSize(buf, size);
Modified: trunk/LWJGL/src/java/org/lwjgl/LWJGLUtil.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/LWJGLUtil.java 2010-09-28 21:11:35 UTC (rev 3418)
+++ trunk/LWJGL/src/java/org/lwjgl/LWJGLUtil.java 2010-09-30 17:21:50 UTC (rev 3419)
@@ -32,17 +32,16 @@
package org.lwjgl;
import java.io.File;
+import java.lang.reflect.Field;
import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
import java.nio.ByteBuffer;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.StringTokenizer;
+import java.util.*;
-
/**
* <p>
* Internal library methods
@@ -488,4 +487,92 @@
return major > major_required || (major == major_required && minor >= minor_required);
}
-}
+ /**
+ * Returns a map of public static final integer fields in the specified classes, to their String representations.
+ * An optional filter can be specified to only include specific fields. The target map may be null, in which
+ * case a new map is allocated and returned.
+ * <p>
+ * This method is useful when debugging to quickly identify values returned from the AL/GL/CL APIs.
+ *
+ * @param filter the filter to use (optional)
+ * @param target the target map (optional)
+ * @param tokenClasses an array of classes to get tokens from
+ *
+ * @return the token map
+ */
+
+ public static Map<Integer, String> getClassTokens(final TokenFilter filter, final Map<Integer, String> target, final Class ... tokenClasses) {
+ return getClassTokens(filter, target, Arrays.asList(tokenClasses));
+ }
+
+ /**
+ * Returns a map of public static final integer fields in the specified classes, to their String representations.
+ * An optional filter can be specified to only include specific fields. The target map may be null, in which
+ * case a new map is allocated and returned.
+ * <p>
+ * This method is useful when debugging to quickly identify values returned from the AL/GL/CL APIs.
+ *
+ * @param filter the filter to use (optional)
+ * @param target the target map (optional)
+ * @param tokenClasses the classes to get tokens from
+ *
+ * @return the token map
+ */
+ public static Map<Integer, String> getClassTokens(final TokenFilter filter, Map<Integer, String> target, final Iterable<Class> tokenClasses) {
+ if ( target == null )
+ target = new HashMap<Integer, String>();
+
+ final int TOKEN_MODIFIERS = Modifier.PUBLIC | Modifier.STATIC | Modifier.FINAL;
+
+ for ( final Class tokenClass : tokenClasses ) {
+ for ( final Field field : tokenClass.getDeclaredFields() ) {
+ // Get only <public static final int> fields.
+ if ( (field.getModifiers() & TOKEN_MODIFIERS) == TOKEN_MODIFIERS && field.getType() == int.class ) {
+ try {
+ final int value = field.getInt(null);
+ if ( filter != null && !filter.accept(field, value) )
+ continue;
+
+ if ( target.containsKey(value) ) // Print colliding tokens in their hex representation.
+ target.put(value, toHexString(value));
+ else
+ target.put(value, field.getName());
+ } catch (IllegalAccessException e) {
+ // Ignore
+ }
+ }
+ }
+ }
+
+ return target;
+ }
+
+ /**
+ * Returns a string representation of the integer argument as an
+ * unsigned integer in base 16. The string will be uppercase
+ * and will have a leading '0x'.
+ *
+ * @param value the integer value
+ *
+ * @return the hex string representation
+ */
+ public static String toHexString(final int value) {
+ return "0x" + Integer.toHexString(value).toUpperCase();
+ }
+
+ /** Simple interface for Field filtering. */
+ public interface TokenFilter {
+
+ /**
+ * Should return true if the specified Field passes the filter.
+ *
+ * @param field the Field to test
+ * @param value the integer value of the field
+ *
+ * @result true if the Field is accepted
+ */
+ boolean accept(Field field, int value);
+
+ }
+
+}
\ No newline at end of file
Modified: trunk/LWJGL/src/java/org/lwjgl/PointerWrapperAbstract.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/PointerWrapperAbstract.java 2010-09-28 21:11:35 UTC (rev 3418)
+++ trunk/LWJGL/src/java/org/lwjgl/PointerWrapperAbstract.java 2010-09-30 17:21:50 UTC (rev 3419)
@@ -63,7 +63,7 @@
*/
public final void checkValid() {
if ( LWJGLUtil.DEBUG && !isValid() )
- throw new IllegalStateException("This pointer is not valid.");
+ throw new IllegalStateException("This " + getClass().getSimpleName() + " pointer is not valid.");
}
public final long getPointer() {
Modified: trunk/LWJGL/src/java/org/lwjgl/opencl/APIUtil.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opencl/APIUtil.java 2010-09-28 21:11:35 UTC (rev 3418)
+++ trunk/LWJGL/src/java/org/lwjgl/opencl/APIUtil.java 2010-09-30 17:21:50 UTC (rev 3419)
@@ -35,18 +35,15 @@
import org.lwjgl.LWJGLUtil;
import org.lwjgl.PointerBuffer;
-import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
import java.nio.*;
import java.nio.charset.Charset;
import java.nio.charset.CharsetEncoder;
-import java.util.*;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.StringTokenizer;
-import static org.lwjgl.opencl.CL10.*;
-
/**
* Utility class for OpenCL API calls.
- * TODO: Remove useless stuff
*
* @author spasi
*/
@@ -356,38 +353,6 @@
return (int)size;
}
- static String toHexString(final int value) {
- return "0x" + Integer.toHexString(value).toUpperCase();
- }
-
- static void getClassTokens(final Class[] tokenClasses, final Map<Integer, String> target, final TokenFilter filter) {
- getClassTokens(Arrays.asList(tokenClasses), target, filter);
- }
-
- static void getClassTokens(final Iterable<Class> tokenClasses, final Map<Integer, String> target, final TokenFilter filter) {
- final int TOKEN_MODIFIERS = Modifier.PUBLIC | Modifier.STATIC | Modifier.FINAL;
-
- for ( final Class tokenClass : tokenClasses ) {
- for ( final Field field : tokenClass.getDeclaredFields() ) {
- // Get only <public static final int> fields.
- if ( (field.getModifiers() & TOKEN_MODIFIERS) == TOKEN_MODIFIERS && field.getType() == int.class ) {
- try {
- final int value = field.getInt(null);
- if ( filter != null && !filter.accept(field, value) )
- continue;
-
- if ( target.containsKey(value) ) // Print colliding tokens in their hex representation.
- target.put(value, toHexString(value));
- else
- target.put(value, field.getName());
- } catch (IllegalAccessException e) {
- // Ignore
- }
- }
- }
- }
- }
-
/**
* A mutable CharSequence with very large initial length. We can wrap this in a re-usable CharBuffer for decoding.
* We cannot subclass CharBuffer because of {@link java.nio.CharBuffer#toString(int,int)}.
@@ -451,14 +416,6 @@
}
- /** Simple interface for Field filtering */
- interface TokenFilter {
-
- /** Should return true if the specified Field passes the filter. */
- boolean accept(Field field, int value);
-
- }
-
/* ------------------------------------------------------------------------
---------------------------------------------------------------------------
OPENCL API UTILITIES BELOW
Modified: trunk/LWJGL/src/java/org/lwjgl/opencl/CLChecks.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opencl/CLChecks.java 2010-09-28 21:11:35 UTC (rev 3418)
+++ trunk/LWJGL/src/java/org/lwjgl/opencl/CLChecks.java 2010-09-30 17:21:50 UTC (rev 3419)
@@ -68,24 +68,24 @@
final long y = origin.get(1);
final long z = origin.get(2);
- if ( x < 0 || y < 0 || z < 0 )
+ if ( LWJGLUtil.DEBUG && (x < 0 || y < 0 || z < 0) )
throw new IllegalArgumentException("Invalid cl_mem host origin: " + x + ", " + y + ", " + z);
final long w = region.get(0);
final long h = region.get(1);
final long d = region.get(2);
- if ( w < 1 || h < 1 || d < 1 )
+ if ( LWJGLUtil.DEBUG && (w < 1 || h < 1 || d < 1) )
throw new IllegalArgumentException("Invalid cl_mem rectangle region dimensions: " + w + " x " + h + " x " + d);
if ( row_pitch == 0 )
row_pitch = w;
- else if ( row_pitch < w )
+ else if ( LWJGLUtil.DEBUG && row_pitch < w )
throw new IllegalArgumentException("Invalid host row pitch specified: " + row_pitch);
if ( slice_pitch == 0 )
slice_pitch = row_pitch * h;
- else if ( slice_pitch < (row_pitch * h) )
+ else if ( LWJGLUtil.DEBUG && slice_pitch < (row_pitch * h) )
throw new IllegalArgumentException("Invalid host slice pitch specified: " + slice_pitch);
return (int)((z * slice_pitch + y * row_pitch + x) + (w * h * d));
@@ -110,17 +110,17 @@
final long h = region.get(1);
final long d = region.get(2);
- if ( w < 1 || h < 1 || d < 1 )
+ if ( LWJGLUtil.DEBUG && (w < 1 || h < 1 || d < 1) )
throw new IllegalArgumentException("Invalid cl_mem image region dimensions: " + w + " x " + h + " x " + d);
if ( row_pitch == 0 )
row_pitch = w;
- else if ( row_pitch < w )
+ else if ( LWJGLUtil.DEBUG && row_pitch < w )
throw new IllegalArgumentException("Invalid row pitch specified: " + row_pitch);
if ( slice_pitch == 0 )
slice_pitch = row_pitch * h;
- else if ( slice_pitch < (row_pitch * h) )
+ else if ( LWJGLUtil.DEBUG && slice_pitch < (row_pitch * h) )
throw new IllegalArgumentException("Invalid slice pitch specified: " + slice_pitch);
return (int)(slice_pitch * d);
@@ -138,14 +138,17 @@
* @return the 2D image size in bytes
*/
static int calculateImage2DSize(final ByteBuffer format, final long w, final long h, long row_pitch) {
- if ( LWJGLUtil.CHECKS && (w < 1 || h < 1) )
+ if ( !LWJGLUtil.CHECKS )
+ return 0;
+
+ if ( LWJGLUtil.DEBUG && (w < 1 || h < 1) )
throw new IllegalArgumentException("Invalid 2D image dimensions: " + w + " x " + h);
final int elementSize = getElementSize(format);
if ( row_pitch == 0 )
row_pitch = w * elementSize;
- else if ( LWJGLUtil.CHECKS && ((row_pitch < w * elementSize) || (row_pitch % elementSize != 0)) )
+ else if ( LWJGLUtil.DEBUG && ((row_pitch < w * elementSize) || (row_pitch % elementSize != 0)) )
throw new IllegalArgumentException("Invalid image_row_pitch specified: " + row_pitch);
return (int)(row_pitch * h);
@@ -164,19 +167,22 @@
* @return the 3D image size in bytes
*/
static int calculateImage3DSize(final ByteBuffer format, final long w, final long h, final long d, long row_pitch, long slice_pitch) {
- if ( LWJGLUtil.CHECKS && (w < 1 || h < 1 || d < 2) )
+ if ( !LWJGLUtil.CHECKS )
+ return 0;
+
+ if ( LWJGLUtil.DEBUG && (w < 1 || h < 1 || d < 2) )
throw new IllegalArgumentException("Invalid 3D image dimensions: " + w + " x " + h + " x " + d);
final int elementSize = getElementSize(format);
if ( row_pitch == 0 )
row_pitch = w * elementSize;
- else if ( LWJGLUtil.CHECKS && ((row_pitch < w * elementSize) || (row_pitch % elementSize != 0)) )
+ else if ( LWJGLUtil.DEBUG && ((row_pitch < w * elementSize) || (row_pitch % elementSize != 0)) )
throw new IllegalArgumentException("Invalid image_row_pitch specified: " + row_pitch);
if ( slice_pitch == 0 )
slice_pitch = row_pitch * h;
- else if ( LWJGLUtil.CHECKS && ((row_pitch < row_pitch * h) || (slice_pitch % row_pitch != 0)) )
+ else if ( LWJGLUtil.DEBUG && ((row_pitch < row_pitch * h) || (slice_pitch % row_pitch != 0)) )
throw new IllegalArgumentException("Invalid image_slice_pitch specified: " + row_pitch);
return (int)(slice_pitch * d);
@@ -223,7 +229,7 @@
case CL_ARGB:
return 4;
default:
- throw new IllegalArgumentException("Invalid cl_channel_order specified: " + APIUtil.toHexString(channelOrder));
+ throw new IllegalArgumentException("Invalid cl_channel_order specified: " + LWJGLUtil.toHexString(channelOrder));
}
}
@@ -255,7 +261,7 @@
case CL_FLOAT:
return 4;
default:
- throw new IllegalArgumentException("Invalid cl_channel_type specified: " + APIUtil.toHexString(channelType));
+ throw new IllegalArgumentException("Invalid cl_channel_type specified: " + LWJGLUtil.toHexString(channelType));
}
}
Modified: trunk/LWJGL/src/java/org/lwjgl/opencl/CLContext.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opencl/CLContext.java 2010-09-28 21:11:35 UTC (rev 3418)
+++ trunk/LWJGL/src/java/org/lwjgl/opencl/CLContext.java 2010-09-30 17:21:50 UTC (rev 3419)
@@ -31,6 +31,12 @@
*/
package org.lwjgl.opencl;
+import org.lwjgl.LWJGLException;
+import org.lwjgl.opencl.api.CLImageFormat;
+import org.lwjgl.opencl.api.Filter;
+import org.lwjgl.opengl.Drawable;
+
+import java.nio.IntBuffer;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -125,6 +131,100 @@
// ---------------[ UTILITY METHODS ]---------------
/**
+ * Creates a new CLContext.
+ *
+ * @param platform the platform to use
+ * @param devices the devices to use
+ * @param errcode_ret the error code result
+ *
+ * @return the new CLContext
+ *
+ * @throws LWJGLException if an exception occurs while creating the context
+ */
+ public static CLContext create(final CLPlatform platform, final List<CLDevice> devices, final IntBuffer errcode_ret) throws LWJGLException {
+ return create(platform, devices, null, null, errcode_ret);
+ }
+
+ /**
+ * Creates a new CLContext.
+ *
+ * @param platform the platform to use
+ * @param devices the devices to use
+ * @param pfn_notify the context callback function
+ * @param errcode_ret the error code result
+ *
+ * @return the new CLContext
+ *
+ * @throws LWJGLException if an exception occurs while creating the context
+ */
+ public static CLContext create(final CLPlatform platform, final List<CLDevice> devices, final CLContextCallback pfn_notify, final IntBuffer errcode_ret) throws LWJGLException {
+ return create(platform, devices, pfn_notify, null, errcode_ret);
+ }
+
+ /**
+ * Creates a new CLContext.
+ *
+ * @param platform the platform to use
+ * @param devices the devices to use
+ * @param share_drawable the OpenGL drawable to share objects with
+ * @param errcode_ret the error code result
+ *
+ * @return the new CLContext
+ *
+ * @throws LWJGLException if an exception occurs while creating the context
+ */
+ public static CLContext create(final CLPlatform platform, final List<CLDevice> devices, final CLContextCallback pfn_notify, final Drawable share_drawable, final IntBuffer errcode_ret) throws LWJGLException {
+ return util.create(platform, devices, pfn_notify, share_drawable, errcode_ret);
+ }
+
+ /**
+ * Creates a new CLContext.
+ *
+ * @param platform the platform to use
+ * @param device_type the device type to use
+ * @param errcode_ret the error code result
+ *
+ * @return the new CLContext
+ *
+ * @throws LWJGLException if an exception occurs while creating the context
+ */
+ public static CLContext createFromType(final CLPlatform platform, final long device_type, final IntBuffer errcode_ret) throws LWJGLException {
+ return util.createFromType(platform, device_type, null, null, errcode_ret);
+ }
+
+ /**
+ * Creates a new CLContext.
+ *
+ * @param platform the platform to use
+ * @param device_type the device type to use
+ * @param pfn_notify the context callback function
+ * @param errcode_ret the error code result
+ *
+ * @return the new CLContext
+ *
+ * @throws LWJGLException if an exception occurs while creating the context
+ */
+ public static CLContext createFromType(final CLPlatform platform, final long device_type, final CLContextCallback pfn_notify, final IntBuffer errcode_ret) throws LWJGLException {
+ return util.createFromType(platform, device_type, pfn_notify, null, errcode_ret);
+ }
+
+ /**
+ * Creates a new CLContext.
+ *
+ * @param platform the platform to use
+ * @param device_type the device type to use
+ * @param share_drawable the OpenGL drawable to share objects with
+ * @param errcode_ret the error code result
+ *
+ * @return the new CLContext
+ *
+ * @throws LWJGLException if an exception occurs while creating the context
+ */
+ public static CLContext createFromType(final CLPlatform platform, final long device_type, final CLContextCallback pfn_notify, final Drawable share_drawable, final IntBuffer errcode_ret) throws LWJGLException {
+ return util.createFromType(platform, device_type, pfn_notify, share_drawable, errcode_ret);
+ }
+
+ /**
* Returns the integer value of the specified parameter.
*
* @param param_name the parameter
@@ -144,11 +244,25 @@
return util.getInfoDevices(this);
}
+ public List<CLImageFormat> getSupportedImageFormats(final long flags, final int image_type) {
+ return getSupportedImageFormats(flags, image_type, null);
+ }
+
+ public List<CLImageFormat> getSupportedImageFormats(final long flags, final int image_type, final Filter<CLImageFormat> filter) {
+ return util.getSupportedImageFormats(this, flags, image_type, filter);
+ }
+
/** CLContext utility methods interface. */
interface CLContextUtil extends InfoUtil<CLContext> {
List<CLDevice> getInfoDevices(CLContext context);
+ CLContext create(CLPlatform platform, List<CLDevice> devices, CLContextCallback pfn_notify, Drawable share_drawable, IntBuffer errcode_ret) throws LWJGLException;
+
+ CLContext createFromType(CLPlatform platform, long device_type, CLContextCallback pfn_notify, Drawable share_drawable, IntBuffer errcode_ret) throws LWJGLException;
+
+ List<CLImageFormat> getSupportedImageFormats(CLContext context, final long flags, final int image_type, Filter<CLImageFormat> filter);
+
}
// -------[ IMPLEMENTATION STUFF BELOW ]-------
Modified: trunk/LWJGL/src/java/org/lwjgl/opencl/CLMem.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opencl/CLMem.java 2010-09-28 21:11:35 UTC (rev 3418)
+++ trunk/LWJGL/src/java/org/lwjgl/opencl/CLMem.java 2010-09-30 17:21:50 UTC (rev 3419)
@@ -31,7 +31,12 @@
*/
package org.lwjgl.opencl;
+import org.lwjgl.opencl.api.CLBufferRegion;
+import org.lwjgl.opencl.api.CLImageFormat;
+
+import java.nio.Buffer;
import java.nio.ByteBuffer;
+import java.nio.IntBuffer;
/**
* This class is a wrapper around a cl_mem pointer.
@@ -51,6 +56,52 @@
// ---------------[ UTILITY METHODS ]---------------
/**
+ * Creates a new 2D image object.
+ *
+ * @param context the context on which to create the image object
+ * @param flags the memory object flags
+ * @param image_format the image format
+ * @param image_width the image width
+ * @param image_height the image height
+ * @param image_row_pitch the image row pitch
+ * @param host_ptr the host buffer from which to read image data (optional)
+ * @param errcode_ret the error code result
+ *
+ * @return the new CLMem object
+ */
+ public static CLMem createImage2D(final CLContext context, final long flags, final CLImageFormat image_format,
+ final long image_width, final long image_height, final long image_row_pitch,
+ final Buffer host_ptr, final IntBuffer errcode_ret) {
+ return util.createImage2D(context, flags, image_format, image_width, image_height, image_row_pitch, host_ptr, errcode_ret);
+ }
+
+ /**
+ * Creates a new 3D image object.
+ *
+ * @param context the context on which to create the image object
+ * @param flags the memory object flags
+ * @param image_format the image format
+ * @param image_width the image width
+ * @param image_height the image height
+ * @param image_depth the image depth
+ * @param image_row_pitch the image row pitch
+ * @param image_slice_pitch the image slice pitch
+ * @param host_ptr the host buffer from which to read image data (optional)
+ * @param errcode_ret the error code result
+ *
+ * @return the new CLMem object
+ */
+ public static CLMem createImage3D(final CLContext context, final long flags, final CLImageFormat image_format,
+ final long image_width, final long image_height, final long image_depth, final long image_row_pitch, final long image_slice_pitch,
+ final Buffer host_ptr, final IntBuffer errcode_ret) {
+ return util.createImage3D(context, flags, image_format, image_width, image_height, image_depth, image_row_pitch, image_slice_pitch, host_ptr, errcode_ret);
+ }
+
+ public CLMem createSubBuffer(final long flags, final int buffer_create_type, final CLBufferRegion buffer_create_info, final IntBuffer errcode_ret) {
+ return util.createSubBuffer(this, flags, buffer_create_type, buffer_create_info, errcode_ret);
+ }
+
+ /**
* Returns the integer value of the specified parameter.
*
* @param param_name the parameter
@@ -109,6 +160,15 @@
}
/**
+ * Returns the image format. Applicable to image objects only.
+ *
+ * @return the parameter value
+ */
+ public CLImageFormat getImageFormat() {
+ return util.getImageInfoFormat(this);
+ }
+
+ /**
* Returns the image channel order. Applicable to image objects only.
*
* @return the parameter value
@@ -165,10 +225,18 @@
/** CLMem utility methods interface. */
interface CLMemUtil extends InfoUtil<CLMem> {
+ CLMem createImage2D(CLContext context, long flags, CLImageFormat image_format, long image_width, long image_height, long image_row_pitch, Buffer host_ptr, IntBuffer errcode_ret);
+
+ CLMem createImage3D(CLContext context, long flags, CLImageFormat image_format, long image_width, long image_height, long image_depth, long image_row_pitch, long image_slice_pitch, Buffer host_ptr, IntBuffer errcode_ret);
+
+ CLMem createSubBuffer(CLMem mem, long flags, int buffer_create_type, CLBufferRegion buffer_create_info, IntBuffer errcode_ret);
+
ByteBuffer getInfoHostBuffer(CLMem mem);
long getImageInfoSize(CLMem mem, int param_name);
+ CLImageFormat getImageInfoFormat(CLMem mem);
+
int getImageInfoFormat(CLMem mem, int index);
int getGLObjectType(CLMem mem);
Modified: trunk/LWJGL/src/java/org/lwjgl/opencl/CLProgram.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opencl/CLProgram.java 2010-09-28 21:11:35 UTC (rev 3418)
+++ trunk/LWJGL/src/java/org/lwjgl/opencl/CLProgram.java 2010-09-30 17:21:50 UTC (rev 3419)
@@ -70,6 +70,15 @@
// ---------------[ UTILITY METHODS ]---------------
/**
+ * Creates kernel objects for all kernels functions in this program.
+ *
+ * @return a CLKernel array
+ */
+ public CLKernel[] createKernelsInProgram() {
+ return util.createKernelsInProgram(this);
+ }
+
+ /**
* Returns the String value of the specified parameter.
*
* @param param_name the parameter
@@ -168,6 +177,8 @@
/** CLProgram utility methods interface. */
interface CLProgramUtil extends InfoUtil<CLProgram> {
+ CLKernel[] createKernelsInProgram(CLProgram program);
+
CLDevice[] getInfoDevices(CLProgram program);
ByteBuffer getInfoBinaries(CLProgram program, ByteBuffer target);
Modified: trunk/LWJGL/src/java/org/lwjgl/opencl/InfoUtilAbstract.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opencl/InfoUtilAbstract.java 2010-09-28 21:11:35 UTC (rev 3418)
+++ trunk/LWJGL/src/java/org/lwjgl/opencl/InfoUtilAbstract.java 2010-09-30 17:21:50 UTC (rev 3419)
@@ -31,6 +31,7 @@
*/
package org.lwjgl.opencl;
+import org.lwjgl.LWJGLUtil;
import org.lwjgl.PointerBuffer;
import java.nio.ByteBuffer;
@@ -112,8 +113,8 @@
object.checkValid();
final int bytes = getSizeRet(object, param_name);
- if ( bytes == 0 )
- return "";
+ if ( bytes <= 1 )
+ return null;
final ByteBuffer buffer = APIUtil.getBufferByte(bytes);
getInfo(object, param_name, buffer, null);
@@ -126,7 +127,7 @@
final PointerBuffer bytes = APIUtil.getBufferPointer();
final int errcode = getInfo(object, param_name, null, bytes);
if ( errcode != CL_SUCCESS )
- throw new IllegalArgumentException("Invalid parameter specified: " + APIUtil.toHexString(param_name));
+ throw new IllegalArgumentException("Invalid parameter specified: " + LWJGLUtil.toHexString(param_name));
return (int)bytes.get(0);
}
Modified: trunk/LWJGL/src/java/org/lwjgl/opencl/InfoUtilFactory.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opencl/InfoUtilFactory.java 2010-09-28 21:11:35 UTC (rev 3418)
+++ trunk/LWJGL/src/java/org/lwjgl/opencl/InfoUtilFactory.java 2010-09-30 17:21:50 UTC (rev 3419)
@@ -32,8 +32,12 @@
package org.lwjgl.opencl;
import org.lwjgl.*;
+import org.lwjgl.opencl.api.CLBufferRegion;
+import org.lwjgl.opencl.api.CLImageFormat;
import org.lwjgl.opencl.api.Filter;
+import org.lwjgl.opengl.Drawable;
+import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.IntBuffer;
import java.util.ArrayList;
@@ -49,7 +53,6 @@
* so that they can be compiled for the generator.
*
* @author Spasi
- * @since 28 \xD3\xE5\xF0 2010
*/
final class InfoUtilFactory {
@@ -92,6 +95,70 @@
}
+ /** Custom clCreateContext implementation (reuses APIUtil.getBufferPointer) */
+ public CLContext create(final CLPlatform platform, final List<CLDevice> devices, final CLContextCallback pfn_notify, final Drawable share_drawable, final IntBuffer errcode_ret) throws LWJGLException {
+ final int propertyCount = 2 + (share_drawable == null ? 0 : 4) + 1;
+
+ final PointerBuffer buffer = APIUtil.getBufferPointer(propertyCount + devices.size());
+ buffer.put(CL_CONTEXT_PLATFORM).put(platform);
+ if ( share_drawable != null )
+ share_drawable.setCLSharingProperties(buffer);
+ buffer.put(0);
+
+ buffer.position(propertyCount); // Make sure we're at the right offset, setCLSharingProperties might not use all 4 positions.
+ for ( CLDevice device : devices )
+ buffer.put(device);
+
+ final long function_pointer = CLCapabilities.clCreateContext;
+ BufferChecks.checkFunctionAddress(function_pointer);
+ final long user_data = pfn_notify == null || pfn_notify.isCustom() ? 0 : CallbackUtil.createGlobalRef(pfn_notify);
+ CLContext __result = null;
+ try {
+ __result = new CLContext(nclCreateContext(buffer.getBuffer(), 0, devices.size(), buffer.getBuffer(), propertyCount * PointerBuffer.getPointerSize(), pfn_notify == null ? 0 : pfn_notify.getPointer(), user_data, errcode_ret, errcode_ret != null ? errcode_ret.position() : 0, function_pointer), platform);
+ return __result;
+ } finally {
+ CallbackUtil.registerCallback(__result, user_data);
+ }
+ }
+
+ public CLContext createFromType(final CLPlatform platform, final long device_type, final CLContextCallback pfn_notify, final Drawable share_drawable, final IntBuffer errcode_ret) throws LWJGLException {
+ final int propertyCount = 2 + (share_drawable == null ? 0 : 4) + 1;
+
+ final PointerBuffer properties = APIUtil.getBufferPointer(propertyCount);
+ properties.put(CL_CONTEXT_PLATFORM).put(platform);
+ if ( share_drawable != null )
+ share_drawable.setCLSharingProperties(properties);
+ properties.put(0);
+ properties.flip();
+
+ return clCreateContextFromType(properties, device_type, pfn_notify, errcode_ret);
+ }
+
+ public List<CLImageFormat> getSupportedImageFormats(final CLContext context, final long flags, final int image_type, final Filter<CLImageFormat> filter) {
+ final IntBuffer numBuffer = APIUtil.getBufferInt();
+ clGetSupportedImageFormats(context, flags, image_type, null, numBuffer);
+
+ final int num_image_formats = numBuffer.get(0);
+ if ( num_image_formats == 0 )
+ return null;
+
+ final ByteBuffer formatBuffer = BufferUtils.createByteBuffer(num_image_formats * CLImageFormat.STRUCT_SIZE);
+ clGetSupportedImageFormats(context, flags, image_type, formatBuffer, null);
+
+ final List<CLImageFormat> formats = new ArrayList<CLImageFormat>(num_image_formats);
+ for ( int i = 0; i < num_image_formats; i++ ) {
+ final int offset = num_image_formats * CLImageFormat.STRUCT_SIZE;
+ final CLImageFormat format = new CLImageFormat(
+ formatBuffer.getInt(offset),
+ formatBuffer.getInt(offset + 4)
+ );
+ if ( filter == null || filter.accept(format) )
+ formats.add(format);
+ }
+
+ return formats.size() == 0 ? null : formats;
+ }
+
}
static final InfoUtil<CLDevice> CL_DEVICE_UTIL = new CLDeviceUtil();
@@ -106,7 +173,7 @@
case CL_DEVICE_MAX_WORK_ITEM_SIZES:
return getInfoInt(device, CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS);
default:
- throw new IllegalArgumentException("Unsupported parameter: " + APIUtil.toHexString(param_name));
+ throw new IllegalArgumentException("Unsupported parameter: " + LWJGLUtil.toHexString(param_name));
}
}
@@ -183,7 +250,7 @@
size = 3;
break;
default:
- throw new IllegalArgumentException("Unsupported parameter: " + APIUtil.toHexString(param_name));
+ throw new IllegalArgumentException("Unsupported parameter: " + LWJGLUtil.toHexString(param_name));
}
final PointerBuffer buffer = APIUtil.getBufferPointer(size);
@@ -215,6 +282,44 @@
return clGetMemObjectInfo(mem, param_name, param_value, param_value_size_ret);
}
+ public CLMem createImage2D(final CLContext context, final long flags, final CLImageFormat image_format, final long image_width, final long image_height, final long image_row_pitch, final Buffer host_ptr, final IntBuffer errcode_ret) {
+ final ByteBuffer formatBuffer = APIUtil.getBufferByte(2 * 4);
+ formatBuffer.putInt(0, image_format.getChannelOrder());
+ formatBuffer.putInt(4, image_format.getChannelType());
+
+ final long function_pointer = CLCapabilities.clCreateImage2D;
+ BufferChecks.checkFunctionAddress(function_pointer);
+ if ( errcode_ret != null )
+ BufferChecks.checkBuffer(errcode_ret, 1);
+ return new CLMem(nclCreateImage2D(context.getPointer(), flags, formatBuffer, 0, image_width, image_height, image_row_pitch, host_ptr,
+ host_ptr != null ? BufferChecks.checkBuffer(host_ptr, CLChecks.calculateImage2DSize(formatBuffer, image_width, image_height, image_row_pitch)) : 0,
+ errcode_ret, errcode_ret != null ? errcode_ret.position() : 0, function_pointer), context);
+ }
+
+ public CLMem createImage3D(final CLContext context, final long flags, final CLImageFormat image_format, final long image_width, final long image_height, final long image_depth, final long image_row_pitch, final long image_slice_pitch, final Buffer host_ptr, final IntBuffer errcode_ret) {
+ final ByteBuffer formatBuffer = APIUtil.getBufferByte(2 * 4);
+ formatBuffer.putInt(0, image_format.getChannelOrder());
+ formatBuffer.putInt(4, image_format.getChannelType());
+
+ final long function_pointer = CLCapabilities.clCreateImage3D;
+ BufferChecks.checkFunctionAddress(function_pointer);
+ if ( errcode_ret != null )
+ BufferChecks.checkBuffer(errcode_ret, 1);
+ return new CLMem(nclCreateImage3D(context.getPointer(), flags, formatBuffer, 0, image_width, image_height, image_depth, image_row_pitch, image_slice_pitch, host_ptr,
+ host_ptr != null ? BufferChecks.checkBuffer(host_ptr, CLChecks.calculateImage3DSize(formatBuffer, image_width, image_height, image_depth, image_row_pitch, image_slice_pitch)) : 0,
+ errcode_ret, errcode_ret != null ? errcode_ret.position() : 0, function_pointer), context);
+ }
+
+ public CLMem createSubBuffer(final CLMem mem, final long flags, final int buffer_create_type, final CLBufferRegion buffer_create_info, final IntBuffer errcode_ret) {
+ final PointerBuffer infoBuffer = APIUtil.getBufferPointer(2);
+
+ infoBuffer.put(buffer_create_info.getOrigin());
+ infoBuffer.put(buffer_create_info.getSize());
+
+ return clCreateSubBuffer(mem, flags, buffer_create_type, infoBuffer.getBuffer(), errcode_ret);
+
+ }
+
public ByteBuffer getInfoHostBuffer(final CLMem mem) {
mem.checkValid();
@@ -242,6 +347,16 @@
return buffer.get(0);
}
+ public CLImageFormat getImageInfoFormat(final CLMem mem) {
+ mem.checkValid();
+
+ final ByteBuffer format = APIUtil.getBufferByte(2 * 4);
+
+ clGetImageInfo(mem, CL_IMAGE_FORMAT, format, null);
+
+ return new CLImageFormat(format.getInt(0), format.getInt(4));
+ }
+
public int getImageInfoFormat(final CLMem mem, final int index) {
mem.checkValid();
@@ -346,10 +461,28 @@
case CL_PROGRAM_BINARY_SIZES:
return getInfoInt(program, CL_PROGRAM_NUM_DEVICES);
default:
- throw new IllegalArgumentException("Unsupported parameter: " + APIUtil.toHexString(param_name));
+ throw new IllegalArgumentException("Unsupported parameter: " + LWJGLUtil.toHexString(param_name));
}
}
+ public CLKernel[] createKernelsInProgram(final CLProgram program) {
+ final IntBuffer numBuffer = APIUtil.getBufferInt();
+ clCreateKernelsInProgram(program, null, numBuffer);
+
+ final int num_kernels = numBuffer.get(0);
+ if ( num_kernels == 0 )
+ return null;
+
+ final PointerBuffer kernelIDs = APIUtil.getBufferPointer(num_kernels);
+ clCreateKernelsInProgram(program, kernelIDs, null);
+
+ final CLKernel[] kernels = new CLKernel[num_kernels];
+ for ( int i = 0; i < num_kernels; i++ )
+ kernels[i] = program.getCLKernel(kernelIDs.get(i));
+
+ return kernels;
+ }
+
public CLDevice[] getInfoDevices(final CLProgram program) {
program.checkValid();
@@ -413,8 +546,8 @@
program.checkValid();
final int bytes = getBuildSizeRet(program, device, param_name);
- if ( bytes == 0 )
- throw new IllegalArgumentException("Invalid parameter specified: " + APIUtil.toHexString(param_name));
+ if ( bytes <= 1 )
+ return null;
final ByteBuffer buffer = APIUtil.getBufferByte(bytes);
clGetProgramBuildInfo(program, device, param_name, buffer, null);
@@ -435,8 +568,10 @@
private static int getBuildSizeRet(final CLProgram program, final CLDevice device, final int param_name) {
final PointerBuffer bytes = APIUtil.getBufferPointer();
final int errcode = clGetProgramBuildInfo(program, device, param_name, null, bytes);
+ if ( errcode != CL_SUCCESS )
+ throw new IllegalArgumentException("Invalid parameter specified: " + LWJGLUtil.toHexString(param_name));
- return errcode == CL_SUCCESS ? (int)bytes.get(0) : 0;
+ return (int)bytes.get(0);
}
}
Modified: trunk/LWJGL/src/java/org/lwjgl/opencl/Util.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opencl/Util.java 2010-09-28 21:11:35 UTC (rev 3418)
+++ trunk/LWJGL/src/java/org/lwjgl/opencl/Util.java 2010-09-30 17:21:50 UTC (rev 3419)
@@ -31,8 +31,9 @@
*/
package org.lwjgl.opencl;
+import org.lwjgl.LWJGLUtil;
+
import java.lang.reflect.Field;
-import java.util.HashMap;
import java.util.Map;
/**
@@ -43,21 +44,12 @@
public final class Util {
/** Maps OpenCL error token values to their String representations. */
- private static final Map<Integer, String> CL_ERROR_TOKENS = new HashMap<Integer, String>(64);
+ private static final Map<Integer, String> CL_ERROR_TOKENS = LWJGLUtil.getClassTokens(new LWJGLUtil.TokenFilter() {
+ public boolean accept(final Field field, final int value) {
+ return value < 0; // Currently, all OpenCL errors have negative values.
+ }
+ }, null, CL10.class, CL11.class, KHRGLSharing.class, KHRICD.class, APPLEGLSharing.class, EXTDeviceFission.class);
- static {
- APIUtil.getClassTokens(new Class[] {
- CL10.class, CL11.class,
- KHRGLSharing.class, KHRICD.class,
- APPLEGLSharing.class,
- EXTDeviceFission.class,
- }, CL_ERROR_TOKENS, new APIUtil.TokenFilter() {
- public boolean accept(final Field field, final int value) {
- return value < 0; // Currently, all OpenCL errors have negative values.
- }
- });
- }
-
private Util() {
}
@@ -70,7 +62,7 @@
String errname = CL_ERROR_TOKENS.get(errcode);
if ( errname == null )
errname = "UNKNOWN";
- throw new OpenCLException("Error Code: " + errname + " (" + APIUtil.toHexString(errcode) + ")");
+ throw new OpenCLException("Error Code: " + errname + " (" + LWJGLUtil.toHexString(errcode) + ")");
}
}
\ No newline at end of file
Added: trunk/LWJGL/src/java/org/lwjgl/opencl/api/CLBufferRegion.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opencl/api/CLBufferRegion.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/opencl/api/CLBufferRegion.java 2010-09-30 17:21:50 UTC (rev 3419)
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2002-2010 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opencl.api;
+
+import org.lwjgl.PointerBuffer;
+
+/**
+ * Simple container for cl_buffer_region struct values.
+ *
+ * @author Spasi
+ */
+public final class CLBufferRegion {
+
+ /** The cl_buffer_region struct size in bytes. */
+ public static final int STRUCT_SIZE = 2 * PointerBuffer.getPointerSize();
+
+ private final int origin;
+ private final int size;
+
+ public CLBufferRegion(final int origin, final int size) {
+ this.origin = origin;
+ this.size = size;
+ }
+
+ public int getOrigin() {
+ return origin;
+ }
+
+ public int getSize() {
+ return size;
+ }
+
+}
\ No newline at end of file
Added: trunk/LWJGL/src/java/org/lwjgl/opencl/api/CLImageFormat.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opencl/api/CLImageFormat.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/opencl/api/CLImageFormat.java 2010-09-30 17:21:50 UTC (rev 3419)
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2002-2010 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opencl.api;
+
+/**
+ * Simple container for cl_image_format struct values.
+ *
+ * @author Spasi
+ */
+public final class CLImageFormat {
+
+ /** The cl_image_format struct size in bytes. */
+ public static final int STRUCT_SIZE = 2 * 4;
+
+ private final int channelOrder;
+ private final int channelType;
+
+ public CLImageFormat(final int channelOrder, final int channelType) {
+ this.channelOrder = channelOrder;
+ this.channelType = channelType;
+ }
+
+ public int getChannelOrder() {
+ return channelOrder;
+ }
+
+ public int getChannelType() {
+ return channelType;
+ }
+
+}
\ No newline at end of file
Modified: trunk/LWJGL/src/java/org/lwjgl/test/opencl/gl/DemoFractal.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/test/opencl/gl/DemoFractal.java 2010-09-28 21:11:35 UTC (rev 3418)
+++ trunk/LWJGL/src/java/org/lwjgl/test/opencl/gl/DemoFractal.java 2010-09-30 17:21:50 UTC (rev 3419)
@@ -43,18 +43,23 @@
import org.lwjgl.util.ReadableColor;
import java.io.*;
+import java.nio.ByteBuffer;
import java.nio.IntBuffer;
+import java.util.HashSet;
import java.util.List;
+import java.util.Set;
import static java.lang.Math.*;
import static org.lwjgl.opencl.CL10.*;
import static org.lwjgl.opencl.CL10GL.*;
import static org.lwjgl.opencl.KHRGLEvent.*;
+import static org.lwjgl.opengl.AMDDebugOutput.*;
import static org.lwjgl.opengl.ARBCLEvent.*;
+import static org.lwjgl.opengl.ARBDebugOutput.*;
import static org.lwjgl.opengl.ARBSync.*;
import static org.lwjgl.opengl.GL11.*;
-import static org.lwjgl.opengl.GL12.*;
import static org.lwjgl.opengl.GL15.*;
+import static org.lwjgl.opengl.GL20.*;
import static org.lwjgl.opengl.GL21.*;
/*
@@ -118,25 +123,36 @@
// max number of used GPUs
private static final int MAX_PARALLELISM_LEVEL = 8;
- // max per pixel iterations to compute the fractal
- private static final int MAX_ITERATIONS = 500;
+ private static final int COLOR_MAP_SIZE = 32 * 2 * 4;
+ private Set<String> params;
+
private CLContext clContext;
private CLCommandQueue[] queues;
private CLKernel[] kernels;
private CLProgram[] programs;
- private CLMem[] pboBuffers;
- private IntBuffer pboIDs;
+ private CLMem[] glBuffers;
+ private IntBuffer glIDs;
+ private boolean useTextures;
+
+ // Texture rendering
+ private int dlist;
+ private int vsh;
+ private int fsh;
+ private int program;
+
private CLMem[] colorMap;
- private IntBuffer[] colorMapBuffer;
private final PointerBuffer kernel2DGlobalWorkSize;
- private int width;
- private int height;
+ // max per pixel iterations to compute the fractal
+ private int maxIterations = 500;
+ private int width = 512;
+ private int height = 512;
+
private double minX = -2f;
private double minY = -1.2f;
private double maxX = 0.6f;
@@ -174,135 +190,55 @@
private GLSync glSync;
private CLEvent glEvent;
- public DemoFractal(int width, int height) {
- kernel2DGlobalWorkSize = BufferUtils.createPointerBuffer(2);
+ public DemoFractal(final String[] args) {
+ params = new HashSet<String>();
- this.width = width;
- this.height = height;
- }
+ for ( int i = 0; i < args.length; i++ ) {
+ final String arg = args[i];
- private void run() {
- long startTime = System.currentTimeMillis() + 5000;
- long fps = 0;
+ if ( arg.charAt(0) != '-' && arg.charAt(0) != '/' )
+ throw new IllegalArgumentException("Invalid command-line argument: " + args[i]);
- while ( run ) {
- if ( !Display.isVisible() )
- Thread.yield();
+ final String param = arg.substring(1);
- handleIO();
- display();
+ if ( "forcePBO".equalsIgnoreCase(param) )
+ params.add("forcePBO");
+ else if ( "forceCPU".equalsIgnoreCase(param) )
+ params.add("forceCPU");
+ else if ( "debugGL".equalsIgnoreCase(param) )
+ params.add("debugGL");
+ else if ( "iterations".equalsIgnoreCase(param) ) {
+ if ( args.length < i + 1 + 1 )
+ throw new IllegalArgumentException("Invalid iterations argument specified.");
- Display.update();
- if ( Display.isCloseRequested() )
- break;
+ try {
+ this.maxIterations = Integer.parseInt(args[++i]);
+ } catch (NumberFormatException e) {
+ throw new IllegalArgumentException("Invalid number of iterations specified.");
+ }
+ } else if ( "res".equalsIgnoreCase(param) ) {
+ if ( args.length < i + 2 + 1 )
+ throw new IllegalArgumentException("Invalid res argument specified.");
- if ( startTime > System.currentTimeMillis() ) {
- fps++;
- } else {
- long timeUsed = 5000 + (startTime - System.currentTimeMillis());
- startTime = System.currentTimeMillis() + 5000;
- System.out.println(fps + " frames in 5 seconds = " + (fps / (timeUsed / 1000f)));
- fps = 0;
- }
- }
+ try {
+ this.width = Integer.parseInt(args[++i]);
+ this.height = Integer.parseInt(args[++i]);
- CL.destroy();
- Display.destroy();
- }
-
- private void handleIO() {
- if ( Keyboard.getNumKeyboardEvents() != 0 ) {
- while ( Keyboard.next() ) {
- if ( Keyboard.getEventKeyState() )
- continue;
-
- final int key = Keyboard.getEventKey();
-
- if ( Keyboard.KEY_1 <= key && key <= Keyboard.KEY_8 ) {
- int number = key - Keyboard.KEY_1 + 1;
- slices = min(number, min(queues.length, MAX_PARALLELISM_LEVEL));
- System.out.println("NEW PARALLELISM LEVEL: " + slices);
- buffersInitialized = false;
- } else {
- switch ( Keyboard.getEventKey() ) {
- case Keyboard.KEY_SPACE:
- drawSeparator = !drawSeparator;
- System.out.println("SEPARATOR DRAWING IS NOW: " + (drawSeparator ? "ON" : "OFF"));
- break;
- case Keyboard.KEY_D:
- doublePrecision = !doublePrecision;
- System.out.println("DOUBLE PRECISION IS NOW: " + (doublePrecision ? "ON" : "OFF"));
- rebuild = true;
- break;
- case Keyboard.KEY_HOME:
- minX = -2f;
- minY = -1.2f;
- maxX = 0.6f;
- maxY = 1.3f;
- break;
- case Keyboard.KEY_ESCAPE:
- run = false;
- break;
- }
+ if ( width < 1 || height < 1 )
+ throw new IllegalArgumentException("Invalid res dimensions specified.");
+ } catch (NumberFormatException e) {
+ throw new IllegalArgumentException("Invalid res dimensions specified.");
}
}
}
- while ( Mouse.next() ) {
- final int eventBtn = Mouse.getEventButton();
+ kernel2DGlobalWorkSize = BufferUtils.createPointerBuffer(2);
+ }
- final int x = Mouse.getX();
- final int y = Mouse.getY();
-
- if ( Mouse.isButtonDown(0) && (x != mouseX || y != mouseY) ) {
- if ( !dragging ) {
- dragging = true;
-
- dragX = mouseX;
- dragY = mouseY;
-
- dragMinX = minX;
- dragMinY = minY;
- dragMaxX = maxX;
- dragMaxY = maxY;
- }
-
- double offsetX = (x - dragX) * (maxX - minX) / width;
- double offsetY = (y - dragY) * (maxY - minY) / height;
-
- minX = dragMinX - offsetX;
- minY = dragMinY - offsetY;
-
- maxX = dragMaxX - offsetX;
- maxY = dragMaxY - offsetY;
- } else {
- if ( dragging )
- dragging = false;
-
- if ( eventBtn == -1 ) {
- final int dwheel = Mouse.getEventDWheel();
- if ( dwheel != 0 ) {
- double scale = dwheel > 0 ? 0.05 : -0.05;
-
- double deltaX = scale * (maxX - minX);
- double deltaY = scale * (maxY - minY);
-
- // offset for "zoom to cursor"
- double offsetX = (x / (double)width - 0.5) * deltaX * 2.0;
- double offsetY = (y / (double)height - 0.5) * deltaY * 2.0;
-
- minX += deltaX + offsetX;
- minY += deltaY - offsetY;
-
- maxX += -deltaX + offsetX;
- maxY += -deltaY - offsetY;
- }
- }
- }
-
- mouseX = x;
- mouseY = y;
- }
+ public static void main(String args[]) {
+ DemoFractal demo = new DemoFractal(args);
+ demo.init();
+ demo.run();
}
public void init() {
@@ -310,7 +246,8 @@
CL.create();
Display.setDisplayMode(new DisplayMode(width, height));
Display.setTitle("OpenCL Fractal Demo");
- Display.create();
+ Display.setSwapInterval(0);
+ Display.create(new PixelFormat(), new ContextAttribs().withDebug(params.contains("debugGL")));
} catch (LWJGLException e) {
throw new RuntimeException(e);
}
@@ -324,13 +261,12 @@
throw new RuntimeException(e);
}
- Display.setSwapInterval(0);
glDisable(GL_DEPTH_TEST);
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
initView(Display.getDisplayMode().getWidth(), Display.getDisplayMode().getHeight());
- initPBO();
+ initGLObjects();
glFinish();
setKernelConstants();
@@ -351,48 +287,40 @@
return caps.CL_KHR_gl_sharing;
}
};
- List<CLDevice> devices = platform.getDevices(CL_DEVICE_TYPE_GPU, glSharingFilter);
+ int device_type = params.contains("forceCPU") ? CL_DEVICE_TYPE_CPU : CL_DEVICE_TYPE_GPU;
+ List<CLDevice> devices = platform.getDevices(device_type, glSharingFilter);
if ( devices == null ) {
- devices = platform.getDevices(CL_DEVICE_TYPE_CPU, glSharingFilter);
+ device_type = CL_DEVICE_TYPE_CPU;
+ devices = platform.getDevices(device_type, glSharingFilter);
if ( devices == null )
throw new RuntimeException("No OpenCL devices found with KHR_gl_sharing support.");
}
// Create the context
- final PointerBuffer deviceIDs = BufferUtils.createPointerBuffer(devices.size());
- for ( CLDevice device : devices )
- deviceIDs.put(device);
- deviceIDs.flip();
+ clContext = CLContext.create(platform, devices, new CLContextCallback() {
+ protected void handleMessage(final String errinfo, final ByteBuffer private_info) {
+ System.out.println("[CONTEXT MESSAGE] " + errinfo);
+ }
+ }, drawable, null);
- final PointerBuffer contextProps = BufferUtils.createPointerBuffer(2 + 4 + 1);
- contextProps.put(CL_CONTEXT_PLATFORM).put(platform);
-
- drawable.setCLSharingProperties(contextProps); // Enable GL sharing
-
- contextProps.put(0);
- contextProps.flip();
- clContext = clCreateContext(contextProps, deviceIDs, null, null);
-
slices = min(devices.size(), MAX_PARALLELISM_LEVEL);
// create command queues for every GPU, setup colormap and init kernels
queues = new CLCommandQueue[slices];
kernels = new CLKernel[slices];
colorMap = new CLMem[slices];
- colorMapBuffer = new IntBuffer[slices];
for ( int i = 0; i < slices; i++ ) {
- colorMapBuffer[i] = BufferUtils.createIntBuffer(32 * 2);
- colorMap[i] = clCreateBuffer(clContext, CL_MEM_READ_ONLY, colorMapBuffer[i].capacity() * 4, null);
+ colorMap[i] = clCreateBuffer(clContext, CL_MEM_READ_ONLY, COLOR_MAP_SIZE, null);
colorMap[i].checkValid();
- initColorMap(colorMapBuffer[i], 32, Color.BLUE, Color.GREEN, Color.RED);
-
// create command queue and upload color map buffer on each used device
queues[i] = clCreateCommandQueue(clContext, devices.get(i), CL_QUEUE_PROFILING_ENABLE, null);
queues[i].checkValid();
- clEnqueueWriteBuffer(queues[i], colorMap[i], CL_TRUE, 0, colorMapBuffer[i], null, null); // blocking upload
+ final ByteBuffer colorMapBuffer = clEnqueueMapBuffer(queues[i], colorMap[i], CL_TRUE, CL_MAP_WRITE, 0, COLOR_MAP_SIZE, null, null, null);
+ initColorMap(colorMapBuffer.asIntBuffer(), 32, Color.BLUE, Color.GREEN, Color.RED);
+ clEnqueueUnmapMemObject(queues[i], colorMap[i], colorMapBuffer, null, null);
}
// check if we have 64bit FP support on all devices
@@ -411,25 +339,51 @@
// load program(s)
programs = new CLProgram[all64bit ? 1 : slices];
- buildPrograms();
-
final ContextCapabilities caps = GLContext.getCapabilities();
- System.out.println("OpenGL caps.OpenGL32 = " + caps.OpenGL32);
- System.out.println("OpenGL caps.GL_ARB_sync = " + caps.GL_ARB_sync);
+ if ( !caps.OpenGL20 )
+ throw new RuntimeException("OpenGL 2.0 is required to run this demo.");
+ else if ( device_type == CL_DEVICE_TYPE_CPU && !caps.OpenGL21 )
+ throw new RuntimeException("OpenGL 2.1 is required to run this demo.");
+
+ if ( caps.GL_ARB_debug_output )
+ glDebugMessageCallbackARB(new ARBDebugOutputCallback());
+ else if ( caps.GL_AMD_debug_output )
+ glDebugMessageCallbackAMD(new AMDDebugOutputCallback());
+
+ if ( device_type == CL_DEVICE_TYPE_GPU )
+ System.out.println("OpenCL Device Type: GPU (Use -forceCPU to use CPU)");
+ else
+ System.out.println("OpenCL Device Type: CPU");
+ for ( int i = 0; i < devices.size(); i++ )
+ System.out.println("OpenCL Device #" + (i + 1) + " supports KHR_gl_event = " + CLCapabilities.getDeviceCapabilities(devices.get(i)).CL_KHR_gl_event);
+
+ System.out.println("\nMax Iterations: " + maxIterations + " (Use -iterations <count> to change)");
+ System.out.println("Display resolution: " + width + "x" + height + " (Use -res <width> <height> to change)");
+
+ System.out.println("\nOpenGL caps.GL_ARB_sync = " + caps.GL_ARB_sync);
System.out.println("OpenGL caps.GL_ARB_cl_event = " + caps.GL_ARB_cl_event);
- for ( int i = 0; i < devices.size(); i++ ) {
- System.out.println("Device #" + (i + 1) + " supports KHR_gl_event = " + CLCapabilities.getDeviceCapabilities(devices.get(i)).CL_KHR_gl_event);
+
+ // Use PBO if we're on a CPU implementation
+ useTextures = device_type == CL_DEVICE_TYPE_GPU && (!caps.OpenGL21 || !params.contains("forcePBO"));
+ if ( useTextures ) {
+ System.out.println("\nCL/GL Sharing method: TEXTURES (use -forcePBO to use PBO + DrawPixels)");
+ System.out.println("Rendering method: Shader on a fullscreen quad");
+ } else {
+ System.out.println("\nCL/GL Sharing method: PIXEL BUFFER OBJECTS");
+ System.out.println("Rendering method: DrawPixels");
}
+ buildPrograms();
+
// Detect GLtoCL synchronization method
syncGLtoCL = caps.GL_ARB_cl_event; // GL3.2 or ARB_sync implied
if ( syncGLtoCL ) {
clEvents = new CLEvent[slices];
clSyncs = new GLSync[slices];
- System.out.println("GL to CL sync: Using OpenCL events");
+ System.out.println("\nGL to CL sync: Using OpenCL events");
} else
- System.out.println("GL to CL sync: Using clFinish");
+ System.out.println("\nGL to CL sync: Using clFinish");
// Detect CLtoGL synchronization method
syncCLtoGL = caps.OpenGL32 || caps.GL_ARB_sync;
@@ -445,92 +399,57 @@
System.out.println("CL to GL sync: Using OpenGL sync objects");
} else
System.out.println("CL to GL sync: Using glFinish");
- }
- private void createPrograms() throws IOException {
- final String source = getProgramSource("Mandelbrot.cl");
- for ( int i = 0; i < programs.length; i++ )
- programs[i] = clCreateProgramWithSource(clContext, source, null);
- }
+ if ( useTextures ) {
+ dlist = glGenLists(1);
- private String getProgramSource(final String file) throws IOException {
- InputStream source = getClass().getResourceAsStream(file);
- if ( source == null ) // dev-mode
- source = new FileInputStream("...
[truncated message content] |
|
From: <sp...@us...> - 2010-09-28 21:11:47
|
Revision: 3418
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3418&view=rev
Author: spasi
Date: 2010-09-28 21:11:35 +0000 (Tue, 28 Sep 2010)
Log Message:
-----------
Ported codebase to Java 1.5.
Misc OpenCL fixes and API improvements.
Changed fractal demo to use events/sync objects instead of cl/glFinish for synchronization. (untested)
Modified Paths:
--------------
trunk/LWJGL/build.xml
trunk/LWJGL/platform_build/build-generator.xml
trunk/LWJGL/src/java/org/lwjgl/BufferChecks.java
trunk/LWJGL/src/java/org/lwjgl/LWJGLUtil.java
trunk/LWJGL/src/java/org/lwjgl/LinuxSysImplementation.java
trunk/LWJGL/src/java/org/lwjgl/MacOSXSysImplementation.java
trunk/LWJGL/src/java/org/lwjgl/NondirectBufferWrapper.java
trunk/LWJGL/src/java/org/lwjgl/PointerBuffer.java
trunk/LWJGL/src/java/org/lwjgl/PointerWrapperAbstract.java
trunk/LWJGL/src/java/org/lwjgl/Sys.java
trunk/LWJGL/src/java/org/lwjgl/WindowsSysImplementation.java
trunk/LWJGL/src/java/org/lwjgl/examples/Game.java
trunk/LWJGL/src/java/org/lwjgl/examples/spaceinvaders/Entity.java
trunk/LWJGL/src/java/org/lwjgl/examples/spaceinvaders/Game.java
trunk/LWJGL/src/java/org/lwjgl/examples/spaceinvaders/GameApplet.java
trunk/LWJGL/src/java/org/lwjgl/examples/spaceinvaders/ShotEntity.java
trunk/LWJGL/src/java/org/lwjgl/examples/spaceinvaders/SoundManager.java
trunk/LWJGL/src/java/org/lwjgl/examples/spaceinvaders/Sprite.java
trunk/LWJGL/src/java/org/lwjgl/examples/spaceinvaders/Texture.java
trunk/LWJGL/src/java/org/lwjgl/examples/spaceinvaders/TextureLoader.java
trunk/LWJGL/src/java/org/lwjgl/input/Controller.java
trunk/LWJGL/src/java/org/lwjgl/input/ControllerEvent.java
trunk/LWJGL/src/java/org/lwjgl/input/Controllers.java
trunk/LWJGL/src/java/org/lwjgl/input/Cursor.java
trunk/LWJGL/src/java/org/lwjgl/input/JInputController.java
trunk/LWJGL/src/java/org/lwjgl/input/Keyboard.java
trunk/LWJGL/src/java/org/lwjgl/input/Mouse.java
trunk/LWJGL/src/java/org/lwjgl/input/OpenGLPackageAccess.java
trunk/LWJGL/src/java/org/lwjgl/openal/AL.java
trunk/LWJGL/src/java/org/lwjgl/openal/ALC10.java
trunk/LWJGL/src/java/org/lwjgl/openal/ALC11.java
trunk/LWJGL/src/java/org/lwjgl/openal/ALCcontext.java
trunk/LWJGL/src/java/org/lwjgl/openal/ALCdevice.java
trunk/LWJGL/src/java/org/lwjgl/openal/EFXUtil.java
trunk/LWJGL/src/java/org/lwjgl/opencl/APIUtil.java
trunk/LWJGL/src/java/org/lwjgl/opencl/APPLEContextLoggingUtil.java
trunk/LWJGL/src/java/org/lwjgl/opencl/CL.java
trunk/LWJGL/src/java/org/lwjgl/opencl/CLBuildProgramCallback.java
trunk/LWJGL/src/java/org/lwjgl/opencl/CLChecks.java
trunk/LWJGL/src/java/org/lwjgl/opencl/CLCommandQueue.java
trunk/LWJGL/src/java/org/lwjgl/opencl/CLContext.java
trunk/LWJGL/src/java/org/lwjgl/opencl/CLDevice.java
trunk/LWJGL/src/java/org/lwjgl/opencl/CLEvent.java
trunk/LWJGL/src/java/org/lwjgl/opencl/CLKernel.java
trunk/LWJGL/src/java/org/lwjgl/opencl/CLMem.java
trunk/LWJGL/src/java/org/lwjgl/opencl/CLObject.java
trunk/LWJGL/src/java/org/lwjgl/opencl/CLObjectChild.java
trunk/LWJGL/src/java/org/lwjgl/opencl/CLObjectRegistry.java
trunk/LWJGL/src/java/org/lwjgl/opencl/CLPlatform.java
trunk/LWJGL/src/java/org/lwjgl/opencl/CLProgram.java
trunk/LWJGL/src/java/org/lwjgl/opencl/CLSampler.java
trunk/LWJGL/src/java/org/lwjgl/opencl/Util.java
trunk/LWJGL/src/java/org/lwjgl/opengl/AMDDebugOutputCallback.java
trunk/LWJGL/src/java/org/lwjgl/opengl/APIUtil.java
trunk/LWJGL/src/java/org/lwjgl/opengl/ARBDebugOutputCallback.java
trunk/LWJGL/src/java/org/lwjgl/opengl/AWTGLCanvas.java
trunk/LWJGL/src/java/org/lwjgl/opengl/AWTSurfaceLock.java
trunk/LWJGL/src/java/org/lwjgl/opengl/AWTUtil.java
trunk/LWJGL/src/java/org/lwjgl/opengl/BaseReferences.java
trunk/LWJGL/src/java/org/lwjgl/opengl/CallbackUtil.java
trunk/LWJGL/src/java/org/lwjgl/opengl/Context.java
trunk/LWJGL/src/java/org/lwjgl/opengl/ContextAttribs.java
trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java
trunk/LWJGL/src/java/org/lwjgl/opengl/DisplayMode.java
trunk/LWJGL/src/java/org/lwjgl/opengl/GLChecks.java
trunk/LWJGL/src/java/org/lwjgl/opengl/GLContext.java
trunk/LWJGL/src/java/org/lwjgl/opengl/GLUConstants.java
trunk/LWJGL/src/java/org/lwjgl/opengl/GlobalLock.java
trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxCanvasImplementation.java
trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java
trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxEvent.java
trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxKeycodes.java
trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxMouse.java
trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXDisplay.java
trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXDisplayPeerInfo.java
trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXFrame.java
trunk/LWJGL/src/java/org/lwjgl/opengl/PeerInfo.java
trunk/LWJGL/src/java/org/lwjgl/opengl/ReferencesStack.java
trunk/LWJGL/src/java/org/lwjgl/opengl/RenderTexture.java
trunk/LWJGL/src/java/org/lwjgl/opengl/StateTracker.java
trunk/LWJGL/src/java/org/lwjgl/opengl/Util.java
trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsAWTGLCanvasPeerInfo.java
trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsCanvasImplementation.java
trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java
trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsKeyboard.java
trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsKeycodes.java
trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsRegistry.java
trunk/LWJGL/src/java/org/lwjgl/opengl/XRandR.java
trunk/LWJGL/src/java/org/lwjgl/test/DisplayTest.java
trunk/LWJGL/src/java/org/lwjgl/test/WindowCreationTest.java
trunk/LWJGL/src/java/org/lwjgl/test/applet/AppletLoaderTest.java
trunk/LWJGL/src/java/org/lwjgl/test/applet/GearsApplet.java
trunk/LWJGL/src/java/org/lwjgl/test/applet/OpenAL.java
trunk/LWJGL/src/java/org/lwjgl/test/applet/OpenGL.java
trunk/LWJGL/src/java/org/lwjgl/test/applet/Speed.java
trunk/LWJGL/src/java/org/lwjgl/test/applet/Test.java
trunk/LWJGL/src/java/org/lwjgl/test/glu/tessellation/TessCallback.java
trunk/LWJGL/src/java/org/lwjgl/test/glu/tessellation/TessellationTest.java
trunk/LWJGL/src/java/org/lwjgl/test/input/HWCursorTest.java
trunk/LWJGL/src/java/org/lwjgl/test/input/KeyboardTest.java
trunk/LWJGL/src/java/org/lwjgl/test/input/MouseCreationTest.java
trunk/LWJGL/src/java/org/lwjgl/test/input/MouseTest.java
trunk/LWJGL/src/java/org/lwjgl/test/input/TestControllers.java
trunk/LWJGL/src/java/org/lwjgl/test/openal/BasicTest.java
trunk/LWJGL/src/java/org/lwjgl/test/openal/OpenALInfo.java
trunk/LWJGL/src/java/org/lwjgl/test/openal/PositionTest.java
trunk/LWJGL/src/java/org/lwjgl/test/opencl/HelloOpenCL.java
trunk/LWJGL/src/java/org/lwjgl/test/opencl/gl/DemoFractal.java
trunk/LWJGL/src/java/org/lwjgl/test/opengl/FullScreenWindowedTest.java
trunk/LWJGL/src/java/org/lwjgl/test/opengl/Gears.java
trunk/LWJGL/src/java/org/lwjgl/test/opengl/PbufferTest.java
trunk/LWJGL/src/java/org/lwjgl/test/opengl/SyncTest.java
trunk/LWJGL/src/java/org/lwjgl/test/opengl/VBOIndexTest.java
trunk/LWJGL/src/java/org/lwjgl/test/opengl/VBOTest.java
trunk/LWJGL/src/java/org/lwjgl/test/opengl/VersionTest.java
trunk/LWJGL/src/java/org/lwjgl/test/opengl/awt/AWTGears.java
trunk/LWJGL/src/java/org/lwjgl/test/opengl/awt/AWTGearsCanvas.java
trunk/LWJGL/src/java/org/lwjgl/test/opengl/awt/AWTTest.java
trunk/LWJGL/src/java/org/lwjgl/test/opengl/awt/DemoBox.java
trunk/LWJGL/src/java/org/lwjgl/test/opengl/awt/DisplayParentTest.java
trunk/LWJGL/src/java/org/lwjgl/test/opengl/multithread/BackgroundLoadTest.java
trunk/LWJGL/src/java/org/lwjgl/test/opengl/multithread/BackgroundLoader.java
trunk/LWJGL/src/java/org/lwjgl/test/opengl/pbuffers/PbufferTest.java
trunk/LWJGL/src/java/org/lwjgl/test/opengl/pbuffers/UniqueRenderer.java
trunk/LWJGL/src/java/org/lwjgl/test/opengl/pbuffers/UniqueRendererRTT.java
trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/Shader.java
trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShaderFP.java
trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShaderFSH.java
trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShaderUNI.java
trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShaderVP.java
trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShaderVSH.java
trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShadersTest.java
trunk/LWJGL/src/java/org/lwjgl/util/Display.java
trunk/LWJGL/src/java/org/lwjgl/util/ReadableColor.java
trunk/LWJGL/src/java/org/lwjgl/util/ReadableDimension.java
trunk/LWJGL/src/java/org/lwjgl/util/ReadablePoint.java
trunk/LWJGL/src/java/org/lwjgl/util/ReadableRectangle.java
trunk/LWJGL/src/java/org/lwjgl/util/Renderable.java
trunk/LWJGL/src/java/org/lwjgl/util/Timer.java
trunk/LWJGL/src/java/org/lwjgl/util/WritableColor.java
trunk/LWJGL/src/java/org/lwjgl/util/WritableDimension.java
trunk/LWJGL/src/java/org/lwjgl/util/WritablePoint.java
trunk/LWJGL/src/java/org/lwjgl/util/WritableRectangle.java
trunk/LWJGL/src/java/org/lwjgl/util/XPMFile.java
trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorVisitor.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/Helper.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/NativeMethodStubsGenerator.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/RegisterStubsGenerator.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/Utils.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/opencl/CLCapabilitiesGenerator.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/opencl/CLGeneratorProcessorFactory.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/opencl/CLPDCapabilitiesGenerator.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/opengl/GLCapabilitiesGenerator.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/opengl/GLGeneratorProcessorFactory.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/opengl/GLReferencesGeneratorProcessorFactory.java
trunk/LWJGL/src/java/org/lwjgl/util/glu/Cylinder.java
trunk/LWJGL/src/java/org/lwjgl/util/glu/Disk.java
trunk/LWJGL/src/java/org/lwjgl/util/glu/GLU.java
trunk/LWJGL/src/java/org/lwjgl/util/glu/GLUtessellator.java
trunk/LWJGL/src/java/org/lwjgl/util/glu/GLUtessellatorCallback.java
trunk/LWJGL/src/java/org/lwjgl/util/glu/MipMap.java
trunk/LWJGL/src/java/org/lwjgl/util/glu/PartialDisk.java
trunk/LWJGL/src/java/org/lwjgl/util/glu/PixelStoreState.java
trunk/LWJGL/src/java/org/lwjgl/util/glu/Project.java
trunk/LWJGL/src/java/org/lwjgl/util/glu/Quadric.java
trunk/LWJGL/src/java/org/lwjgl/util/glu/Registry.java
trunk/LWJGL/src/java/org/lwjgl/util/glu/Sphere.java
trunk/LWJGL/src/java/org/lwjgl/util/glu/Util.java
trunk/LWJGL/src/java/org/lwjgl/util/glu/tessellation/GLUhalfEdge.java
trunk/LWJGL/src/java/org/lwjgl/util/glu/tessellation/GLUtessellatorImpl.java
trunk/LWJGL/src/java/org/lwjgl/util/glu/tessellation/Normal.java
trunk/LWJGL/src/java/org/lwjgl/util/glu/tessellation/PriorityQ.java
trunk/LWJGL/src/java/org/lwjgl/util/glu/tessellation/PriorityQHeap.java
trunk/LWJGL/src/java/org/lwjgl/util/glu/tessellation/PriorityQSort.java
trunk/LWJGL/src/java/org/lwjgl/util/glu/tessellation/Render.java
trunk/LWJGL/src/java/org/lwjgl/util/glu/tessellation/Sweep.java
trunk/LWJGL/src/java/org/lwjgl/util/jinput/KeyMap.java
trunk/LWJGL/src/java/org/lwjgl/util/jinput/LWJGLKeyboard.java
trunk/LWJGL/src/java/org/lwjgl/util/jinput/LWJGLMouse.java
trunk/LWJGL/src/java/org/lwjgl/util/vector/Matrix.java
trunk/LWJGL/src/java/org/lwjgl/util/vector/Matrix2f.java
trunk/LWJGL/src/java/org/lwjgl/util/vector/Matrix3f.java
trunk/LWJGL/src/java/org/lwjgl/util/vector/Matrix4f.java
trunk/LWJGL/src/java/org/lwjgl/util/vector/Quaternion.java
trunk/LWJGL/src/java/org/lwjgl/util/vector/ReadableVector.java
trunk/LWJGL/src/java/org/lwjgl/util/vector/ReadableVector2f.java
trunk/LWJGL/src/java/org/lwjgl/util/vector/ReadableVector3f.java
trunk/LWJGL/src/java/org/lwjgl/util/vector/ReadableVector4f.java
trunk/LWJGL/src/java/org/lwjgl/util/vector/Vector.java
trunk/LWJGL/src/java/org/lwjgl/util/vector/Vector2f.java
trunk/LWJGL/src/java/org/lwjgl/util/vector/Vector3f.java
trunk/LWJGL/src/java/org/lwjgl/util/vector/WritableVector2f.java
trunk/LWJGL/src/java/org/lwjgl/util/vector/WritableVector3f.java
trunk/LWJGL/src/java/org/lwjgl/util/vector/WritableVector4f.java
trunk/LWJGL/src/native/common/extcl_types.h
trunk/LWJGL/src/native/common/org_lwjgl_opencl_CL.c
trunk/LWJGL/src/native/common/org_lwjgl_opencl_CL.h
trunk/LWJGL/src/templates/org/lwjgl/opencl/CL10.java
trunk/LWJGL/src/templates/org/lwjgl/opencl/KHR_icd.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_sync.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/GL32.java
Added Paths:
-----------
trunk/LWJGL/src/java/org/lwjgl/opencl/CLObjectRetainable.java
trunk/LWJGL/src/java/org/lwjgl/opencl/InfoUtil.java
trunk/LWJGL/src/java/org/lwjgl/opencl/InfoUtilAbstract.java
trunk/LWJGL/src/java/org/lwjgl/opencl/InfoUtilFactory.java
trunk/LWJGL/src/templates/org/lwjgl/opencl/AMD_event_callback.java
trunk/LWJGL/src/templates/org/lwjgl/opencl/KHR_d3d10_sharing.java
Removed Paths:
-------------
trunk/LWJGL/src/java/org/lwjgl/opencl/CLDeviceImpl.java
trunk/LWJGL/src/java/org/lwjgl/opencl/CLKernelImpl.java
trunk/LWJGL/src/java/org/lwjgl/opencl/CLPlatformImpl.java
Modified: trunk/LWJGL/build.xml
===================================================================
--- trunk/LWJGL/build.xml 2010-09-27 12:09:52 UTC (rev 3417)
+++ trunk/LWJGL/build.xml 2010-09-28 21:11:35 UTC (rev 3418)
@@ -16,74 +16,88 @@
<!-- Initialize build -->
<!-- ================================================================== -->
<target name="-initialize">
- <mkdir dir="${lwjgl.bin}" taskname="initialiazing bin folder" />
- <mkdir dir="${lwjgl.bin}/lwjgl" taskname="initialiazing bin folder" />
- <mkdir dir="${lwjgl.lib}" taskname="initialiazing lib folder" />
- <mkdir dir="${lwjgl.dist}" taskname="initialiazing dist folder" />
- <mkdir dir="${lwjgl.docs}/javadoc" taskname="initialiazing docs folder" />
- <mkdir dir="${lwjgl.res}" taskname="initialiazing res folder" />
- <mkdir dir="${lwjgl.temp}" taskname="initialiazing temp folder" />
- <mkdir dir="${lwjgl.temp}/jar" taskname="initialiazing temp/jar folder" />
- <mkdir dir="${lwjgl.temp}/doc" taskname="initialiazing temp/doc folder" />
- <mkdir dir="${lwjgl.temp}/res" taskname="initialiazing temp/res folder" />
- <mkdir dir="${lwjgl.temp}/native" taskname="initialiazing temp/native folder" />
- <mkdir dir="${lwjgl.temp}/native/windows" taskname="initialiazing temp/windows folder" />
- <mkdir dir="${lwjgl.temp}/native/linux" taskname="initialiazing temp/linux folder" />
- <mkdir dir="${lwjgl.temp}/native/macosx" taskname="initialiazing temp/macosx folder" />
- <mkdir dir="${lwjgl.temp}/native/solaris" taskname="initialiazing temp/solaris folder" />
+ <mkdir dir="${lwjgl.bin}" taskname="initialiazing bin folder" />
+ <mkdir dir="${lwjgl.bin}/lwjgl" taskname="initialiazing native bin folder" />
+ <mkdir dir="${lwjgl.lib}" taskname="initialiazing lib folder" />
+ <mkdir dir="${lwjgl.dist}" taskname="initialiazing dist folder" />
+ <mkdir dir="${lwjgl.docs}/javadoc" taskname="initialiazing docs folder" />
+ <mkdir dir="${lwjgl.res}" taskname="initialiazing res folder" />
+ <mkdir dir="${lwjgl.temp}" taskname="initialiazing temp folder" />
+ <mkdir dir="${lwjgl.temp}/jar" taskname="initialiazing temp/jar folder" />
+ <mkdir dir="${lwjgl.temp}/doc" taskname="initialiazing temp/doc folder" />
+ <mkdir dir="${lwjgl.temp}/res" taskname="initialiazing temp/res folder" />
+ <mkdir dir="${lwjgl.temp}/native" taskname="initialiazing temp/native folder" />
+ <mkdir dir="${lwjgl.temp}/native/windows" taskname="initialiazing temp/windows folder" />
+ <mkdir dir="${lwjgl.temp}/native/linux" taskname="initialiazing temp/linux folder" />
+ <mkdir dir="${lwjgl.temp}/native/macosx" taskname="initialiazing temp/macosx folder" />
+ <mkdir dir="${lwjgl.temp}/native/solaris" taskname="initialiazing temp/solaris folder" />
</target>
<!-- Cleans up any files created during the execution of this script -->
<target name="clean" description="Cleans the directories controlled by this ant script" depends="clean-generated">
<delete dir="${lwjgl.temp}" quiet="true" failonerror="false" taskname="cleaning temp folder" />
<delete dir="${lwjgl.docs}/javadoc" quiet="true" failonerror="false" taskname="cleaning javadoc folder" />
- <delete dir="${lwjgl.bin}" quiet="true" failonerror="false" taskname="cleaning bin folder" />
+ <!-- Delete java classes only to avoid unnecessary native recompilation -->
+ <delete dir="${lwjgl.bin}/org" quiet="true" failonerror="false" taskname="cleaning bin folder" />
</target>
+ <!-- Useful when we need to force native recompilation -->
+ <target name="clean-native" description="Cleans bin folder's native directory" depends="clean-generated-native">
+ <delete dir="${lwjgl.bin}/lwjgl" quiet="true" failonerror="false" taskname="cleaning native bin folder" />
+ <mkdir dir="${lwjgl.bin}/lwjgl" taskname="initialiazing native bin folder" />
+ </target>
+
+ <target name="clean-all" depends="clean, clean-generated-native" description="Cleans all directories controlled by this ant script">
+ <delete dir="${lwjgl.bin}/lwjgl" quiet="true" failonerror="false" taskname="cleaning native bin folder" />
+ </target>
+
<!-- Creates a distribution of LWJGL -->
<target name="release" description="Creates a distribution of LWJGL using supplied native binaries">
<!-- Warn user -->
<echo message="Before running the release target, please manually compile all platforms and place required files in ${lwjgl.lib}/windows, ${lwjgl.lib}/linux and ${lwjgl.lib}/macosx${line.separator}Missing files will result in a successfull built, but with incomplete release zips"/>
- <input
- message="All data in the ${lwjgl.dist} folder will be deleted. Continue? "
- validargs="yes,no"
- addproperty="do.delete"
- />
- <condition property="do.abort">
- <equals arg1="no" arg2="${do.delete}"/>
- </condition>
- <fail if="do.abort">Build aborted by user.</fail>
+ <input
+ message="All data in the ${lwjgl.dist} folder will be deleted. Continue? "
+ validargs="yes,no"
+ addproperty="do.delete"
+ />
+ <condition property="do.abort">
+ <equals arg1="no" arg2="${do.delete}"/>
+ </condition>
+ <fail if="do.abort">Build aborted by user.</fail>
- <!-- prepare -->
- <delete dir="${lwjgl.dist}" quiet="true" failonerror="false" />
- <antcall target="clean" />
- <antcall target="-initialize" />
+ <!-- prepare -->
+ <delete dir="${lwjgl.dist}" quiet="true" failonerror="false" />
+ <antcall target="clean" />
+ <antcall target="-initialize" />
- <!-- compile and create jars -->
- <antcall target="generate-debug"/>
- <antcall target="compile" />
- <antcall target="-createdebugjars" />
+ <!-- compile and create debug jars -->
+ <antcall target="generate-debug" />
+ <antcall target="compile" />
+ <antcall target="-createdebugjars" />
+
<!-- Generator will skip all templates if we don't clean -->
- <delete dir="${lwjgl.bin}" quiet="true" failonerror="false" taskname="cleaning bin folder" />
- <mkdir dir="${lwjgl.bin}" taskname="initialiazing bin folder" />
- <antcall target="generate-all"/>
- <antcall target="compile" />
- <antcall target="-createjars" />
- <antcall target="-jars_NoDEP" />
- <antcall target="javadoc" />
- <antcall target="applet-release" />
+ <delete dir="${lwjgl.bin}/org" quiet="true" failonerror="false" taskname="cleaning bin folder" />
- <!-- copy resources to res folder -->
- <copy todir="${lwjgl.temp}/res">
- <fileset dir="res"/>
- </copy>
+ <!-- compile and create jars -->
+ <antcall target="generate-all" />
+ <antcall target="compile" />
+ <antcall target="-createjars" />
- <!-- copy docs -->
+ <antcall target="-jars_NoDEP" />
+ <antcall target="javadoc" />
+ <antcall target="applet-release" />
+
+ <!-- copy resources to res folder -->
+ <copy todir="${lwjgl.temp}/res">
+ <fileset dir="res"/>
+ </copy>
+
+ <!-- copy docs -->
<copy todir="${lwjgl.temp}/doc">
<fileset dir="${lwjgl.docs}">
<patternset refid="lwjgl-docs.fileset" />
</fileset>
- </copy>
+ </copy>
<!-- create distribution from files in libs/ and temp/ -->
<antcall target="-distribution_javadoc" />
@@ -219,7 +233,7 @@
<class name="org.lwjgl.opengl.LinuxContextImplementation" />
<class name="org.lwjgl.opengl.LinuxCanvasImplementation" />
</javah>
-
+
<javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.native}/windows" force="yes">
<class name="org.lwjgl.opengl.WindowsKeyboard" />
<class name="org.lwjgl.opengl.WindowsPbufferPeerInfo" />
@@ -231,7 +245,7 @@
<class name="org.lwjgl.opengl.WindowsDisplayPeerInfo" />
<class name="org.lwjgl.opengl.WindowsContextImplementation" />
</javah>
-
+
<javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.native}/macosx" force="yes">
<class name="org.lwjgl.MacOSXSysImplementation" />
<class name="org.lwjgl.opengl.MacOSXMouseEventQueue" />
@@ -241,7 +255,7 @@
<class name="org.lwjgl.opengl.MacOSXDisplay" />
<class name="org.lwjgl.opengl.MacOSXContextImplementation" />
</javah>
-
+
<javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.headers}" force="yes">
<class name="org.lwjgl.opengl.AWTSurfaceLock" />
<class name="org.lwjgl.DefaultSysImplementation" />
@@ -342,6 +356,7 @@
<!-- Compiles the Java source code -->
<target name="compile" description="Compiles the java source code" depends="-initialize">
<javac debug="yes" destdir="${lwjgl.bin}" source="1.5" target="1.5" classpath="${lwjgl.lib}/jinput.jar:${lwjgl.lib}/AppleJavaExtensions.jar" taskname="core">
+ <!--<compilerarg value="-Xlint:unchecked"/>-->
<src path="${lwjgl.src}/java/"/>
<src path="${lwjgl.src}/generated/"/>
<include name="org/lwjgl/*.java"/>
@@ -493,7 +508,7 @@
<!-- Creates the Javadoc -->
<target name="javadoc" description="Creates javadoc from java source code">
- <javadoc destdir="${lwjgl.docs}/javadoc" classpath="${lwjgl.lib}/jinput.jar" author="true" version="true" use="true" source="1.4" windowtitle="LWJGL API" useexternalfile="true">
+ <javadoc destdir="${lwjgl.docs}/javadoc" classpath="${lwjgl.lib}/jinput.jar" author="true" version="true" use="true" source="1.5" windowtitle="LWJGL API" useexternalfile="true">
<fileset refid="lwjgl.javadoc.fileset" />
<doctitle><![CDATA[<h1>Lightweight Java Game Toolkit</h1>]]></doctitle>
<bottom><![CDATA[<i>Copyright © 2002-2009 lwjgl.org. All Rights Reserved.</i>]]></bottom>
Modified: trunk/LWJGL/platform_build/build-generator.xml
===================================================================
--- trunk/LWJGL/platform_build/build-generator.xml 2010-09-27 12:09:52 UTC (rev 3417)
+++ trunk/LWJGL/platform_build/build-generator.xml 2010-09-28 21:11:35 UTC (rev 3418)
@@ -1,13 +1,18 @@
<project name="generator">
<!-- clean the generated files -->
- <target name="clean-generated" description="Deletes the generated java and native source">
+ <target name="clean-generated" description="Deletes the generated java source">
<delete quiet="true" failonerror="false">
<fileset dir="${lwjgl.src}/generated" includes="**"/>
- <fileset dir="${lwjgl.src.native}/generated" includes="**"/>
</delete>
</target>
+ <target name="clean-generated-native" description="Deletes the generated native source">
+ <delete quiet="true" failonerror="false">
+ <fileset dir="${lwjgl.src.native}/generated" includes="**"/>
+ </delete>
+ </target>
+
<!-- Compiles the Java generator source code -->
<target name="generators" description="Compiles the native method generators">
<javac debug="yes" srcdir="${lwjgl.src}/java/" destdir="${lwjgl.bin}" includes="org/lwjgl/util/generator/**.java" source="1.5" target="1.5" taskname="generator">
Modified: trunk/LWJGL/src/java/org/lwjgl/BufferChecks.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/BufferChecks.java 2010-09-27 12:09:52 UTC (rev 3417)
+++ trunk/LWJGL/src/java/org/lwjgl/BufferChecks.java 2010-09-28 21:11:35 UTC (rev 3418)
@@ -157,7 +157,7 @@
}
public static void checkArray(Object[] array) {
- if ( LWJGLUtil.CHECKS && array == null )
+ if ( LWJGLUtil.CHECKS && (array == null || array.length == 0) )
throw new IllegalArgumentException("Invalid array");
}
Modified: trunk/LWJGL/src/java/org/lwjgl/LWJGLUtil.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/LWJGLUtil.java 2010-09-27 12:09:52 UTC (rev 3417)
+++ trunk/LWJGL/src/java/org/lwjgl/LWJGLUtil.java 2010-09-28 21:11:35 UTC (rev 3418)
@@ -338,7 +338,7 @@
*/
public static String[] getLibraryPaths(String libname, String[] platform_lib_names, ClassLoader classloader) {
// need to pass path of possible locations of library to native side
- List possible_paths = new ArrayList();
+ List<String> possible_paths = new ArrayList<String>();
String classloader_path = getPathFromClassLoader(libname, classloader);
if (classloader_path != null) {
@@ -346,18 +346,17 @@
possible_paths.add(classloader_path);
}
- for (int i = 0; i < platform_lib_names.length; i++) {
- String platform_lib_name = platform_lib_names[i];
+ for ( String platform_lib_name : platform_lib_names ) {
String lwjgl_classloader_path = getPathFromClassLoader("lwjgl", classloader);
- if (lwjgl_classloader_path != null) {
+ if ( lwjgl_classloader_path != null ) {
log("getPathFromClassLoader: Path found: " + lwjgl_classloader_path);
possible_paths.add(lwjgl_classloader_path.substring(0, lwjgl_classloader_path.lastIndexOf(File.separator))
- + File.separator + platform_lib_name);
+ + File.separator + platform_lib_name);
}
// add Installer path
String alternative_path = getPrivilegedProperty("org.lwjgl.librarypath");
- if (alternative_path != null) {
+ if ( alternative_path != null ) {
possible_paths.add(alternative_path + File.separator + platform_lib_name);
}
@@ -365,7 +364,7 @@
String java_library_path = getPrivilegedProperty("java.library.path");
StringTokenizer st = new StringTokenizer(java_library_path, File.pathSeparator);
- while (st.hasMoreTokens()) {
+ while ( st.hasMoreTokens() ) {
String path = st.nextToken();
possible_paths.add(path + File.separator + platform_lib_name);
}
@@ -379,15 +378,13 @@
}
//create needed string array
- String[] paths = new String[possible_paths.size()];
- possible_paths.toArray(paths);
- return paths;
+ return possible_paths.toArray(new String[possible_paths.size()]);
}
static void execPrivileged(final String[] cmd_array) throws Exception {
try {
- Process process = (Process)AccessController.doPrivileged(new PrivilegedExceptionAction() {
- public Object run() throws Exception {
+ Process process = AccessController.doPrivileged(new PrivilegedExceptionAction<Process>() {
+ public Process run() throws Exception {
return Runtime.getRuntime().exec(cmd_array);
}
});
@@ -401,8 +398,8 @@
}
private static String getPrivilegedProperty(final String property_name) {
- return (String)AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
+ return AccessController.doPrivileged(new PrivilegedAction<String>() {
+ public String run() {
return System.getProperty(property_name);
}
});
@@ -422,16 +419,15 @@
private static String getPathFromClassLoader(final String libname, final ClassLoader classloader) {
try {
log("getPathFromClassLoader: searching for: " + libname);
- Class c = classloader.getClass();
+ Class<?> c = classloader.getClass();
while (c != null) {
- final Class clazz = c;
+ final Class<?> clazz = c;
try {
- return (String)AccessController.doPrivileged(new PrivilegedExceptionAction() {
- public Object run() throws Exception {
- Method findLibrary = clazz.getDeclaredMethod("findLibrary", new Class[]{String.class});
+ return AccessController.doPrivileged(new PrivilegedExceptionAction<String>() {
+ public String run() throws Exception {
+ Method findLibrary = clazz.getDeclaredMethod("findLibrary", String.class);
findLibrary.setAccessible(true);
- Object[] arguments = new Object[] {libname};
- String path = (String)findLibrary.invoke(classloader, arguments);
+ String path = (String)findLibrary.invoke(classloader, libname);
return path;
}
});
@@ -450,12 +446,12 @@
* Gets a boolean property as a privileged action.
*/
private static boolean getPrivilegedBoolean(final String property_name) {
- Boolean value = (Boolean)AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- return new Boolean(Boolean.getBoolean(property_name));
+ Boolean value = AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
+ public Boolean run() {
+ return Boolean.getBoolean(property_name);
}
});
- return value.booleanValue();
+ return value;
}
/**
Modified: trunk/LWJGL/src/java/org/lwjgl/LinuxSysImplementation.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/LinuxSysImplementation.java 2010-09-27 12:09:52 UTC (rev 3417)
+++ trunk/LWJGL/src/java/org/lwjgl/LinuxSysImplementation.java 2010-09-28 21:11:35 UTC (rev 3418)
@@ -39,7 +39,7 @@
* $Id$
*/
final class LinuxSysImplementation extends J2SESysImplementation {
- private final static int JNI_VERSION = 19;
+ private static final int JNI_VERSION = 19;
static {
java.awt.Toolkit.getDefaultToolkit(); // This will make sure libjawt.so is loaded
@@ -55,8 +55,7 @@
String[] browsers = {"xdg-open", "firefox", "mozilla", "opera", "konqueror", "nautilus", "galeon", "netscape"};
- for (int i = 0; i < browsers.length; i ++) {
- final String browser = browsers[i];
+ for ( final String browser : browsers ) {
try {
LWJGLUtil.execPrivileged(new String[] { browser, url });
return true;
Modified: trunk/LWJGL/src/java/org/lwjgl/MacOSXSysImplementation.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/MacOSXSysImplementation.java 2010-09-27 12:09:52 UTC (rev 3417)
+++ trunk/LWJGL/src/java/org/lwjgl/MacOSXSysImplementation.java 2010-09-28 21:11:35 UTC (rev 3418)
@@ -42,7 +42,7 @@
* $Id$
*/
final class MacOSXSysImplementation extends J2SESysImplementation {
- private final static int JNI_VERSION = 19;
+ private static final int JNI_VERSION = 19;
static {
// Make sure AWT is properly initialized. This avoids hangs on Mac OS X 10.3
Modified: trunk/LWJGL/src/java/org/lwjgl/NondirectBufferWrapper.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/NondirectBufferWrapper.java 2010-09-27 12:09:52 UTC (rev 3417)
+++ trunk/LWJGL/src/java/org/lwjgl/NondirectBufferWrapper.java 2010-09-28 21:11:35 UTC (rev 3418)
@@ -49,16 +49,16 @@
* $Id: BufferChecks.java 2762 2007-04-11 16:13:05Z elias_naur $
*/
public final class NondirectBufferWrapper {
- private final static int INITIAL_BUFFER_SIZE = 1;
+ private static final int INITIAL_BUFFER_SIZE = 1;
- private final static ThreadLocal thread_buffer = new ThreadLocal() {
- protected Object initialValue() {
+ private static final ThreadLocal<CachedBuffers> thread_buffer = new ThreadLocal<CachedBuffers>() {
+ protected CachedBuffers initialValue() {
return new CachedBuffers(INITIAL_BUFFER_SIZE);
}
};
private static CachedBuffers getCachedBuffers(int minimum_byte_size) {
- CachedBuffers buffers = (CachedBuffers)thread_buffer.get();
+ CachedBuffers buffers = thread_buffer.get();
int current_byte_size = buffers.byte_buffer.capacity();
if (minimum_byte_size > current_byte_size) {
buffers = new CachedBuffers(minimum_byte_size);
@@ -378,7 +378,7 @@
return direct_buffer;
}
- private final static class CachedBuffers {
+ private static final class CachedBuffers {
private final ByteBuffer byte_buffer;
private final ShortBuffer short_buffer_big;
private final IntBuffer int_buffer_big;
Modified: trunk/LWJGL/src/java/org/lwjgl/PointerBuffer.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/PointerBuffer.java 2010-09-27 12:09:52 UTC (rev 3417)
+++ trunk/LWJGL/src/java/org/lwjgl/PointerBuffer.java 2010-09-28 21:11:35 UTC (rev 3418)
@@ -49,7 +49,7 @@
boolean is64 = false;
try {
Method m = Class.forName("org.lwjgl.Sys").getDeclaredMethod("is64Bit", (Class[])null);
- is64 = ((Boolean)m.invoke(null, (Object[])null)).booleanValue();
+ is64 = (Boolean)m.invoke(null, (Object[])null);
} catch (Throwable t) {
// ignore
} finally {
@@ -63,10 +63,22 @@
protected final IntBuffer view32;
protected final LongBuffer view64;
+ /**
+ * Creates a new PointerBuffer with the specified capacity.
+ *
+ * @param capacity the PointerBuffer size, in number of pointers
+ */
public PointerBuffer(final int capacity) {
this(BufferUtils.createByteBuffer(capacity * getPointerSize()));
}
+ /**
+ * Creates a new PointerBuffer using the specified ByteBuffer as its pointer
+ * data source. This is useful for users that do their own memory management
+ * over a big ByteBuffer, instead of allocating many small ones.
+ *
+ * @param source the source buffer
+ */
public PointerBuffer(final ByteBuffer source) {
if ( !source.isDirect() )
throw new IllegalArgumentException("ByteBuffer is not direct");
@@ -91,6 +103,11 @@
return pointers;
}
+ /** Returns true if the underlying architecture is 64bit. */
+ public static boolean is64Bit() {
+ return is64Bit;
+ }
+
/**
* Returns the pointer size in bytes, based on the underlying architecture.
*
@@ -769,7 +786,7 @@
* @return A summary string
*/
public String toString() {
- StringBuffer sb = new StringBuffer(48);
+ StringBuilder sb = new StringBuilder(48);
sb.append(getClass().getName());
sb.append("[pos=");
sb.append(position());
Modified: trunk/LWJGL/src/java/org/lwjgl/PointerWrapperAbstract.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/PointerWrapperAbstract.java 2010-09-27 12:09:52 UTC (rev 3417)
+++ trunk/LWJGL/src/java/org/lwjgl/PointerWrapperAbstract.java 2010-09-28 21:11:35 UTC (rev 3418)
@@ -44,16 +44,30 @@
this.pointer = pointer;
}
- public final boolean isNull() {
- return pointer == 0;
+ /**
+ * Returns true if this object represents a valid pointer.
+ * The pointer might be invalid because it is NULL or because
+ * some other action has deleted the object that this pointer
+ * represents.
+ *
+ * @return true if the pointer is valid
+ */
+ public boolean isValid() {
+ return pointer != 0;
}
- public final void checkNull() {
- if ( LWJGLUtil.DEBUG && pointer == 0 )
- throw new IllegalStateException("This pointer is null.");
+ /**
+ * Checks if the pointer is valid and throws an IllegalStateException if
+ * it is not. This method is a NO-OP, unless the org.lwjgl.util.Debug
+ * property has been set to true.
+ */
+ public final void checkValid() {
+ if ( LWJGLUtil.DEBUG && !isValid() )
+ throw new IllegalStateException("This pointer is not valid.");
}
- public long getPointer() {
+ public final long getPointer() {
+ checkValid();
return pointer;
}
@@ -72,4 +86,7 @@
return (int)(pointer ^ (pointer >>> 32));
}
+ public String toString() {
+ return getClass().getSimpleName() + " pointer (0x" + Long.toHexString(pointer) + ")";
+ }
}
\ No newline at end of file
Modified: trunk/LWJGL/src/java/org/lwjgl/Sys.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/Sys.java 2010-09-27 12:09:52 UTC (rev 3417)
+++ trunk/LWJGL/src/java/org/lwjgl/Sys.java 2010-09-28 21:11:35 UTC (rev 3418)
@@ -63,7 +63,7 @@
private static final boolean is64Bit;
private static void doLoadLibrary(final String lib_name) {
- AccessController.doPrivileged(new PrivilegedAction() {
+ AccessController.doPrivileged(new PrivilegedAction<Object>() {
public Object run() {
String library_path = System.getProperty("org.lwjgl.librarypath");
if (library_path != null) {
@@ -215,22 +215,22 @@
// Attempt to use Webstart if we have it available
try {
// Lookup the javax.jnlp.BasicService object
- final Class serviceManagerClass = Class.forName("javax.jnlp.ServiceManager");
- Method lookupMethod = (Method)AccessController.doPrivileged(new PrivilegedExceptionAction() {
- public Object run() throws Exception {
- return serviceManagerClass.getMethod("lookup", new Class[] {String.class});
+ final Class<?> serviceManagerClass = Class.forName("javax.jnlp.ServiceManager");
+ Method lookupMethod = AccessController.doPrivileged(new PrivilegedExceptionAction<Method>() {
+ public Method run() throws Exception {
+ return serviceManagerClass.getMethod("lookup", String.class);
}
});
Object basicService = lookupMethod.invoke(serviceManagerClass, new Object[] {"javax.jnlp.BasicService"});
- final Class basicServiceClass = Class.forName("javax.jnlp.BasicService");
- Method showDocumentMethod = (Method)AccessController.doPrivileged(new PrivilegedExceptionAction() {
- public Object run() throws Exception {
- return basicServiceClass.getMethod("showDocument", new Class[] {URL.class});
+ final Class<?> basicServiceClass = Class.forName("javax.jnlp.BasicService");
+ Method showDocumentMethod = AccessController.doPrivileged(new PrivilegedExceptionAction<Method>() {
+ public Method run() throws Exception {
+ return basicServiceClass.getMethod("showDocument", URL.class);
}
});
try {
- Boolean ret = (Boolean) showDocumentMethod.invoke(basicService, new Object[] {new URL(url)});
- return ret.booleanValue();
+ Boolean ret = (Boolean)showDocumentMethod.invoke(basicService, new URL(url));
+ return ret;
} catch (MalformedURLException e) {
e.printStackTrace(System.err);
return false;
Modified: trunk/LWJGL/src/java/org/lwjgl/WindowsSysImplementation.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/WindowsSysImplementation.java 2010-09-27 12:09:52 UTC (rev 3417)
+++ trunk/LWJGL/src/java/org/lwjgl/WindowsSysImplementation.java 2010-09-28 21:11:35 UTC (rev 3418)
@@ -45,12 +45,12 @@
* $Id$
*/
final class WindowsSysImplementation extends DefaultSysImplementation {
- private final static int JNI_VERSION = 23;
+ private static final int JNI_VERSION = 23;
static {
Sys.initialize();
}
-
+
public int getRequiredJNIVersion() {
return JNI_VERSION;
}
@@ -64,7 +64,7 @@
}
private static native long nGetTime();
- public final boolean has64Bit() {
+ public boolean has64Bit() {
return true;
}
@@ -75,19 +75,17 @@
* public
*/
try {
- Long hwnd_obj = (Long)AccessController.doPrivileged(new PrivilegedExceptionAction() {
- public Object run() throws Exception {
- Method getImplementation_method = Display.class.getDeclaredMethod("getImplementation", null);
+ return AccessController.doPrivileged(new PrivilegedExceptionAction<Long>() {
+ public Long run() throws Exception {
+ Method getImplementation_method = Display.class.getDeclaredMethod("getImplementation");
getImplementation_method.setAccessible(true);
- Object display_impl = getImplementation_method.invoke(null, null);
- Class WindowsDisplay_class = Class.forName("org.lwjgl.opengl.WindowsDisplay");
- Method getHwnd_method = WindowsDisplay_class.getDeclaredMethod("getHwnd", null);
+ Object display_impl = getImplementation_method.invoke(null);
+ Class<?> WindowsDisplay_class = Class.forName("org.lwjgl.opengl.WindowsDisplay");
+ Method getHwnd_method = WindowsDisplay_class.getDeclaredMethod("getHwnd");
getHwnd_method.setAccessible(true);
- Long hwnd = (Long)getHwnd_method.invoke(display_impl, null);
- return hwnd;
+ return (Long)getHwnd_method.invoke(display_impl);
}
});
- return hwnd_obj.longValue();
} catch (PrivilegedActionException e) {
throw new Error(e);
}
Modified: trunk/LWJGL/src/java/org/lwjgl/examples/Game.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/examples/Game.java 2010-09-27 12:09:52 UTC (rev 3417)
+++ trunk/LWJGL/src/java/org/lwjgl/examples/Game.java 2010-09-28 21:11:35 UTC (rev 3418)
@@ -1,31 +1,31 @@
-/*
+/*
* Copyright (c) 2002-2008 LWJGL Project
* All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
+ * modification, are permitted provided that the following conditions are
* met:
- *
- * * Redistributions of source code must retain the above copyright
+ *
+ * * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * * Neither the name of 'LWJGL' nor the names of
- * its contributors may be used to endorse or promote products derived
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
@@ -35,8 +35,9 @@
import org.lwjgl.input.Keyboard;
import org.lwjgl.openal.AL;
import org.lwjgl.opengl.Display;
-import org.lwjgl.opengl.GL11;
+import static org.lwjgl.opengl.GL11.*;
+
/**
*
* This is a <em>very basic</em> skeleton to init a game and run it.
@@ -46,24 +47,24 @@
* $Id$
*/
public class Game {
-
+
/** Game title */
public static final String GAME_TITLE = "My Game";
-
+
/** Desired frame time */
private static final int FRAMERATE = 60;
-
+
/** Exit the game */
private static boolean finished;
-
+
/** A rotating square! */
private static float angle;
-
+
/**
* No constructor needed - this class is static
*/
private Game() {}
-
+
/**
* Application init
* @param args Commandline args
@@ -78,10 +79,10 @@
} finally {
cleanup();
}
-
+
System.exit(0);
}
-
+
/**
* Initialise the game
* @throws Exception if init fails
@@ -94,25 +95,25 @@
// Enable vsync if we can
Display.setVSyncEnabled(true);
-
+
Display.create();
-
+
// Start up the sound system
AL.create();
-
+
// TODO: Load in your textures etc here
-
+
// Put the window into orthographic projection mode with 1:1 pixel ratio.
// We haven't used GLU here to do this to avoid an unnecessary dependency.
- GL11.glMatrixMode(GL11.GL_PROJECTION);
- GL11.glLoadIdentity();
- GL11.glOrtho(0.0, Display.getDisplayMode().getWidth(), 0.0, Display.getDisplayMode().getHeight(), -1.0, 1.0);
- GL11.glMatrixMode(GL11.GL_MODELVIEW);
- GL11.glLoadIdentity();
- GL11.glViewport(0, 0, Display.getDisplayMode().getWidth(), Display.getDisplayMode().getHeight());
-
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ glOrtho(0.0, Display.getDisplayMode().getWidth(), 0.0, Display.getDisplayMode().getHeight(), -1.0, 1.0);
+ glMatrixMode(GL_MODELVIEW);
+ glLoadIdentity();
+ glViewport(0, 0, Display.getDisplayMode().getWidth(), Display.getDisplayMode().getHeight());
+
}
-
+
/**
* Runs the game (the "main loop")
*/
@@ -120,7 +121,7 @@
while (!finished) {
// Always call Window.update(), all the time
Display.update();
-
+
if (Display.isCloseRequested()) {
// Check for O/S close requests
finished = true;
@@ -144,7 +145,7 @@
}
}
}
-
+
/**
* Do any game-specific cleanup
*/
@@ -153,11 +154,11 @@
// Stop the sound
AL.destroy();
-
+
// Close the window
Display.destroy();
}
-
+
/**
* Do all calculations, handle input, etc.
*/
@@ -170,24 +171,24 @@
// TODO: all your game logic goes here.
angle += 2.0f % 360;
}
-
+
/**
* Render the current frame
*/
private static void render() {
- GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_STENCIL_BUFFER_BIT);
+ glClear(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
// TODO: all your rendering goes here
- GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
- GL11.glPushMatrix();
- GL11.glTranslatef(Display.getDisplayMode().getWidth() / 2, Display.getDisplayMode().getHeight() / 2, 0.0f);
- GL11.glRotatef(angle, 0, 0, 1.0f);
- GL11.glBegin(GL11.GL_QUADS);
- GL11.glVertex2i(-50, -50);
- GL11.glVertex2i(50, -50);
- GL11.glVertex2i(50, 50);
- GL11.glVertex2i(-50, 50);
- GL11.glEnd();
- GL11.glPopMatrix();
+ glClear(GL_COLOR_BUFFER_BIT);
+ glPushMatrix();
+ glTranslatef(Display.getDisplayMode().getWidth() / 2, Display.getDisplayMode().getHeight() / 2, 0.0f);
+ glRotatef(angle, 0, 0, 1.0f);
+ glBegin(GL_QUADS);
+ glVertex2i(-50, -50);
+ glVertex2i(50, -50);
+ glVertex2i(50, 50);
+ glVertex2i(-50, 50);
+ glEnd();
+ glPopMatrix();
}
}
Modified: trunk/LWJGL/src/java/org/lwjgl/examples/spaceinvaders/Entity.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/examples/spaceinvaders/Entity.java 2010-09-27 12:09:52 UTC (rev 3417)
+++ trunk/LWJGL/src/java/org/lwjgl/examples/spaceinvaders/Entity.java 2010-09-28 21:11:35 UTC (rev 3418)
@@ -1,31 +1,31 @@
-/*
+/*
* Copyright (c) 2002-2008 LWJGL Project
* All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
+ * modification, are permitted provided that the following conditions are
* met:
- *
- * * Redistributions of source code must retain the above copyright
+ *
+ * * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * * Neither the name of 'LWJGL' nor the names of
- * its contributors may be used to endorse or promote products derived
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
@@ -37,13 +37,13 @@
* An entity represents any element that appears in the game. The
* entity is responsible for resolving collisions and movement
* based on a set of properties defined either by subclass or externally.
- *
+ *
* Note that doubles are used for positions. This may seem strange
* given that pixels locations are integers. However, using double means
* that an entity can move a partial pixel. It doesn't of course mean that
* they will be display half way through a pixel but allows us not lose
* accuracy as we move.
- *
+ *
* @author Kevin Glass
*/
public abstract class Entity {
@@ -71,12 +71,12 @@
/**
* Construct a entity based on a sprite image and a location.
- *
- * @param ref The reference to the image to be displayed for this entity
+ *
+ * @param sprite The reference to the image to be displayed for this entity
* @param x The initial x location of this entity
* @param y The initial y location of this entity
*/
- public Entity(Sprite sprite, int x, int y) {
+ protected Entity(Sprite sprite, int x, int y) {
this.sprite = sprite;
this.x = x;
this.y = y;
@@ -85,7 +85,7 @@
/**
* Request that this entity move itself based on a certain ammount
* of time passing.
- *
+ *
* @param delta The ammount of time that has passed in milliseconds
*/
public void move(long delta) {
@@ -96,7 +96,7 @@
/**
* Set the horizontal speed of this entity
- *
+ *
* @param dx The horizontal speed of this entity (pixels/sec)
*/
public void setHorizontalMovement(float dx) {
@@ -105,7 +105,7 @@
/**
* Set the vertical speed of this entity
- *
+ *
* @param dy The vertical speed of this entity (pixels/sec)
*/
public void setVerticalMovement(float dy) {
@@ -114,7 +114,7 @@
/**
* Get the horizontal speed of this entity
- *
+ *
* @return The horizontal speed of this entity (pixels/sec)
*/
public float getHorizontalMovement() {
@@ -123,7 +123,7 @@
/**
* Get the vertical speed of this entity
- *
+ *
* @return The vertical speed of this entity (pixels/sec)
*/
public float getVerticalMovement() {
@@ -146,7 +146,7 @@
/**
* Get the x location of this entity
- *
+ *
* @return The x location of this entity
*/
public int getX() {
@@ -155,7 +155,7 @@
/**
* Get the y location of this entity
- *
+ *
* @return The y location of this entity
*/
public int getY() {
@@ -164,7 +164,7 @@
/**
* Check if this entity collised with another.
- *
+ *
* @param other The other entity to check collision against
* @return True if the entities collide with each other
*/
@@ -177,7 +177,7 @@
/**
* Notification that this entity collided with another.
- *
+ *
* @param other The entity with which this entity collided.
*/
public abstract void collidedWith(Entity other);
Modified: trunk/LWJGL/src/java/org/lwjgl/examples/spaceinvaders/Game.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/examples/spaceinvaders/Game.java 2010-09-27 12:09:52 UTC (rev 3417)
+++ trunk/LWJGL/src/java/org/lwjgl/examples/spaceinvaders/Game.java 2010-09-28 21:11:35 UTC (rev 3418)
@@ -1,31 +1,31 @@
-/*
+/*
* Copyright (c) 2002-2008 LWJGL Project
* All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
+ * modification, are permitted provided that the following conditions are
* met:
- *
- * * Redistributions of source code must retain the above copyright
+ *
+ * * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * * Neither the name of 'LWJGL' nor the names of
- * its contributors may be used to endorse or promote products derived
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
@@ -39,32 +39,33 @@
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.DisplayMode;
-import org.lwjgl.opengl.GL11;
+import static org.lwjgl.opengl.GL11.*;
+
/**
* The main hook of our game. This class with both act as a manager
- * for the display and central mediator for the game logic.
- *
+ * for the display and central mediator for the game logic.
+ *
* Display management will consist of a loop that cycles round all
* entities in the game asking them to move and then drawing them
* in the appropriate place. With the help of an inner class it
* will also allow the player to control the main ship.
- *
+ *
* As a mediator it will be informed when entities within our game
* detect events (e.g. alient killed, played died) and will take
* appropriate game actions.
- *
+ *
* <p>
* NOTE:<br>
* This game is a LWJGLized implementation of the Space Invaders game by Kevin
- * Glass. The original implementation is renderer agnostic and supports other
+ * Glass. The original implementation is renderer agnostic and supports other
* OpenGL implementations as well as Java2D. This version has been made specific
- * for LWJGL, and has added input control as well as sound (which the original doesn't,
+ * for LWJGL, and has added input control as well as sound (which the original doesn't,
* at the time of writing).
* You can find the original article here:<br>
* <a href="http://www.cokeandcode.com/" target="_blank">http://www.cokeandcode.com</a>
* </p>
- *
+ *
* @author Kevin Glass
* @author Brian Matzon
*/
@@ -83,10 +84,10 @@
private TextureLoader textureLoader;
/** The list of all the entities that exist in our game */
- private ArrayList entities = new ArrayList();
+ private ArrayList<Entity> entities = new ArrayList<Entity>();
/** The list of entities that need to be removed from the game this loop */
- private ArrayList removeList = new ArrayList();
+ private ArrayList<Entity> removeList = new ArrayList<Entity>();
/** The entity representing the player */
private ShipEntity ship;
@@ -113,7 +114,7 @@
private float moveSpeed = 300;
/** The time at which last fired a shot */
- private long lastFire = 0;
+ private long lastFire;
/** The interval between our players shot (ms) */
private long firingInterval = 500;
@@ -125,16 +126,16 @@
private boolean waitingForKeyPress = true;
/** True if game logic needs to be applied this loop, normally as a result of a game event */
- private boolean logicRequiredThisLoop = false;
+ private boolean logicRequiredThisLoop;
/** The time at which the last rendering looped started from the point of view of the game logic */
private long lastLoopTime = getTime();
/** True if the fire key has been released */
- private boolean fireHasBeenReleased = false;
+ private boolean fireHasBeenReleased;
/** The time since the last record of fps */
- private long lastFpsTime = 0;
+ private long lastFpsTime;
/** The recorded fps */
private int fps;
@@ -167,15 +168,14 @@
/** Mouse movement on x axis */
private int mouseX;
-
+
/** Is this an application or applet */
- private static boolean isApplication = false;
+ private static boolean isApplication;
/**
* Construct our game and set it running.
* @param fullscreen
- *
- * @param renderingType The type of rendering to use (should be one of the contansts from ResourceFactory)
+ *
*/
public Game(boolean fullscreen) {
this.fullscreen = fullscreen;
@@ -184,7 +184,7 @@
/**
* Get the high resolution time in milliseconds
- *
+ *
* @return The high resolution time in milliseconds
*/
public static long getTime() {
@@ -196,8 +196,8 @@
}
/**
- * Sleep for a fixed number of milliseconds.
- *
+ * Sleep for a fixed number of milliseconds.
+ *
* @param duration The amount of time in milliseconds to sleep for
*/
public static void sleep(long duration) {
@@ -217,25 +217,25 @@
Display.setTitle(WINDOW_TITLE);
Display.setFullscreen(fullscreen);
Display.create();
-
+
// grab the mouse, dont want that hideous cursor when we're playing!
- if (isApplication) {
+ if (isApplication) {
Mouse.setGrabbed(true);
}
// enable textures since we're going to use these for our sprites
- GL11.glEnable(GL11.GL_TEXTURE_2D);
+ glEnable(GL_TEXTURE_2D);
// disable the OpenGL depth test since we're rendering 2D graphics
- GL11.glDisable(GL11.GL_DEPTH_TEST);
+ glDisable(GL_DEPTH_TEST);
- GL11.glMatrixMode(GL11.GL_PROJECTION);
- GL11.glLoadIdentity();
+ glMatrixMode(GL_PROJECTION);
+ glLoad...
[truncated message content] |
|
From: <sp...@us...> - 2010-09-27 12:10:00
|
Revision: 3417
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3417&view=rev
Author: spasi
Date: 2010-09-27 12:09:52 +0000 (Mon, 27 Sep 2010)
Log Message:
-----------
LWJGL 2.5 - JDK1.4 compatible branch
Added Paths:
-----------
branches/lwjgl2.5/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2010-09-27 00:26:11
|
Revision: 3416
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3416&view=rev
Author: spasi
Date: 2010-09-27 00:25:59 +0000 (Mon, 27 Sep 2010)
Log Message:
-----------
Added AL/CL NativeGetFunctionPointer prefixes.
Modified Paths:
--------------
trunk/LWJGL/src/native/macosx/macosx_al.c
trunk/LWJGL/src/native/macosx/macosx_cl.c
Modified: trunk/LWJGL/src/native/macosx/macosx_al.c
===================================================================
--- trunk/LWJGL/src/native/macosx/macosx_al.c 2010-09-27 00:13:31 UTC (rev 3415)
+++ trunk/LWJGL/src/native/macosx/macosx_al.c 2010-09-27 00:25:59 UTC (rev 3416)
@@ -52,7 +52,7 @@
static const struct mach_header* handleOAL = NULL;
static CFBundleRef openal_bundle = NULL;
-void *NativeGetFunctionPointer(const char *function) {
+void *extal_NativeGetFunctionPointer(const char *function) {
void *address = NULL;
if (handleOAL != NULL) {
char *mac_symbol_name = (char *)malloc((strlen(function) + 2)*sizeof(char));
Modified: trunk/LWJGL/src/native/macosx/macosx_cl.c
===================================================================
--- trunk/LWJGL/src/native/macosx/macosx_cl.c 2010-09-27 00:13:31 UTC (rev 3415)
+++ trunk/LWJGL/src/native/macosx/macosx_cl.c 2010-09-27 00:25:59 UTC (rev 3416)
@@ -46,7 +46,7 @@
static const struct mach_header* handleOCL = NULL;
static CFBundleRef opencl_bundle = NULL;
-void *NativeGetFunctionPointer(const char *function) {
+void *extcl_NativeGetFunctionPointer(const char *function) {
void *address = NULL;
if (handleOCL != NULL) {
char *mac_symbol_name = (char *)malloc((strlen(function) + 2)*sizeof(char));
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2010-09-27 00:13:37
|
Revision: 3415
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3415&view=rev
Author: spasi
Date: 2010-09-27 00:13:31 +0000 (Mon, 27 Sep 2010)
Log Message:
-----------
Apple's cl_platform.h is missing CL_CALLBACK.
Modified Paths:
--------------
trunk/LWJGL/src/native/common/extcl.h
Modified: trunk/LWJGL/src/native/common/extcl.h
===================================================================
--- trunk/LWJGL/src/native/common/extcl.h 2010-09-26 23:49:09 UTC (rev 3414)
+++ trunk/LWJGL/src/native/common/extcl.h 2010-09-27 00:13:31 UTC (rev 3415)
@@ -55,8 +55,12 @@
// -----------------[ Callback function typedefs ]-----------------
+#ifndef CL_CALLBACK
+ #define CL_CALLBACK
+#endif
+
// TODO: This is a bug in current CL implementations (AMD's only?), remove when fixed. (used for cl_native_kernel_func)
-#if defined(_WIN32)
+#if defined(_WIN32) || defined(_WIN64)
#define CL_USER_FUNC_CALLBACK __cdecl
#else
#define CL_USER_FUNC_CALLBACK CL_CALLBACK
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2010-09-26 23:49:15
|
Revision: 3414
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3414&view=rev
Author: spasi
Date: 2010-09-26 23:49:09 +0000 (Sun, 26 Sep 2010)
Log Message:
-----------
Typo fix.
Modified Paths:
--------------
trunk/LWJGL/platform_build/build-definitions.xml
Modified: trunk/LWJGL/platform_build/build-definitions.xml
===================================================================
--- trunk/LWJGL/platform_build/build-definitions.xml 2010-09-26 23:44:19 UTC (rev 3413)
+++ trunk/LWJGL/platform_build/build-definitions.xml 2010-09-26 23:49:09 UTC (rev 3414)
@@ -50,7 +50,7 @@
<include name="org/lwjgl/test/opengl/shaders/*.vp" />
<include name="org/lwjgl/test/opengl/shaders/*.vsh" />
<include name="org/lwjgl/test/opengl/shaders/*.fsh" />
- <include name="org/lwjgl/test/opencl/gl/*.cl />
+ <include name="org/lwjgl/test/opencl/gl/*.cl" />
</fileset>
<!-- Files to include in the lwjgl_util.jar file -->
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2010-09-26 23:44:28
|
Revision: 3413
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3413&view=rev
Author: spasi
Date: 2010-09-26 23:44:19 +0000 (Sun, 26 Sep 2010)
Log Message:
-----------
Added APPLE's cl_platform.h
Added Paths:
-----------
trunk/LWJGL/src/native/common/OpenCL/
trunk/LWJGL/src/native/common/OpenCL/cl_platform.h
Added: trunk/LWJGL/src/native/common/OpenCL/cl_platform.h
===================================================================
--- trunk/LWJGL/src/native/common/OpenCL/cl_platform.h (rev 0)
+++ trunk/LWJGL/src/native/common/OpenCL/cl_platform.h 2010-09-26 23:44:19 UTC (rev 3413)
@@ -0,0 +1,296 @@
+/**********************************************************************************
+ * Copyright (c) 2008-2009 The Khronos Group Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and/or associated documentation files (the
+ * "Materials"), to deal in the Materials without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Materials, and to
+ * permit persons to whom the Materials are furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Materials.
+ *
+ * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+ **********************************************************************************/
+
+#ifndef __CL_PLATFORM_H
+#define __CL_PLATFORM_H
+
+#ifdef __APPLE__
+ /* Contains #defines for AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER below */
+ #include <AvailabilityMacros.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define CL_API_ENTRY
+#define CL_API_CALL
+#ifdef __APPLE__
+#define CL_API_SUFFIX__VERSION_1_0 AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER
+#define CL_EXTENSION_WEAK_LINK __attribute__((weak_import))
+#else
+#define CL_API_SUFFIX__VERSION_1_0
+#define CL_EXTENSION_WEAK_LINK
+#endif
+
+#if (defined (WIN32) && (_MSC_VER))
+
+/* scalar types */
+typedef signed __int8 cl_char;
+typedef unsigned __int8 cl_uchar;
+typedef signed __int16 cl_short;
+typedef unsigned __int16 cl_ushort;
+typedef signed __int32 cl_int;
+typedef unsigned __int32 cl_uint;
+typedef signed __int64 cl_long;
+typedef unsigned __int64 cl_ulong;
+
+typedef unsigned __int16 cl_half;
+typedef float cl_float;
+typedef double cl_double;
+
+
+/*
+ * Vector types
+ *
+ * Note: OpenCL requires that all types be naturally aligned.
+ * This means that vector types must be naturally aligned.
+ * For example, a vector of four floats must be aligned to
+ * a 16 byte boundary (calculated as 4 * the natural 4-byte
+ * alignment of the float). The alignment qualifiers here
+ * will only function properly if your compiler supports them
+ * and if you don't actively work to defeat them. For example,
+ * in order for a cl_float4 to be 16 byte aligned in a struct,
+ * the start of the struct must itself be 16-byte aligned.
+ *
+ * Maintaining proper alignment is the user's responsibility.
+ */
+typedef signed __int8 cl_char2[2];
+typedef signed __int8 cl_char4[4];
+typedef signed __int8 cl_char8[8];
+typedef signed __int8 cl_char16[16];
+typedef unsigned __int8 cl_uchar2[2];
+typedef unsigned __int8 cl_uchar4[4];
+typedef unsigned __int8 cl_uchar8[8];
+typedef unsigned __int8 cl_uchar16[16];
+
+typedef signed __int16 cl_short2[2];
+typedef signed __int16 cl_short4[4];
+typedef signed __int16 cl_short8[8];
+typedef signed __int16 cl_short16[16];
+typedef unsigned __int16 cl_ushort2[2];
+typedef unsigned __int16 cl_ushort4[4];
+typedef unsigned __int16 cl_ushort8[8];
+typedef unsigned __int16 cl_ushort16[16];
+
+typedef signed __int32 cl_int2[2];
+typedef signed __int32 cl_int4[4];
+typedef signed __int32 cl_int8[8];
+typedef signed __int32 cl_int16[16];
+typedef unsigned __int32 cl_uint2[2];
+typedef unsigned __int32 cl_uint4[4];
+typedef unsigned __int32 cl_uint8[8];
+typedef unsigned __int32 cl_uint16[16];
+
+typedef signed __int64 cl_long2[2];
+typedef signed __int64 cl_long4[4];
+typedef signed __int64 cl_long8[8];
+typedef signed __int64 cl_long16[16];
+typedef unsigned __int64 cl_ulong2[2];
+typedef unsigned __int64 cl_ulong4[4];
+typedef unsigned __int64 cl_ulong8[8];
+typedef unsigned __int64 cl_ulong16[16];
+
+typedef float cl_float2[2];
+typedef float cl_float4[4];
+typedef float cl_float8[8];
+typedef float cl_float16[16];
+
+typedef double cl_double2[2];
+typedef double cl_double4[4];
+typedef double cl_double8[8];
+typedef double cl_double16[16];
+/* There are no vector types for half */
+
+#define CL_CHAR_BIT 8
+#define CL_SCHAR_MAX 127
+#define CL_SCHAR_MIN (-127-1)
+#define CL_CHAR_MAX CL_SCHAR_MAX
+#define CL_CHAR_MIN CL_SCHAR_MIN
+#define CL_UCHAR_MAX 255
+#define CL_SHRT_MAX 32767
+#define CL_SHRT_MIN (-32767-1)
+#define CL_USHRT_MAX 65535
+#define CL_INT_MAX 2147483647
+#define CL_INT_MIN (-2147483647-1)
+#define CL_UINT_MAX 0xffffffffU
+#define CL_LONG_MAX ((cl_long) 0x7FFFFFFFFFFFFFFFLL)
+#define CL_LONG_MIN ((cl_long) -0x7FFFFFFFFFFFFFFFLL - 1LL)
+#define CL_ULONG_MAX ((cl_ulong) 0xFFFFFFFFFFFFFFFFULL)
+
+#define CL_FLT_DIG 6
+#define CL_FLT_MANT_DIG 24
+#define CL_FLT_MAX_10_EXP +38
+#define CL_FLT_MAX_EXP +128
+#define CL_FLT_MIN_10_EXP -37
+#define CL_FLT_MIN_EXP -125
+#define CL_FLT_RADIX 2
+#define CL_FLT_MAX 340282346638528859811704183484516925440.0f
+#define CL_FLT_MIN 1.175494350822287507969e-38f
+#define CL_FLT_EPSILON 0x1.0p-23f
+
+#define CL_DBL_DIG 15
+#define CL_DBL_MANT_DIG 53
+#define CL_DBL_MAX_10_EXP +308
+#define CL_DBL_MAX_EXP +1024
+#define CL_DBL_MIN_10_EXP -307
+#define CL_DBL_MIN_EXP -1021
+#define CL_DBL_RADIX 2
+#define CL_DBL_MAX 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.0
+#define CL_DBL_MIN 2.225073858507201383090e-308
+#define CL_DBL_EPSILON 2.220446049250313080847e-16
+
+
+#else
+
+#include <stdint.h>
+
+/* scalar types */
+typedef int8_t cl_char;
+typedef uint8_t cl_uchar;
+typedef int16_t cl_short __attribute__((aligned(2)));
+typedef uint16_t cl_ushort __attribute__((aligned(2)));
+typedef int32_t cl_int __attribute__((aligned(4)));
+typedef uint32_t cl_uint __attribute__((aligned(4)));
+typedef int64_t cl_long __attribute__((aligned(8)));
+typedef uint64_t cl_ulong __attribute__((aligned(8)));
+
+typedef uint16_t cl_half __attribute__((aligned(2)));
+typedef float cl_float __attribute__((aligned(4)));
+typedef double cl_double __attribute__((aligned(8)));
+
+/*
+ * Vector types
+ *
+ * Note: OpenCL requires that all types be naturally aligned.
+ * This means that vector types must be naturally aligned.
+ * For example, a vector of four floats must be aligned to
+ * a 16 byte boundary (calculated as 4 * the natural 4-byte
+ * alignment of the float). The alignment qualifiers here
+ * will only function properly if your compiler supports them
+ * and if you don't actively work to defeat them. For example,
+ * in order for a cl_float4 to be 16 byte aligned in a struct,
+ * the start of the struct must itself be 16-byte aligned.
+ *
+ * Maintaining proper alignment is the user's responsibility.
+ */
+typedef int8_t cl_char2[2] __attribute__((aligned(2)));
+typedef int8_t cl_char4[4] __attribute__((aligned(4)));
+typedef int8_t cl_char8[8] __attribute__((aligned(8)));
+typedef int8_t cl_char16[16] __attribute__((aligned(16)));
+typedef uint8_t cl_uchar2[2] __attribute__((aligned(2)));
+typedef uint8_t cl_uchar4[4] __attribute__((aligned(4)));
+typedef uint8_t cl_uchar8[8] __attribute__((aligned(8)));
+typedef uint8_t cl_uchar16[16] __attribute__((aligned(16)));
+
+typedef int16_t cl_short2[2] __attribute__((aligned(4)));
+typedef int16_t cl_short4[4] __attribute__((aligned(8)));
+typedef int16_t cl_short8[8] __attribute__((aligned(16)));
+typedef int16_t cl_short16[16] __attribute__((aligned(32)));
+typedef uint16_t cl_ushort2[2] __attribute__((aligned(4)));
+typedef uint16_t cl_ushort4[4] __attribute__((aligned(8)));
+typedef uint16_t cl_ushort8[8] __attribute__((aligned(16)));
+typedef uint16_t cl_ushort16[16] __attribute__((aligned(32)));
+
+typedef int32_t cl_int2[2] __attribute__((aligned(8)));
+typedef int32_t cl_int4[4] __attribute__((aligned(16)));
+typedef int32_t cl_int8[8] __attribute__((aligned(32)));
+typedef int32_t cl_int16[16] __attribute__((aligned(64)));
+typedef uint32_t cl_uint2[2] __attribute__((aligned(8)));
+typedef uint32_t cl_uint4[4] __attribute__((aligned(16)));
+typedef uint32_t cl_uint8[8] __attribute__((aligned(32)));
+typedef uint32_t cl_uint16[16] __attribute__((aligned(64)));
+
+typedef int64_t cl_long2[2] __attribute__((aligned(16)));
+typedef int64_t cl_long4[4] __attribute__((aligned(32)));
+typedef int64_t cl_long8[8] __attribute__((aligned(64)));
+typedef int64_t cl_long16[16] __attribute__((aligned(128)));
+typedef uint64_t cl_ulong2[2] __attribute__((aligned(16)));
+typedef uint64_t cl_ulong4[4] __attribute__((aligned(32)));
+typedef uint64_t cl_ulong8[8] __attribute__((aligned(64)));
+typedef uint64_t cl_ulong16[16] __attribute__((aligned(128)));
+
+typedef float cl_float2[2] __attribute__((aligned(8)));
+typedef float cl_float4[4] __attribute__((aligned(16)));
+typedef float cl_float8[8] __attribute__((aligned(32)));
+typedef float cl_float16[16] __attribute__((aligned(64)));
+
+typedef double cl_double2[2] __attribute__((aligned(16)));
+typedef double cl_double4[4] __attribute__((aligned(32)));
+typedef double cl_double8[8] __attribute__((aligned(64)));
+typedef double cl_double16[16] __attribute__((aligned(128)));
+
+/* There are no vector types for half */
+
+/******************************************************************************/
+
+// Macro names and corresponding values defined by OpenCL
+
+#define CL_CHAR_BIT 8
+#define CL_SCHAR_MAX 127
+#define CL_SCHAR_MIN (-127-1)
+#define CL_CHAR_MAX CL_SCHAR_MAX
+#define CL_CHAR_MIN CL_SCHAR_MIN
+#define CL_UCHAR_MAX 255
+#define CL_SHRT_MAX 32767
+#define CL_SHRT_MIN (-32767-1)
+#define CL_USHRT_MAX 65535
+#define CL_INT_MAX 2147483647
+#define CL_INT_MIN (-2147483647-1)
+#define CL_UINT_MAX 0xffffffffU
+#define CL_LONG_MAX ((cl_long) 0x7FFFFFFFFFFFFFFFLL)
+#define CL_LONG_MIN ((cl_long) -0x7FFFFFFFFFFFFFFFLL - 1LL)
+#define CL_ULONG_MAX ((cl_ulong) 0xFFFFFFFFFFFFFFFFULL)
+
+#define CL_FLT_DIG 6
+#define CL_FLT_MANT_DIG 24
+#define CL_FLT_MAX_10_EXP +38
+#define CL_FLT_MAX_EXP +128
+#define CL_FLT_MIN_10_EXP -37
+#define CL_FLT_MIN_EXP -125
+#define CL_FLT_RADIX 2
+#define CL_FLT_MAX 0x1.fffffep127f
+#define CL_FLT_MIN 0x1.0p-126f
+#define CL_FLT_EPSILON 0x1.0p-23f
+
+#define CL_DBL_DIG 15
+#define CL_DBL_MANT_DIG 53
+#define CL_DBL_MAX_10_EXP +308
+#define CL_DBL_MAX_EXP +1024
+#define CL_DBL_MIN_10_EXP -307
+#define CL_DBL_MIN_EXP -1021
+#define CL_DBL_RADIX 2
+#define CL_DBL_MAX 0x1.fffffffffffffp1023
+#define CL_DBL_MIN 0x1.0p-1022
+#define CL_DBL_EPSILON 0x1.0p-52
+
+#endif
+
+#include <stddef.h>
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // __CL_PLATFORM_H
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2010-09-26 23:43:37
|
Revision: 3412
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3412&view=rev
Author: spasi
Date: 2010-09-26 23:43:24 +0000 (Sun, 26 Sep 2010)
Log Message:
-----------
Added support for OpenCL & CL/GL interop + minor improvements. [WIP]
Modified Paths:
--------------
trunk/LWJGL/build.xml
trunk/LWJGL/platform_build/build-definitions.xml
trunk/LWJGL/platform_build/build-generator.xml
trunk/LWJGL/platform_build/linux_ant/build.xml
trunk/LWJGL/src/java/org/lwjgl/BufferChecks.java
trunk/LWJGL/src/java/org/lwjgl/BufferUtils.java
trunk/LWJGL/src/java/org/lwjgl/LWJGLUtil.java
trunk/LWJGL/src/java/org/lwjgl/Sys.java
trunk/LWJGL/src/java/org/lwjgl/opengl/AMDDebugOutputCallback.java
trunk/LWJGL/src/java/org/lwjgl/opengl/ARBDebugOutputCallback.java
trunk/LWJGL/src/java/org/lwjgl/opengl/AWTGLCanvas.java
trunk/LWJGL/src/java/org/lwjgl/opengl/AbstractDrawable.java
trunk/LWJGL/src/java/org/lwjgl/opengl/Context.java
trunk/LWJGL/src/java/org/lwjgl/opengl/ContextAttribs.java
trunk/LWJGL/src/java/org/lwjgl/opengl/Drawable.java
trunk/LWJGL/src/java/org/lwjgl/opengl/GLSync.java
trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxContextImplementation.java
trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsContextImplementation.java
trunk/LWJGL/src/java/org/lwjgl/test/opengl/VersionTest.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/Alternate.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/AutoSize.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/Check.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/Code.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/Constant.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/GenerateAutos.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorProcessorFactory.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorVisitor.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/JNITypeTranslator.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaTypeTranslator.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/NativeMethodStubsGenerator.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/NativeType.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/NativeTypeTranslator.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/PostfixTranslator.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/RegisterStubsGenerator.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/SignatureTranslator.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/TypeInfo.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/TypeMap.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/TypedefsGenerator.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/Utils.java
trunk/LWJGL/src/native/common/common_tools.c
trunk/LWJGL/src/native/common/common_tools.h
trunk/LWJGL/src/native/common/extal.c
trunk/LWJGL/src/native/common/extal.h
trunk/LWJGL/src/native/common/extgl.h
trunk/LWJGL/src/native/common/org_lwjgl_openal_AL.c
trunk/LWJGL/src/native/linux/linux_al.c
trunk/LWJGL/src/native/linux/org_lwjgl_opengl_LinuxContextImplementation.c
trunk/LWJGL/src/native/macosx/macosx_al.c
trunk/LWJGL/src/native/windows/org_lwjgl_opengl_WindowsContextImplementation.c
trunk/LWJGL/src/native/windows/windows_al.c
trunk/LWJGL/src/templates/org/lwjgl/openal/AL10.java
trunk/LWJGL/src/templates/org/lwjgl/openal/AL11.java
trunk/LWJGL/src/templates/org/lwjgl/openal/EFX10.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/AMD_debug_output.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/AMD_draw_buffers_blend.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/AMD_name_gen_delete.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/AMD_performance_monitor.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/AMD_vertex_shader_tessellator.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_element_array.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_fence.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_flush_buffer_range.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_object_purgeable.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_texture_range.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_vertex_array_object.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_vertex_array_range.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_vertex_program_evaluators.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_ES2_compatibility.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_blend_func_extended.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_buffer_object.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_color_buffer_float.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_copy_buffer.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_debug_output.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_draw_buffers.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_draw_buffers_blend.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_draw_elements_base_vertex.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_draw_indirect.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_draw_instanced.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_framebuffer_object.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_geometry_shader4.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_get_program_binary.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_gpu_shader_fp64.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_imaging.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_instanced_arrays.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_map_buffer_range.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_matrix_palette.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_multisample.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_multitexture.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_occlusion_query.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_point_parameters.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_program.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_provoking_vertex.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_robustness.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_sample_shading.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_sampler_objects.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_separate_shader_objects.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shader_objects.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shader_subroutine.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shading_language_include.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_sync.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_tessellation_shader.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_texture_buffer_object.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_texture_compression.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_texture_multisample.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_timer_query.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_transform_feedback2.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_transform_feedback3.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_uniform_buffer_object.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_vertex_array_object.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_vertex_attrib_64bit.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_vertex_blend.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_vertex_program.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_vertex_shader.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_vertex_type_2_10_10_10_rev.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_viewport_array.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ATI_draw_buffers.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ATI_element_array.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ATI_envmap_bumpmap.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ATI_fragment_shader.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ATI_map_object_buffer.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ATI_pn_triangles.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ATI_separate_stencil.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ATI_vertex_array_object.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ATI_vertex_attrib_array_object.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ATI_vertex_streams.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_bindable_uniform.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_blend_color.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_blend_equation_separate.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_blend_func_separate.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_blend_minmax.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_compiled_vertex_array.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_depth_bounds_test.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_direct_state_access.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_draw_buffers2.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_draw_instanced.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_draw_range_elements.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_fog_coord.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_framebuffer_blit.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_framebuffer_multisample.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_framebuffer_object.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_geometry_shader4.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_gpu_program_parameters.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_gpu_shader4.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_multi_draw_arrays.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_paletted_texture.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_point_parameters.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_provoking_vertex.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_secondary_color.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_separate_shader_objects.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_shader_image_load_store.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_stencil_clear_tag.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_stencil_two_side.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_texture_array.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_texture_buffer_object.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_texture_integer.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_timer_query.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_transform_feedback.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_vertex_attrib_64bit.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_vertex_shader.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_vertex_weighting.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/GL11.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/GL12.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/GL13.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/GL14.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/GL15.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/GL20.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/GL21.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/GL30.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/GL31.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/GL32.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/GL33.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/GL40.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/GL41.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/GREMEDY_string_marker.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_conditional_render.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_copy_image.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_evaluators.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_explicit_multisample.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_fence.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_fragment_program.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_framebuffer_multisample_coverage.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_geometry_program4.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_gpu_program4.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_gpu_shader5.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_half_float.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_occlusion_query.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_parameter_buffer_object.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_pixel_data_range.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_point_sprite.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_primitive_restart.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_program.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_register_combiners.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_register_combiners2.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_shader_buffer_load.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_transform_feedback.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_transform_feedback2.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_vertex_array_range.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_vertex_attrib_integer_64bit.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_vertex_buffer_unified_memory.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_vertex_program.java
Added Paths:
-----------
trunk/LWJGL/src/java/org/lwjgl/PointerBuffer.java
trunk/LWJGL/src/java/org/lwjgl/PointerWrapper.java
trunk/LWJGL/src/java/org/lwjgl/PointerWrapperAbstract.java
trunk/LWJGL/src/java/org/lwjgl/opencl/
trunk/LWJGL/src/java/org/lwjgl/opencl/APIUtil.java
trunk/LWJGL/src/java/org/lwjgl/opencl/APPLEContextLoggingUtil.java
trunk/LWJGL/src/java/org/lwjgl/opencl/CL.java
trunk/LWJGL/src/java/org/lwjgl/opencl/CLBuildProgramCallback.java
trunk/LWJGL/src/java/org/lwjgl/opencl/CLCallback.java
trunk/LWJGL/src/java/org/lwjgl/opencl/CLChecks.java
trunk/LWJGL/src/java/org/lwjgl/opencl/CLCommandQueue.java
trunk/LWJGL/src/java/org/lwjgl/opencl/CLContext.java
trunk/LWJGL/src/java/org/lwjgl/opencl/CLContextCallback.java
trunk/LWJGL/src/java/org/lwjgl/opencl/CLDevice.java
trunk/LWJGL/src/java/org/lwjgl/opencl/CLDeviceImpl.java
trunk/LWJGL/src/java/org/lwjgl/opencl/CLEvent.java
trunk/LWJGL/src/java/org/lwjgl/opencl/CLEventCallback.java
trunk/LWJGL/src/java/org/lwjgl/opencl/CLFunctionAddress.java
trunk/LWJGL/src/java/org/lwjgl/opencl/CLKernel.java
trunk/LWJGL/src/java/org/lwjgl/opencl/CLKernelImpl.java
trunk/LWJGL/src/java/org/lwjgl/opencl/CLMem.java
trunk/LWJGL/src/java/org/lwjgl/opencl/CLMemObjectDestructorCallback.java
trunk/LWJGL/src/java/org/lwjgl/opencl/CLNativeKernel.java
trunk/LWJGL/src/java/org/lwjgl/opencl/CLObject.java
trunk/LWJGL/src/java/org/lwjgl/opencl/CLObjectChild.java
trunk/LWJGL/src/java/org/lwjgl/opencl/CLObjectRegistry.java
trunk/LWJGL/src/java/org/lwjgl/opencl/CLObjectRegistryGlobal.java
trunk/LWJGL/src/java/org/lwjgl/opencl/CLPlatform.java
trunk/LWJGL/src/java/org/lwjgl/opencl/CLPlatformImpl.java
trunk/LWJGL/src/java/org/lwjgl/opencl/CLProgram.java
trunk/LWJGL/src/java/org/lwjgl/opencl/CLSampler.java
trunk/LWJGL/src/java/org/lwjgl/opencl/CallbackUtil.java
trunk/LWJGL/src/java/org/lwjgl/opencl/OpenCLException.java
trunk/LWJGL/src/java/org/lwjgl/opencl/Util.java
trunk/LWJGL/src/java/org/lwjgl/opencl/api/
trunk/LWJGL/src/java/org/lwjgl/opencl/api/Filter.java
trunk/LWJGL/src/java/org/lwjgl/opengl/APIUtil.java
trunk/LWJGL/src/java/org/lwjgl/opengl/CallbackUtil.java
trunk/LWJGL/src/java/org/lwjgl/test/opencl/
trunk/LWJGL/src/java/org/lwjgl/test/opencl/HelloOpenCL.java
trunk/LWJGL/src/java/org/lwjgl/test/opencl/gl/
trunk/LWJGL/src/java/org/lwjgl/test/opencl/gl/DemoFractal.java
trunk/LWJGL/src/java/org/lwjgl/test/opencl/gl/Mandelbrot.cl
trunk/LWJGL/src/java/org/lwjgl/util/generator/Extern.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/Helper.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/Imports.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/PointerArray.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/PointerWrapper.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/Private.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/Reuse.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/openal/
trunk/LWJGL/src/java/org/lwjgl/util/generator/openal/ALTypeMap.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/openal/ALboolean.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/openal/ALbyte.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/openal/ALdouble.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/openal/ALenum.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/openal/ALfloat.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/openal/ALint.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/openal/ALshort.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/openal/ALsizei.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/openal/ALubyte.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/openal/ALuint.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/openal/ALvoid.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/opencl/
trunk/LWJGL/src/java/org/lwjgl/util/generator/opencl/CLCapabilitiesGenerator.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/opencl/CLDeviceExtension.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/opencl/CLGeneratorProcessorFactory.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/opencl/CLPDCapabilitiesGenerator.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/opencl/CLPlatformExtension.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/opencl/CLTypeMap.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/opencl/cl_bitfield.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/opencl/cl_bool.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/opencl/cl_byte.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/opencl/cl_char.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/opencl/cl_double.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/opencl/cl_float.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/opencl/cl_int.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/opencl/cl_long.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/opencl/cl_short.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/opencl/cl_uchar.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/opencl/cl_uint.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/opencl/cl_void.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/opencl/size_t.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/opengl/
trunk/LWJGL/src/java/org/lwjgl/util/generator/opengl/GLCapabilitiesGenerator.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/opengl/GLGeneratorProcessorFactory.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/opengl/GLReferencesGeneratorProcessorFactory.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/opengl/GLTypeMap.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/opengl/GLbitfield.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/opengl/GLboolean.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/opengl/GLbyte.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/opengl/GLchar.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/opengl/GLcharARB.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/opengl/GLclampd.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/opengl/GLclampf.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/opengl/GLdouble.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/opengl/GLenum.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/opengl/GLfloat.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/opengl/GLhalf.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/opengl/GLhandleARB.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/opengl/GLint.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/opengl/GLint64.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/opengl/GLint64EXT.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/opengl/GLintptr.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/opengl/GLintptrARB.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/opengl/GLreturn.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/opengl/GLshort.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/opengl/GLsizei.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/opengl/GLsizeiptr.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/opengl/GLsizeiptrARB.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/opengl/GLtime.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/opengl/GLubyte.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/opengl/GLuint.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/opengl/GLuint64.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/opengl/GLuint64EXT.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/opengl/GLushort.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/opengl/GLvoid.java
trunk/LWJGL/src/native/common/CL/
trunk/LWJGL/src/native/common/CL/cl.h
trunk/LWJGL/src/native/common/CL/cl_d3d10.h
trunk/LWJGL/src/native/common/CL/cl_ext.h
trunk/LWJGL/src/native/common/CL/cl_gl.h
trunk/LWJGL/src/native/common/CL/cl_gl_ext.h
trunk/LWJGL/src/native/common/CL/cl_platform.h
trunk/LWJGL/src/native/common/extcl.c
trunk/LWJGL/src/native/common/extcl.h
trunk/LWJGL/src/native/common/extcl_types.h
trunk/LWJGL/src/native/common/extgl_types.h
trunk/LWJGL/src/native/common/opencl.h
trunk/LWJGL/src/native/common/org_lwjgl_opencl_CL.c
trunk/LWJGL/src/native/common/org_lwjgl_opencl_CL.h
trunk/LWJGL/src/native/common/org_lwjgl_opencl_CallbackUtil.c
trunk/LWJGL/src/native/common/org_lwjgl_opencl_CallbackUtil.h
trunk/LWJGL/src/native/common/org_lwjgl_opengl_CallbackUtil.c
trunk/LWJGL/src/native/common/org_lwjgl_opengl_CallbackUtil.h
trunk/LWJGL/src/native/linux/linux_cl.c
trunk/LWJGL/src/native/macosx/macosx_cl.c
trunk/LWJGL/src/native/windows/windows_cl.c
trunk/LWJGL/src/templates/org/lwjgl/opencl/
trunk/LWJGL/src/templates/org/lwjgl/opencl/AMD_device_attribute_query.java
trunk/LWJGL/src/templates/org/lwjgl/opencl/AMD_fp64.java
trunk/LWJGL/src/templates/org/lwjgl/opencl/AMD_media_ops.java
trunk/LWJGL/src/templates/org/lwjgl/opencl/AMD_printf.java
trunk/LWJGL/src/templates/org/lwjgl/opencl/APPLE_ContextLoggingFunctions.java
trunk/LWJGL/src/templates/org/lwjgl/opencl/APPLE_SetMemObjectDestructor.java
trunk/LWJGL/src/templates/org/lwjgl/opencl/APPLE_gl_sharing.java
trunk/LWJGL/src/templates/org/lwjgl/opencl/CL10.java
trunk/LWJGL/src/templates/org/lwjgl/opencl/CL10GL.java
trunk/LWJGL/src/templates/org/lwjgl/opencl/CL11.java
trunk/LWJGL/src/templates/org/lwjgl/opencl/EXT_device_fission.java
trunk/LWJGL/src/templates/org/lwjgl/opencl/EXT_migrate_memobject.java
trunk/LWJGL/src/templates/org/lwjgl/opencl/KHR_3d_image_writes.java
trunk/LWJGL/src/templates/org/lwjgl/opencl/KHR_byte_addressable_store.java
trunk/LWJGL/src/templates/org/lwjgl/opencl/KHR_fp16.java
trunk/LWJGL/src/templates/org/lwjgl/opencl/KHR_fp64.java
trunk/LWJGL/src/templates/org/lwjgl/opencl/KHR_gl_event.java
trunk/LWJGL/src/templates/org/lwjgl/opencl/KHR_gl_sharing.java
trunk/LWJGL/src/templates/org/lwjgl/opencl/KHR_global_int32_base_atomics.java
trunk/LWJGL/src/templates/org/lwjgl/opencl/KHR_global_int32_extended_atomics.java
trunk/LWJGL/src/templates/org/lwjgl/opencl/KHR_icd.java
trunk/LWJGL/src/templates/org/lwjgl/opencl/KHR_int64_base_atomics.java
trunk/LWJGL/src/templates/org/lwjgl/opencl/KHR_int64_extended_atomics.java
trunk/LWJGL/src/templates/org/lwjgl/opencl/KHR_local_int32_base_atomics.java
trunk/LWJGL/src/templates/org/lwjgl/opencl/KHR_local_int32_extended_atomics.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_cl_event.java
Removed Paths:
-------------
trunk/LWJGL/src/java/org/lwjgl/opengl/AMDDebugOutputUtil.java
trunk/LWJGL/src/java/org/lwjgl/opengl/APIUtils.java
trunk/LWJGL/src/java/org/lwjgl/opengl/ARBDebugOutputUtil.java
trunk/LWJGL/src/java/org/lwjgl/opengl/PointerWrapper.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/ALTypeMap.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/ALboolean.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/ALbyte.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/ALdouble.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/ALenum.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/ALfloat.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/ALint.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/ALshort.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/ALsizei.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/ALubyte.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/ALuint.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/ALvoid.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/AutoResultSize.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/ContextCapabilitiesGenerator.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/ContextGeneratorProcessorFactory.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/GLTypeMap.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/GLbitfield.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/GLboolean.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/GLbyte.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/GLchar.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/GLcharARB.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/GLclampd.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/GLclampf.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/GLdouble.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/GLenum.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/GLfloat.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/GLhalf.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/GLhandleARB.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/GLint.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/GLint64.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/GLint64EXT.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/GLintptr.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/GLintptrARB.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/GLpointer.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/GLreturn.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/GLshort.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/GLsizei.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/GLsizeiptr.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/GLsizeiptrARB.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/GLtime.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/GLubyte.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/GLuint.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/GLuint64.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/GLuint64EXT.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/GLushort.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/GLvoid.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/ReferencesGeneratorProcessorFactory.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/StringList.java
trunk/LWJGL/src/native/common/org_lwjgl_opengl_AMDDebugOutputCallback.c
trunk/LWJGL/src/native/common/org_lwjgl_opengl_ARBDebugOutputCallback.c
Modified: trunk/LWJGL/build.xml
===================================================================
--- trunk/LWJGL/build.xml 2010-09-21 09:51:05 UTC (rev 3411)
+++ trunk/LWJGL/build.xml 2010-09-26 23:43:24 UTC (rev 3412)
@@ -32,19 +32,19 @@
<mkdir dir="${lwjgl.temp}/native/macosx" taskname="initialiazing temp/macosx folder" />
<mkdir dir="${lwjgl.temp}/native/solaris" taskname="initialiazing temp/solaris folder" />
</target>
-
+
<!-- Cleans up any files created during the execution of this script -->
- <target name="clean" description="Cleans the diectories controlled by this ant script" depends="clean-generated">
+ <target name="clean" description="Cleans the directories controlled by this ant script" depends="clean-generated">
<delete dir="${lwjgl.temp}" quiet="true" failonerror="false" taskname="cleaning temp folder" />
<delete dir="${lwjgl.docs}/javadoc" quiet="true" failonerror="false" taskname="cleaning javadoc folder" />
<delete dir="${lwjgl.bin}" quiet="true" failonerror="false" taskname="cleaning bin folder" />
</target>
-
+
<!-- Creates a distribution of LWJGL -->
<target name="release" description="Creates a distribution of LWJGL using supplied native binaries">
<!-- Warn user -->
<echo message="Before running the release target, please manually compile all platforms and place required files in ${lwjgl.lib}/windows, ${lwjgl.lib}/linux and ${lwjgl.lib}/macosx${line.separator}Missing files will result in a successfull built, but with incomplete release zips"/>
- <input
+ <input
message="All data in the ${lwjgl.dist} folder will be deleted. Continue? "
validargs="yes,no"
addproperty="do.delete"
@@ -53,7 +53,7 @@
<equals arg1="no" arg2="${do.delete}"/>
</condition>
<fail if="do.abort">Build aborted by user.</fail>
-
+
<!-- prepare -->
<delete dir="${lwjgl.dist}" quiet="true" failonerror="false" />
<antcall target="clean" />
@@ -72,19 +72,19 @@
<antcall target="-jars_NoDEP" />
<antcall target="javadoc" />
<antcall target="applet-release" />
-
+
<!-- copy resources to res folder -->
<copy todir="${lwjgl.temp}/res">
<fileset dir="res"/>
</copy>
-
+
<!-- copy docs -->
<copy todir="${lwjgl.temp}/doc">
<fileset dir="${lwjgl.docs}">
<patternset refid="lwjgl-docs.fileset" />
</fileset>
</copy>
-
+
<!-- create distribution from files in libs/ and temp/ -->
<antcall target="-distribution_javadoc" />
<antcall target="-distribution_source" />
@@ -105,7 +105,7 @@
</fileset>
</move>
</target>
-
+
<!-- Packages the java files -->
<target name="-createdebugjars">
<!-- Create lwjgl.jar -->
@@ -116,7 +116,7 @@
</manifest>
</jar>
</target>
-
+
<!-- Packages the java files -->
<target name="-createjars">
<!-- Create lwjgl.jar -->
@@ -126,7 +126,7 @@
<attribute name="Sealed" value="true"/>
</manifest>
</jar>
-
+
<!-- Create lwjgl_util_applet.jar -->
<jar destfile="${lwjgl.temp}/jar/lwjgl_util_applet.jar" taskname="lwjgl_util_applet.jar">
<fileset refid="lwjgl_util_applet.fileset" />
@@ -151,7 +151,7 @@
<target name="-distribute">
<delete>
<fileset dir="${lwjgl.temp}/native/" includes="**/*"/>
- </delete>
+ </delete>
<copy todir="${lwjgl.temp}/jar">
<fileset dir="${lwjgl.lib}/" includes="*.jar"/>
@@ -175,20 +175,20 @@
<fileset dir="${lwjgl.lib}/solaris">
<patternset refid="lwjgl-solaris.fileset" />
</fileset>
- </copy>
-
+ </copy>
+
<!-- create base package -->
<zip destfile="${lwjgl.dist}/lwjgl-${lwjgl.version}.zip">
<zipfileset dir="${lwjgl.temp}" prefix="lwjgl-${lwjgl.version}/">
<patternset refid="lwjgl_base"/>
- </zipfileset>
+ </zipfileset>
</zip>
-
+
<!-- create applet package -->
<zip destfile="${lwjgl.dist}/lwjgl_applet-${lwjgl.version}.zip">
<zipfileset dir="." prefix="lwjgl_applet-${lwjgl.version}/">
<patternset refid="lwjgl_applet"/>
- </zipfileset>
+ </zipfileset>
</zip>
</target>
@@ -196,14 +196,14 @@
<target name="-distribution_javadoc">
<zip destfile="${lwjgl.dist}/lwjgl-docs-${lwjgl.version}.zip" basedir="${lwjgl.docs}" includes="javadoc/**" />
</target>
-
+
<!-- Creates a versioned distribution of the source code -->
<target name="-distribution_source">
<zip destfile="${lwjgl.dist}/lwjgl-source-${lwjgl.version}.zip">
<fileset refid="lwjgl.source.fileset" />
</zip>
- </target>
-
+ </target>
+
<!-- Generates the native headers from source files -->
<target name="headers" description="invokes javah on java classes" depends="compile">
<javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.native}/linux" force="yes">
@@ -251,17 +251,18 @@
<class name="org.lwjgl.openal.AL" />
<class name="org.lwjgl.opengl.GLContext" />
<class name="org.lwjgl.opengl.Pbuffer" />
- <class name="org.lwjgl.opengl.AMDDebugOutputCallback" />
- <class name="org.lwjgl.opengl.ARBDebugOutputCallback" />
+ <class name="org.lwjgl.opengl.CallbackUtil" />
+ <class name="org.lwjgl.opencl.CL" />
+ <class name="org.lwjgl.opencl.CallbackUtil" />
</javah>
</target>
-
+
<target name="touch-version">
<touch file="${lwjgl.src.native}/windows/org_lwjgl_opengl_Display.c"/>
<touch file="${lwjgl.src.native}/linux/org_lwjgl_opengl_Display.c"/>
<touch file="${lwjgl.src.native}/macosx/org_lwjgl_opengl_Display.m"/>
</target>
-
+
<target name="version-mismatch">
<loadfile srcfile="${lwjgl.src}/java/org/lwjgl/WindowsSysImplementation.java" property="lwjgl.java.windows.version">
<filterchain>
@@ -276,7 +277,7 @@
<containsstring contains="JNI_VERSION ="/>
</tokenfilter>
</filterchain>
- </loadfile>
+ </loadfile>
<loadfile srcfile="${lwjgl.src}/java/org/lwjgl/MacOSXSysImplementation.java" property="lwjgl.java.macosx.version">
<filterchain>
<tokenfilter>
@@ -297,7 +298,7 @@
<containsstring contains="#define org_lwjgl_LinuxSysImplementation_JNI_VERSION"/>
</tokenfilter>
</filterchain>
- </loadfile>
+ </loadfile>
<loadfile srcfile="${lwjgl.src.native}/macosx/org_lwjgl_MacOSXSysImplementation.h" property="lwjgl.native.macosx.version">
<filterchain>
<tokenfilter>
@@ -307,14 +308,14 @@
</loadfile>
<echo>
lwjgl.java.windows.version = ${lwjgl.java.windows.version}
- lwjgl.native.windows.version = ${lwjgl.native.windows.version}
+ lwjgl.native.windows.version = ${lwjgl.native.windows.version}
lwjgl.java.linux.version = ${lwjgl.java.linux.version}
- lwjgl.native.linux.version = ${lwjgl.native.linux.version}
+ lwjgl.native.linux.version = ${lwjgl.native.linux.version}
lwjgl.java.macosx.version = ${lwjgl.java.macosx.version}
- lwjgl.native.macosx.version = ${lwjgl.native.macosx.version}
+ lwjgl.native.macosx.version = ${lwjgl.native.macosx.version}
</echo>
</target>
-
+
<macrodef name="version-check">
<attribute name="platform"/>
<sequential>
@@ -325,7 +326,7 @@
<pathelement path="${java.class.path}"/>
</classpath>
</java>
-
+
<fail message="Unable to load native library: ${nativetest.err}">
<condition>
<not>
@@ -333,27 +334,28 @@
</not>
</condition>
</fail>
-
+
<echo message="Successfully executed NativeTest"/>
</sequential>
</macrodef>
-
+
<!-- Compiles the Java source code -->
<target name="compile" description="Compiles the java source code" depends="-initialize">
- <javac debug="yes" destdir="${lwjgl.bin}" source="1.4" target="1.4" classpath="${lwjgl.lib}/jinput.jar:${lwjgl.lib}/AppleJavaExtensions.jar" taskname="core">
+ <javac debug="yes" destdir="${lwjgl.bin}" source="1.5" target="1.5" classpath="${lwjgl.lib}/jinput.jar:${lwjgl.lib}/AppleJavaExtensions.jar" taskname="core">
<src path="${lwjgl.src}/java/"/>
<src path="${lwjgl.src}/generated/"/>
<include name="org/lwjgl/*.java"/>
<include name="org/lwjgl/input/**"/>
<include name="org/lwjgl/opengl/**"/>
<include name="org/lwjgl/openal/**"/>
+ <include name="org/lwjgl/opencl/**"/>
<include name="org/lwjgl/util/**"/>
<exclude name="org/lwjgl/util/generator/**"/>
</javac>
- <javac debug="yes" srcdir="${lwjgl.src}/java/" destdir="${lwjgl.bin}" includes="org/lwjgl/test/**" source="1.4" target="1.4" taskname="test" />
- <javac debug="yes" srcdir="${lwjgl.src}/java/" destdir="${lwjgl.bin}" includes="org/lwjgl/examples/**" source="1.4" target="1.4" taskname="examples" />
- </target>
-
+ <javac debug="yes" srcdir="${lwjgl.src}/java/" destdir="${lwjgl.bin}" includes="org/lwjgl/test/**" source="1.5" target="1.5" taskname="test" />
+ <javac debug="yes" srcdir="${lwjgl.src}/java/" destdir="${lwjgl.bin}" includes="org/lwjgl/examples/**" source="1.5" target="1.5" taskname="examples" />
+ </target>
+
<target name="compile_native" depends="headers, touch-version, version-mismatch" description="Compiles the native files">
<condition property="lwjgl.platform.windows">
<os family="windows" />
@@ -374,7 +376,7 @@
<os name="Mac OS X" />
</condition>
<antcall target="-compile_native_macosx" />
- </target>
+ </target>
<!-- Compiles LWJGL on Win32 platforms -->
<target name="-compile_native_win32" if="lwjgl.platform.windows">
@@ -410,7 +412,7 @@
<copy file="${lwjgl.bin}/lwjgl/liblwjgl.jnilib" todir="${lwjgl.lib}/macosx"/>
<version-check platform="macosx"/>
</target>
-
+
<target name="repack200" description="Pack200-repack a jar file">
<pack200 src="${input}" destfile="${output}" repack="true"/>
</target>
@@ -430,7 +432,7 @@
<arg value="${output}"/>
</java>
</target>
-
+
<target name="compress-sign-class">
<antcall target="repack200">
<param name="input" value="${dir}${jarfile}.jar"/>
@@ -450,14 +452,14 @@
<!--delete file="${dir}${jarfile}.jar"/-->
<rename src="${dir}${jarfile}-repack.jar" dest="${dir}${jarfile}.jar" replace="yes"/>
</target>
-
+
<target name="compress-resource">
<antcall target="lzma">
<param name="input" value="${input}"/>
<param name="output" value="${output}"/>
</antcall>
</target>
-
+
<target name="applettest" depends="applet">
<exec executable="appletviewer">
<arg value="-J-Djava.security.policy=applet/appletviewer.policy"/>
@@ -487,8 +489,8 @@
<sysproperty key="java.library.path" value="${native_path_expanded}"/>
<arg line="${args}"/>
</java>
- </target>
-
+ </target>
+
<!-- Creates the Javadoc -->
<target name="javadoc" description="Creates javadoc from java source code">
<javadoc destdir="${lwjgl.docs}/javadoc" classpath="${lwjgl.lib}/jinput.jar" author="true" version="true" use="true" source="1.4" windowtitle="LWJGL API" useexternalfile="true">
Modified: trunk/LWJGL/platform_build/build-definitions.xml
===================================================================
--- trunk/LWJGL/platform_build/build-definitions.xml 2010-09-21 09:51:05 UTC (rev 3411)
+++ trunk/LWJGL/platform_build/build-definitions.xml 2010-09-26 23:43:24 UTC (rev 3412)
@@ -2,19 +2,22 @@
<!-- ================================================================== -->
<!-- Global properties for build -->
<!-- ================================================================== -->
- <property name="lwjgl.src" location="src" />
- <property name="lwjgl.src.native" location="${lwjgl.src}/native" />
- <property name="lwjgl.src.headers" location="${lwjgl.src.native}/common" />
- <property name="lwjgl.src.templates" location="${lwjgl.src}/templates" />
- <property name="lwjgl.bin" location="bin" />
- <property name="lwjgl.lib" location="libs" />
- <property name="lwjgl.dist" location="dist" />
- <property name="lwjgl.docs" location="doc" />
- <property name="lwjgl.temp" location="temp" />
- <property name="lwjgl.res" location="res" />
+ <property name="lwjgl.src" location="src" />
+ <property name="lwjgl.src.native" location="${lwjgl.src}/native" />
+ <property name="lwjgl.src.headers" location="${lwjgl.src.native}/common" />
+ <property name="lwjgl.src.templates" location="${lwjgl.src}/templates" />
+ <property name="lwjgl.bin" location="bin" />
+ <property name="lwjgl.lib" location="libs" />
+ <property name="lwjgl.dist" location="dist" />
+ <property name="lwjgl.docs" location="doc" />
+ <property name="lwjgl.temp" location="temp" />
+ <property name="lwjgl.res" location="res" />
<property name="lwjgl.version" value="2.6" />
<property name="opengl-template-pattern" value="org/lwjgl/opengl/GL*.java,org/lwjgl/opengl/ARB*.java,org/lwjgl/opengl/AMD*.java,org/lwjgl/opengl/APPLE*.java,org/lwjgl/opengl/ATI*.java,org/lwjgl/opengl/EXT*.java,org/lwjgl/opengl/NV*.java,org/lwjgl/opengl/NVX*.java,org/lwjgl/opengl/HP*.java,org/lwjgl/opengl/IBM*.java,org/lwjgl/opengl/SUN*.java,org/lwjgl/opengl/SGIS*.java,org/lwjgl/opengl/GREMEDY*.java"/>
+ <property name="opencl-template-pattern-extensions" value="org/lwjgl/opencl/KHR*.java,org/lwjgl/opencl/EXT*.java,org/lwjgl/opencl/APPLE*.java,org/lwjgl/opencl/AMD*.java,org/lwjgl/opencl/NV*.java"/>
+ <property name="opencl-template-pattern" value="org/lwjgl/opencl/CL*.java,${opencl-template-pattern-extensions}"/>
+
<!-- ================================================================== -->
<!-- Filesets used for targets -->
<!-- ================================================================== -->
@@ -39,18 +42,16 @@
<include name="org/lwjgl/test/**" />
<include name="org/lwjgl/examples/**" />
</fileset>
-
+
<!-- More files to include in the lwjgl_test.jar file -->
<fileset id="lwjgl_test_extra.fileset" dir="${lwjgl.src}/java">
<exclude name="**.*" />
- <include name="org/lwjgl/test/opengl/shaders/shaderFP.fp" />
- <include name="org/lwjgl/test/opengl/shaders/shaderFP.vp" />
- <include name="org/lwjgl/test/opengl/shaders/shaderFSH.fsh" />
- <include name="org/lwjgl/test/opengl/shaders/shaderFSH.vsh" />
- <include name="org/lwjgl/test/opengl/shaders/shaderVP.vp" />
- <include name="org/lwjgl/test/opengl/shaders/shaderVSH.vsh" />
- <include name="org/lwjgl/test/opengl/shaders/shaderUNI.vsh" />
- </fileset>
+ <include name="org/lwjgl/test/opengl/shaders/*.fp" />
+ <include name="org/lwjgl/test/opengl/shaders/*.vp" />
+ <include name="org/lwjgl/test/opengl/shaders/*.vsh" />
+ <include name="org/lwjgl/test/opengl/shaders/*.fsh" />
+ <include name="org/lwjgl/test/opencl/gl/*.cl />
+ </fileset>
<!-- Files to include in the lwjgl_util.jar file -->
<fileset id="lwjgl_util.fileset" dir="${lwjgl.bin}">
@@ -66,7 +67,7 @@
<include name="org/lwjgl/test/applet/**"/>
<include name="org/lwjgl/test/opengl/awt/AWTGearsCanvas.class"/>
</fileset>
-
+
<!-- Files to make Javadoc from -->
<fileset id="lwjgl.javadoc.fileset" dir="${lwjgl.src}">
<include name="**/*.java" />
@@ -95,15 +96,15 @@
<include name="jinput-dx8*.dll" />
<include name="jinput-raw*.dll" />
</patternset>
-
+
<!-- Files to include in linux, glibc2.3 package -->
<patternset id="lwjgl-linux.fileset">
<include name="liblwjgl*.so" />
- <include name="libopenal*.so" />
+ <include name="libopenal*.so" />
<include name="libjinput-linux.so" />
<include name="libjinput-linux64.so" />
</patternset>
-
+
<!-- Files to include in mac os x package -->
<patternset id="lwjgl-macosx.fileset">
<include name="liblwjgl.jnilib" />
@@ -111,13 +112,13 @@
<include name="libjinput-osx.jnilib" />
<include name="libjinput-osx-legacy.jnilib" />
</patternset>
-
+
<!-- Files to include in solaris package -->
<patternset id="lwjgl-solaris.fileset">
<include name="liblwjgl*.so" />
- <include name="libopenal.so" />
+ <include name="libopenal.so" />
</patternset>
-
+
<!-- Files to include in source distribution -->
<fileset id="lwjgl.source.fileset" dir=".">
<include name="build.xml" />
@@ -132,7 +133,7 @@
<exclude name="res/Missing_you.mod" />
<exclude name="res/phero*.*" />
</patternset>
-
+
<!-- files in the optional package -->
<patternset id="lwjgl_optional">
<include name="res/**" />
@@ -143,15 +144,15 @@
<include name="doc/CREDITS" />
<include name="doc/LICENSE" />
<include name="doc/README" />
- </patternset>
-
+ </patternset>
+
<!-- files in the lwjgl_applet package -->
<patternset id="lwjgl_applet">
<include name="applet/**" />
<exclude name="applet/appletviewer.policy" />
<exclude name="applet/lwjglkeystore" />
- </patternset>
-
+ </patternset>
+
<uptodate property="lwjgl.main.built" targetfile="${lwjgl.lib}/windows/lwjgl.dll" >
<srcfiles dir= "${lwjgl.src.native}/common" includes="*.c*"/>
<srcfiles dir= "${lwjgl.src.native}/windows" includes="*.c"/>
Modified: trunk/LWJGL/platform_build/build-generator.xml
===================================================================
--- trunk/LWJGL/platform_build/build-generator.xml 2010-09-21 09:51:05 UTC (rev 3411)
+++ trunk/LWJGL/platform_build/build-generator.xml 2010-09-26 23:43:24 UTC (rev 3412)
@@ -11,21 +11,38 @@
<!-- Compiles the Java generator source code -->
<target name="generators" description="Compiles the native method generators">
<javac debug="yes" srcdir="${lwjgl.src}/java/" destdir="${lwjgl.bin}" includes="org/lwjgl/util/generator/**.java" source="1.5" target="1.5" taskname="generator">
+ <include name="org/lwjgl/util/generator/openal/**.java"/>
+ <include name="org/lwjgl/util/generator/opengl/**.java"/>
+ <include name="org/lwjgl/util/generator/opencl/**.java"/>
<compilerarg value="-Xlint:all"/>
</javac>
<!-- Compile helper classes used by the templates -->
- <javac debug="yes" srcdir="${lwjgl.src}/java/" destdir="${lwjgl.bin}" source="1.4" target="1.4" taskname="generator">
+ <javac debug="yes" srcdir="${lwjgl.src}/java/" destdir="${lwjgl.bin}" source="1.5" target="1.5" taskname="generator">
+ <include name="org/lwjgl/PointerWrapper.java"/>
+ <include name="org/lwjgl/PointerBuffer.java"/>
+ <!-- OpenGL -->
<include name="org/lwjgl/opengl/GLSync.java"/>
<include name="org/lwjgl/opengl/AMDDebugOutputCallback.java"/>
<include name="org/lwjgl/opengl/ARBDebugOutputCallback.java"/>
- <include name="org/lwjgl/opengl/PointerWrapper.java"/>
+ <!-- OpenCL -->
+ <include name="org/lwjgl/opencl/CLPlatform.java"/>
+ <include name="org/lwjgl/opencl/CLDevice.java"/>
+ <include name="org/lwjgl/opencl/CLContext.java"/>
+ <include name="org/lwjgl/opencl/CLContextCallback.java"/>
+ <include name="org/lwjgl/opencl/CLCommandQueue.java"/>
+ <include name="org/lwjgl/opencl/CLMem.java"/>
+ <include name="org/lwjgl/opencl/CLMemObjectDestructorCallback.java"/>
+ <include name="org/lwjgl/opencl/CLBuildProgramCallback.java"/>
+ <include name="org/lwjgl/opencl/CLNativeKernel.java"/>
+ <include name="org/lwjgl/opencl/CLEventCallback.java"/>
+ <include name="org/lwjgl/opencl/CLFunctionAddress.java"/>
</javac>
</target>
<!-- Proxy target to generate it all -->
- <target name="generate-all" depends="generate-openal, generate-opengl, generate-opengl-capabilities, generate-opengl-references" description="Generates java and native source"/>
+ <target name="generate-all" depends="generate-openal, generate-opengl, generate-opengl-capabilities, generate-opengl-references, generate-opencl, generate-opencl-capabilities" description="Generates java and native source"/>
- <target name="generate-debug" depends="generate-openal-debug, generate-opengl-debug, generate-opengl-capabilities-debug, generate-opengl-references" description="Generates java and native source"/>
+ <target name="generate-debug" depends="generate-openal-debug, generate-opengl-debug, generate-opengl-capabilities-debug, generate-opengl-references, generate-opencl-debug, generate-opencl-capabilities-debug" description="Generates java and native source with debug functionality"/>
<!-- Generate OpenAL -->
<target name="generate-openal" depends="generators" description="Generates java and native source for AL">
@@ -39,7 +56,7 @@
<arg path="${lwjgl.src}/generated"/>
<arg value="-d"/>
<arg path="${lwjgl.src.native}/generated"/>
- <arg value="-Atypemap=org.lwjgl.util.generator.ALTypeMap"/>
+ <arg value="-Atypemap=org.lwjgl.util.generator.openal.ALTypeMap"/>
<fileset dir="${lwjgl.src.templates}" includes="org/lwjgl/openal/AL10.java, org/lwjgl/openal/AL11.java, org/lwjgl/openal/EFX10.java"/>
</apply>
</target>
@@ -56,7 +73,7 @@
<arg path="${lwjgl.src}/generated"/>
<arg value="-d"/>
<arg path="${lwjgl.src.native}/generated"/>
- <arg value="-Atypemap=org.lwjgl.util.generator.ALTypeMap"/>
+ <arg value="-Atypemap=org.lwjgl.util.generator.openal.ALTypeMap"/>
<arg value="-Ageneratechecks"/>
<fileset dir="${lwjgl.src.templates}" includes="org/lwjgl/openal/AL10.java, org/lwjgl/openal/AL11.java, org/lwjgl/openal/EFX10.java"/>
</apply>
@@ -75,7 +92,7 @@
<arg value="-d"/>
<arg path="${lwjgl.src.native}/generated"/>
<arg value="-Acontextspecific"/>
- <arg value="-Atypemap=org.lwjgl.util.generator.GLTypeMap"/>
+ <arg value="-Atypemap=org.lwjgl.util.generator.opengl.GLTypeMap"/>
<fileset dir="${lwjgl.src.templates}" includes="${opengl-template-pattern}"/>
</apply>
</target>
@@ -94,17 +111,17 @@
<arg path="${lwjgl.src.native}/generated"/>
<arg value="-Ageneratechecks"/>
<arg value="-Acontextspecific"/>
- <arg value="-Atypemap=org.lwjgl.util.generator.GLTypeMap"/>
+ <arg value="-Atypemap=org.lwjgl.util.generator.opengl.GLTypeMap"/>
<fileset dir="${lwjgl.src.templates}" includes="${opengl-template-pattern}"/>
</apply>
</target>
- <!-- Generate references -->
+ <!-- Generate OpenGL references -->
<target name="generate-opengl-references" depends="generators" description="Generates java and native source for GL">
<apply executable="apt" parallel="true">
<arg value="-nocompile"/>
<arg value="-factory"/>
- <arg value="org.lwjgl.util.generator.ReferencesGeneratorProcessorFactory"/>
+ <arg value="org.lwjgl.util.generator.opengl.GLReferencesGeneratorProcessorFactory"/>
<arg value="-cp"/>
<arg path="${lwjgl.src}/java:${lwjgl.src.templates}:${lwjgl.bin}:${java.class.path}"/>
<arg value="-s"/>
@@ -113,12 +130,12 @@
</apply>
</target>
- <!-- Generate context capabilities -->
+ <!-- Generate OpenGL context capabilities -->
<target name="generate-opengl-capabilities" depends="generators" description="Generates java and native source for GL">
<apply executable="apt" parallel="true">
<arg value="-nocompile"/>
<arg value="-factory"/>
- <arg value="org.lwjgl.util.generator.ContextGeneratorProcessorFactory"/>
+ <arg value="org.lwjgl.util.generator.opengl.GLGeneratorProcessorFactory"/>
<arg value="-cp"/>
<arg path="${lwjgl.src}/java:${lwjgl.src.templates}:${lwjgl.bin}:${java.class.path}"/>
<arg value="-s"/>
@@ -128,12 +145,12 @@
</apply>
</target>
- <!-- Generate context capabilities [DEBUG] -->
+ <!-- Generate OpenGL context capabilities [DEBUG] -->
<target name="generate-opengl-capabilities-debug" depends="generators" description="Generates java and native source for GL">
<apply executable="apt" parallel="true">
<arg value="-nocompile"/>
<arg value="-factory"/>
- <arg value="org.lwjgl.util.generator.ContextGeneratorProcessorFactory"/>
+ <arg value="org.lwjgl.util.generator.opengl.GLGeneratorProcessorFactory"/>
<arg value="-cp"/>
<arg path="${lwjgl.src}/java:${lwjgl.src.templates}:${lwjgl.bin}:${java.class.path}"/>
<arg value="-s"/>
@@ -143,4 +160,72 @@
<fileset dir="${lwjgl.src.templates}" includes="${opengl-template-pattern}"/>
</apply>
</target>
+
+ <!-- Generate OpenCL -->
+ <target name="generate-opencl" depends="generators" description="Generates java and native source for CL">
+ <apply executable="apt" parallel="true">
+ <arg value="-nocompile"/>
+ <arg value="-factory"/>
+ <arg value="org.lwjgl.util.generator.GeneratorProcessorFactory"/>
+ <arg value="-cp"/>
+ <arg path="${lwjgl.src}/java:${lwjgl.src.templates}:${lwjgl.bin}:${java.class.path}"/>
+ <arg value="-s"/>
+ <arg path="${lwjgl.src}/generated"/>
+ <arg value="-d"/>
+ <arg path="${lwjgl.src.native}/generated"/>
+ <arg value="-Acontextspecific"/>
+ <arg value="-Atypemap=org.lwjgl.util.generator.opencl.CLTypeMap"/>
+ <fileset dir="${lwjgl.src.templates}" includes="${opencl-template-pattern}"/>
+ </apply>
+ </target>
+
+ <!-- Generate OpenCL [DEBUG] -->
+ <target name="generate-opencl-debug" depends="generators" description="Generates java and native source for CL">
+ <apply executable="apt" parallel="true">
+ <arg value="-nocompile"/>
+ <arg value="-factory"/>
+ <arg value="org.lwjgl.util.generator.GeneratorProcessorFactory"/>
+ <arg value="-cp"/>
+ <arg path="${lwjgl.src}/java:${lwjgl.src.templates}:${lwjgl.bin}:${java.class.path}"/>
+ <arg value="-s"/>
+ <arg path="${lwjgl.src}/generated"/>
+ <arg value="-d"/>
+ <arg path="${lwjgl.src.native}/generated"/>
+ <arg value="-Ageneratechecks"/>
+ <arg value="-Acontextspecific"/>
+ <arg value="-Atypemap=org.lwjgl.util.generator.opencl.CLTypeMap"/>
+ <fileset dir="${lwjgl.src.templates}" includes="${opencl-template-pattern}"/>
+ </apply>
+ </target>
+
+ <!-- Generate OpenCL capabilities -->
+ <target name="generate-opencl-capabilities" depends="generators" description="Generates capabilities for CL">
+ <apply executable="apt" parallel="true">
+ <arg value="-nocompile"/>
+ <arg value="-factory"/>
+ <arg value="org.lwjgl.util.generator.opencl.CLGeneratorProcessorFactory"/>
+ <arg value="-cp"/>
+ <arg path="${lwjgl.src}/java:${lwjgl.src.templates}:${lwjgl.bin}:${java.class.path}"/>
+ <arg value="-s"/>
+ <arg path="${lwjgl.src}/generated"/>
+ <arg value="-Acontextspecific"/>
+ <fileset dir="${lwjgl.src.templates}" includes="${opencl-template-pattern}"/>
+ </apply>
+ </target>
+
+ <!-- Generate OpenCL capabilities [DEBUG] -->
+ <target name="generate-opencl-capabilities-debug" depends="generators" description="Generates capabilities for CL">
+ <apply executable="apt" parallel="true">
+ <arg value="-nocompile"/>
+ <arg value="-factory"/>
+ <arg value="org.lwjgl.util.generator.opencl.CLGeneratorProcessorFactory"/>
+ <arg value="-cp"/>
+ <arg path="${lwjgl.src}/java:${lwjgl.src.templates}:${lwjgl.bin}:${java.class.path}"/>
+ <arg value="-s"/>
+ <arg path="${lwjgl.src}/generated"/>
+ <arg value="-Ageneratechecks"/>
+ <arg value="-Acontextspecific"/>
+ <fileset dir="${lwjgl.src.templates}" includes="${opencl-template-pattern}"/>
+ </apply>
+ </target>
</project>
Modified: trunk/LWJGL/platform_build/linux_ant/build.xml
===================================================================
--- trunk/LWJGL/platform_build/linux_ant/build.xml 2010-09-21 09:51:05 UTC (rev 3411)
+++ trunk/LWJGL/platform_build/linux_ant/build.xml 2010-09-26 23:43:24 UTC (rev 3412)
@@ -16,7 +16,7 @@
<fileset dir="." includes="*.so"/>
</delete>
</target>
-
+
<target name="compile">
<exec executable="uname" outputproperty="hwplatform">
<arg value="-m"/>
@@ -27,10 +27,10 @@
<condition property="cflags_pthread" value="-pthreads" else="-pthread">
<os name="SunOS" />
</condition>
- <condition property="version_script_flags32" value="" else="-Wl,--version-script=${native}/linux/lwjgl.map">
+ <condition property="version_script_flags32" value="" else="-Wl,--version-script='${native}/linux/lwjgl.map'">
<os name="SunOS" />
</condition>
- <condition property="version_script_flags64" value="-m64" else="-Wl,--version-script=${native}/linux/lwjgl.map">
+ <condition property="version_script_flags64" value="-m64" else="-Wl,--version-script='${native}/linux/lwjgl.map'">
<and>
<os name="SunOS" />
</and>
@@ -50,7 +50,7 @@
</or>
</not>
</condition>
-
+
<!-- On linux, the 64 bit jre doesn't have the 32 bit libs -->
<condition property="build.64bit.only">
<and>
@@ -58,11 +58,11 @@
<equals arg1="${hwplatform}" arg2="x86_64"/>
</and>
</condition>
-
+
<antcall target="compile32"/>
<antcall target="compile64"/>
</target>
-
+
<target name="compile32" unless="build.64bit.only">
<mkdir dir="x32"/>
<apply dir="x32" executable="gcc" skipemptyfilesets="true" failonerror="true">
@@ -89,7 +89,7 @@
</apply>
</target>
- <target name="compile64" unless="build.32bit.only">
+ <target name="compile64" unless="build.32bit.only">
<mkdir dir="x64"/>
<apply dir="x64" executable="gcc" skipemptyfilesets="true" failonerror="true">
<arg line="${cflags64} ${cflags_pthread}"/>
Modified: trunk/LWJGL/src/java/org/lwjgl/BufferChecks.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/BufferChecks.java 2010-09-21 09:51:05 UTC (rev 3411)
+++ trunk/LWJGL/src/java/org/lwjgl/BufferChecks.java 2010-09-26 23:43:24 UTC (rev 3412)
@@ -87,13 +87,27 @@
}
}
- /** Helper methods to ensure an IntBuffer is null-terminated */
+ /** Helper method to ensure an IntBuffer is null-terminated */
public static void checkNullTerminated(IntBuffer buf) {
if ( buf.get(buf.limit() - 1) != 0 ) {
throw new IllegalArgumentException("Missing null termination");
}
}
+ /** Helper method to ensure a LongBuffer is null-terminated */
+ public static void checkNullTerminated(LongBuffer buf) {
+ if ( buf.get(buf.limit() - 1) != 0 ) {
+ throw new IllegalArgumentException("Missing null termination");
+ }
+ }
+
+ /** Helper method to ensure a PointerBuffer is null-terminated */
+ public static void checkNullTerminated(PointerBuffer buf) {
+ if ( buf.get(buf.limit() - 1) != 0 ) {
+ throw new IllegalArgumentException("Missing null termination");
+ }
+ }
+
public static void checkNotNull(Object o) {
if ( LWJGLUtil.CHECKS && o == null)
throw new IllegalArgumentException("Null argument");
@@ -138,6 +152,15 @@
}
}
+ public static void checkDirect(PointerBuffer buf) {
+ // NO-OP, PointerBuffer is always direct.
+ }
+
+ public static void checkArray(Object[] array) {
+ if ( LWJGLUtil.CHECKS && array == null )
+ throw new IllegalArgumentException("Invalid array");
+ }
+
/**
* This is a separate call to help inline checkBufferSize.
*/
@@ -145,6 +168,18 @@
throw new IllegalArgumentException("Number of remaining buffer elements is " + buf.remaining() + ", must be at least " + size);
}
+ private static void throwBufferSizeException(PointerBuffer buf, int size) {
+ throw new IllegalArgumentException("Number of remaining pointer buffer elements is " + buf.remaining() + ", must be at least " + size);
+ }
+
+ private static void throwArraySizeException(Object[] array, int size) {
+ throw new IllegalArgumentException("Number of array elements is " + array.length + ", must be at least " + size);
+ }
+
+ private static void throwArraySizeException(long[] array, int size) {
+ throw new IllegalArgumentException("Number of array elements is " + array.length + ", must be at least " + size);
+ }
+
/**
* Helper method to ensure a buffer is big enough to receive data from a
* glGet* operation.
@@ -202,4 +237,21 @@
checkDirect(buf);
}
}
-}
+
+ public static void checkBuffer(PointerBuffer buf, int size) {
+ if ( LWJGLUtil.CHE...
[truncated message content] |
|
From: <ma...@us...> - 2010-09-21 09:51:11
|
Revision: 3411
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3411&view=rev
Author: matzon
Date: 2010-09-21 09:51:05 +0000 (Tue, 21 Sep 2010)
Log Message:
-----------
forgot to tag 2.5
Added Paths:
-----------
tags/lwjgl2.5/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2010-09-15 22:51:34
|
Revision: 3410
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3410&view=rev
Author: spasi
Date: 2010-09-15 22:51:27 +0000 (Wed, 15 Sep 2010)
Log Message:
-----------
Fixed ARB_framebuffer_object tokens.
Modified Paths:
--------------
trunk/LWJGL/src/templates/org/lwjgl/opengl/GL30.java
Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/GL30.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/GL30.java 2010-09-01 18:12:06 UTC (rev 3409)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/GL30.java 2010-09-15 22:51:27 UTC (rev 3410)
@@ -412,15 +412,18 @@
int GL_TEXTURE_SHARED_SIZE = 0x8C3F;
// ----------------------------------------------------------------------
- // ----------------------[ EXT_framebuffer_object ]----------------------
+ // ----------------------[ ARB_framebuffer_object ]----------------------
// ----------------------------------------------------------------------
/**
* Accepted by the <target> parameter of BindFramebuffer,
- * CheckFramebufferStatus, FramebufferTexture{1D|2D|3D}, and
- * FramebufferRenderbuffer:
+ * CheckFramebufferStatus, FramebufferTexture{1D|2D|3D},
+ * FramebufferRenderbuffer, and
+ * GetFramebufferAttachmentParameteriv:
*/
int GL_FRAMEBUFFER = 0x8D40;
+ int GL_READ_FRAMEBUFFER = 0x8CA8;
+ int GL_DRAW_FRAMEBUFFER = 0x8CA9;
/**
* Accepted by the <target> parameter of BindRenderbuffer,
@@ -457,8 +460,19 @@
int GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME = 0x8CD1;
int GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL = 0x8CD2;
int GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE = 0x8CD3;
- int GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET = 0x8CD4;
+ int GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING = 0x8210;
+ int GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE = 0x8211;
+ int GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE = 0x8212;
+ int GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE = 0x8213;
+ int GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE = 0x8214;
+ int GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE = 0x8215;
+ int GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE = 0x8216;
+ int GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE = 0x8217;
+ /** Returned in <params> by GetFramebufferAttachmentParameteriv: */
+ int GL_FRAMEBUFFER_DEFAULT = 0x8218;
+ int GL_INDEX = 0x8222;
+
/**
* Accepted by the <attachment> parameter of
* FramebufferTexture{1D|2D|3D}, FramebufferRenderbuffer, and
@@ -482,19 +496,22 @@
int GL_COLOR_ATTACHMENT15 = 0x8CEF;
int GL_DEPTH_ATTACHMENT = 0x8D00;
int GL_STENCIL_ATTACHMENT = 0x8D20;
+ int GL_DEPTH_STENCIL_ATTACHMENT = 0x821A;
/** Returned by CheckFramebufferStatus(): */
int GL_FRAMEBUFFER_COMPLETE = 0x8CD5;
int GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT = 0x8CD6;
int GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = 0x8CD7;
- int GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS = 0x8CD9;
- int GL_FRAMEBUFFER_INCOMPLETE_FORMATS = 0x8CDA;
int GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER = 0x8CDB;
int GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER = 0x8CDC;
int GL_FRAMEBUFFER_UNSUPPORTED = 0x8CDD;
+ int GL_FRAMEBUFFER_UNDEFINED = 0x8219;
- /** Accepted by GetIntegerv(): */
- int GL_FRAMEBUFFER_BINDING = 0x8CA6;
+ /**
+ * Accepted by the <pname> parameters of GetIntegerv, GetFloatv,
+ * and GetDoublev:
+ */
+ int GL_FRAMEBUFFER_BINDING = 0x8CA6; // alias DRAW_FRAMEBUFFER_BINDING
int GL_RENDERBUFFER_BINDING = 0x8CA7;
int GL_MAX_COLOR_ATTACHMENTS = 0x8CDF;
int GL_MAX_RENDERBUFFER_SIZE = 0x84E8;
@@ -610,15 +627,6 @@
// ----------------------[ EXT_framebuffer_blit ]----------------------
// --------------------------------------------------------------------
- /**
- * Accepted by the <target> parameter of BindFramebuffer,
- * CheckFramebufferStatus, FramebufferTexture{1D|2D|3D},
- * FramebufferRenderbuffer, and
- * GetFramebufferAttachmentParameteriv.
- */
- int GL_READ_FRAMEBUFFER = 0x8CA8;
- int GL_DRAW_FRAMEBUFFER = 0x8CA9;
-
/** Accepted by the <pname> parameters of GetIntegerv, GetFloatv, and GetDoublev. */
int GL_DRAW_FRAMEBUFFER_BINDING = 0x8CA6; // alias FRAMEBUFFER_BINDING
int GL_READ_FRAMEBUFFER_BINDING = 0x8CAA;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2010-09-01 18:12:13
|
Revision: 3409
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3409&view=rev
Author: kappa1
Date: 2010-09-01 18:12:06 +0000 (Wed, 01 Sep 2010)
Log Message:
-----------
Applet package in nightly builds now cleaned of unused files so extra code to build file can be removed.
Modified Paths:
--------------
trunk/LWJGL/platform_build/build-applet.xml
Modified: trunk/LWJGL/platform_build/build-applet.xml
===================================================================
--- trunk/LWJGL/platform_build/build-applet.xml 2010-08-31 20:10:12 UTC (rev 3408)
+++ trunk/LWJGL/platform_build/build-applet.xml 2010-09-01 18:12:06 UTC (rev 3409)
@@ -147,9 +147,5 @@
<param name="input" value="applet/basic/solaris_natives.jar"/>
<param name="output" value="applet/advance/solaris_natives.jar.lzma"/>
</antcall>
-
- <delete>
- <fileset dir="applet" includes="*.jar, *.lzma"/>
- </delete>
</target>
</project>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|