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
|
2
(1) |
3
|
4
|
5
|
6
(1) |
|
7
|
8
(3) |
9
|
10
(2) |
11
|
12
|
13
(3) |
|
14
(2) |
15
(1) |
16
(1) |
17
|
18
(2) |
19
|
20
(2) |
|
21
|
22
|
23
|
24
(1) |
25
|
26
|
27
(1) |
|
28
|
29
(4) |
30
|
31
(1) |
|
|
|
|
From: <ka...@us...> - 2011-08-31 21:06:53
|
Revision: 3627
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3627&view=rev
Author: kappa1
Date: 2011-08-31 21:06:46 +0000 (Wed, 31 Aug 2011)
Log Message:
-----------
mac, attempt a quickfix in order to temporarily bypass nightly server restrictions so that mac natives can build.
Modified Paths:
--------------
trunk/LWJGL/src/native/common/org_lwjgl_opengl_AWTSurfaceLock.c
trunk/LWJGL/src/native/macosx/org_lwjgl_opengl_MacOSXCanvasPeerInfo.m
Modified: trunk/LWJGL/src/native/common/org_lwjgl_opengl_AWTSurfaceLock.c
===================================================================
--- trunk/LWJGL/src/native/common/org_lwjgl_opengl_AWTSurfaceLock.c 2011-08-29 21:31:23 UTC (rev 3626)
+++ trunk/LWJGL/src/native/common/org_lwjgl_opengl_AWTSurfaceLock.c 2011-08-31 21:06:46 UTC (rev 3627)
@@ -60,7 +60,7 @@
#ifdef __MACH__
if (display_parent) {
//first try CALAYER
- awt.version = JAWT_VERSION_1_4 | JAWT_MACOSX_USE_CALAYER;
+ awt.version = JAWT_VERSION_1_4 | 0x80000000;//JAWT_MACOSX_USE_CALAYER;
result = JAWT_GetAWT(env, &awt);
}
#endif
Modified: trunk/LWJGL/src/native/macosx/org_lwjgl_opengl_MacOSXCanvasPeerInfo.m
===================================================================
--- trunk/LWJGL/src/native/macosx/org_lwjgl_opengl_MacOSXCanvasPeerInfo.m 2011-08-29 21:31:23 UTC (rev 3626)
+++ trunk/LWJGL/src/native/macosx/org_lwjgl_opengl_MacOSXCanvasPeerInfo.m 2011-08-31 21:06:46 UTC (rev 3627)
@@ -68,7 +68,7 @@
JAWT_MacOSXDrawingSurfaceInfo *macosx_dsi = (JAWT_MacOSXDrawingSurfaceInfo *)surface->dsi->platformInfo;
// check for CALayer support
- if(surface->awt.version & JAWT_MACOSX_USE_CALAYER) {
+ if(surface->awt.version & 0x80000000) { //JAWT_MACOSX_USE_CALAYER) {
jint width = surface->dsi->bounds.width;
jint height = surface->dsi->bounds.height;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2011-08-29 21:31:30
|
Revision: 3626
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3626&view=rev
Author: kappa1
Date: 2011-08-29 21:31:23 +0000 (Mon, 29 Aug 2011)
Log Message:
-----------
Linux Display - create native Display window at the correct position on linux.
Modified Paths:
--------------
trunk/LWJGL/src/native/linux/opengl/org_lwjgl_opengl_Display.c
trunk/LWJGL/src/native/linux/opengles/org_lwjgl_opengl_Display.c
Modified: trunk/LWJGL/src/native/linux/opengl/org_lwjgl_opengl_Display.c
===================================================================
--- trunk/LWJGL/src/native/linux/opengl/org_lwjgl_opengl_Display.c 2011-08-29 13:34:17 UTC (rev 3625)
+++ trunk/LWJGL/src/native/linux/opengl/org_lwjgl_opengl_Display.c 2011-08-29 21:31:23 UTC (rev 3626)
@@ -334,15 +334,17 @@
// Use Motif decoration hint property and hope the window manager respects them
setDecorations(disp, win, 0);
}
- XSizeHints * size_hints = XAllocSizeHints();
- size_hints->flags = PMinSize | PMaxSize;
- size_hints->min_width = width;
- size_hints->max_width = width;
- size_hints->min_height = height;
- size_hints->max_height = height;
- XSetWMNormalHints(disp, win, size_hints);
+ XSizeHints * window_hints = XAllocSizeHints();
+ window_hints->flags = PPosition | PMinSize | PMaxSize;
+ window_hints->x = x;
+ window_hints->y = y;
+ window_hints->min_width = width;
+ window_hints->max_width = width;
+ window_hints->min_height = height;
+ window_hints->max_height = height;
+ XSetWMNormalHints(disp, win, window_hints);
updateWindowHints(env, disp, win);
- XFree(size_hints);
+ XFree(window_hints);
#define NUM_ATOMS 1
Atom protocol_atoms[NUM_ATOMS] = {XInternAtom(disp, "WM_DELETE_WINDOW", False)/*, XInternAtom(disp, "WM_TAKE_FOCUS", False)*/};
XSetWMProtocols(disp, win, protocol_atoms, NUM_ATOMS);
Modified: trunk/LWJGL/src/native/linux/opengles/org_lwjgl_opengl_Display.c
===================================================================
--- trunk/LWJGL/src/native/linux/opengles/org_lwjgl_opengl_Display.c 2011-08-29 13:34:17 UTC (rev 3625)
+++ trunk/LWJGL/src/native/linux/opengles/org_lwjgl_opengl_Display.c 2011-08-29 21:31:23 UTC (rev 3626)
@@ -328,15 +328,17 @@
// Use Motif decoration hint property and hope the window manager respects them
setDecorations(disp, win, 0);
}
- XSizeHints * size_hints = XAllocSizeHints();
- size_hints->flags = PMinSize | PMaxSize;
- size_hints->min_width = width;
- size_hints->max_width = width;
- size_hints->min_height = height;
- size_hints->max_height = height;
- XSetWMNormalHints(disp, win, size_hints);
+ XSizeHints * window_hints = XAllocSizeHints();
+ window_hints->flags = PPosition | PMinSize | PMaxSize;
+ window_hints->x = x;
+ window_hints->y = y;
+ window_hints->min_width = width;
+ window_hints->max_width = width;
+ window_hints->min_height = height;
+ window_hints->max_height = height;
+ XSetWMNormalHints(disp, win, window_hints);
updateWindowHints(env, disp, win);
- XFree(size_hints);
+ XFree(window_hints);
#define NUM_ATOMS 1
Atom protocol_atoms[NUM_ATOMS] = {XInternAtom(disp, "WM_DELETE_WINDOW", False)/*, XInternAtom(disp, "WM_TAKE_FOCUS", False)*/};
XSetWMProtocols(disp, win, protocol_atoms, NUM_ATOMS);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2011-08-29 13:34:24
|
Revision: 3625
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3625&view=rev
Author: kappa1
Date: 2011-08-29 13:34:17 +0000 (Mon, 29 Aug 2011)
Log Message:
-----------
apply patch to enable applets on OS X using the java plugin2, credits to pjohnson for creating patch.
Modified Paths:
--------------
trunk/LWJGL/platform_build/macosx_ant/build.xml
trunk/LWJGL/src/java/org/lwjgl/opengl/AWTSurfaceLock.java
trunk/LWJGL/src/native/common/org_lwjgl_opengl_AWTSurfaceLock.c
trunk/LWJGL/src/native/macosx/context.h
trunk/LWJGL/src/native/macosx/org_lwjgl_opengl_MacOSXCanvasPeerInfo.m
trunk/LWJGL/src/native/macosx/org_lwjgl_opengl_MacOSXContextImplementation.m
Modified: trunk/LWJGL/platform_build/macosx_ant/build.xml
===================================================================
--- trunk/LWJGL/platform_build/macosx_ant/build.xml 2011-08-29 00:54:54 UTC (rev 3624)
+++ trunk/LWJGL/platform_build/macosx_ant/build.xml 2011-08-29 13:34:17 UTC (rev 3625)
@@ -7,7 +7,7 @@
<mkdir dir="i386"/>
<mkdir dir="x86_64"/>
</target>
-
+
<target name="clean">
<delete failonerror="false">
<fileset dir="i386"/>
@@ -20,22 +20,19 @@
<target name="compile">
<apply dir="${dstdir}" executable="${compiler}" os="Mac OS X" skipemptyfilesets="true" failonerror="true" dest="${dstdir}">
- <arg line="${cflags} -ObjC -O2 -Wall -Wunused -c -fPIC -I${sdkroot}/System/Library/Frameworks/JavaVM.framework/Versions/A/Headers -I${sdkroot}/System/Library/Frameworks/JavaVM.framework/Versions/A/Frameworks/JavaNativeFoundation.framework/Headers -I${native}/common -I${native}/common/opengl -I${native}/macosx"/>
+ <arg line="${cflags} -ObjC -O2 -Wall -Wunused -c -fPIC -I/System/Library/Frameworks/JavaVM.framework/Versions/A/Headers -I${native}/common -I${native}/macosx -I/System/Library/Frameworks/JavaVM.framework/Versions/A/Frameworks/JavaNativeFoundation.framework/Versions/A/Headers"/>
<!-- Map from *.m and *.c to .o -->
<mapper type="regexp" from="^(.*)\.(c|m)" to="\1.o"/>
<fileset dir="${native}/macosx" includes="*.m"/>
<fileset dir="${native}/macosx" includes="*.c"/>
<fileset dir="${native}/common" includes="*.c"/>
- <fileset dir="${native}/common/opengl" includes="*.c"/>
- <fileset dir="${native}/generated/openal" includes="*.c"/>
- <fileset dir="${native}/generated/opencl" includes="*.c"/>
- <fileset dir="${native}/generated/opengl" includes="*.c"/>
+ <fileset dir="${native}/generated" includes="*.c"/>
</apply>
</target>
-
+
<target name="link">
<apply dir="${objdir}" parallel="true" executable="${linker}" os="Mac OS X" failonerror="true" skipemptyfilesets="true">
- <arg line="${linkerflags} -exported_symbols_list ../lwjgl.symbols -dynamiclib -o ${libname} -framework Foundation -framework AppKit -framework JavaVM -framework Carbon -framework OpenGL"/>
+ <arg line="${linkerflags} -exported_symbols_list ../lwjgl.symbols -dynamiclib -o ${libname} -framework Foundation -framework AppKit -framework JavaVM -framework Carbon -framework OpenGL -framework JavaNativeFoundation -F/System/Library/Frameworks/JavaVM.framework/Frameworks"/>
<fileset dir="${objdir}" includes="*.o"/>
</apply>
<apply dir="${objdir}" executable="strip" os="Mac OS X" failonerror="true">
@@ -43,7 +40,7 @@
<fileset dir="." file="${libname}"/>
</apply>
</target>
-
+
<target name="nativelibrary" depends="init">
<property name="universal_sdkroot" location="/Developer/SDKs/MacOSX10.6.sdk"/>
<property name="ppc_sdkroot" location="/Developer/SDKs/MacOSX10.6.sdk"/>
@@ -52,19 +49,19 @@
<property name="ppc_flags" value="-isysroot ${ppc_sdkroot}"/>
<antcall target="compile">
<param name="dstdir" location="ppc"/>
- <param name="compiler" value="gcc-4.0"/>
+ <param name="compiler" value="gcc-4.2"/>
<param name="sdkroot" location="${ppc_sdkroot}"/>
<param name="cflags" value="${universal_flags} -arch ppc -mmacosx-version-min=10.3"/>
</antcall>
<antcall target="compile">
<param name="dstdir" location="i386"/>
- <param name="compiler" value="gcc-4.0"/>
+ <param name="compiler" value="gcc-4.2"/>
<param name="sdkroot" location="${universal_sdkroot}"/>
<param name="cflags" value="${universal_flags} -arch i386 -mmacosx-version-min=10.4"/>
</antcall>
<antcall target="compile">
<param name="dstdir" location="x86_64"/>
- <param name="compiler" value="gcc-4.0"/>
+ <param name="compiler" value="gcc-4.2"/>
<param name="sdkroot" location="${universal_sdkroot}"/>
<param name="cflags" value="-isysroot ${x86_64_sdkroot} -arch x86_64 -mmacosx-version-min=10.5"/>
</antcall>
@@ -75,19 +72,19 @@
<antcall target="link">
<param name="objdir" location="ppc"/>
<param name="libname" value="liblwjgl-ppc.jnilib"/>
- <param name="linker" value="gcc-4.0"/>
+ <param name="linker" value="gcc-4.2"/>
<param name="linkerflags" value="${universal_flags} -arch ppc -mmacosx-version-min=10.3"/>
</antcall>
<antcall target="link">
<param name="objdir" location="i386"/>
<param name="libname" value="liblwjgl-i386.jnilib"/>
- <param name="linker" value="gcc-4.0"/>
+ <param name="linker" value="gcc-4.2"/>
<param name="linkerflags" value="${universal_flags} -arch i386 -mmacosx-version-min=10.4"/>
</antcall>
<antcall target="link">
<param name="objdir" location="x86_64"/>
<param name="libname" value="liblwjgl-i86_64.jnilib"/>
- <param name="linker" value="gcc-4.0"/>
+ <param name="linker" value="gcc-4.2"/>
<param name="linkerflags" value="-isysroot ${x86_64_sdkroot} -arch x86_64 -mmacosx-version-min=10.5"/>
</antcall>
<apply dir="." parallel="true" executable="lipo" os="Mac OS X" failonerror="true" skipemptyfilesets="true" >
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/AWTSurfaceLock.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/AWTSurfaceLock.java 2011-08-29 00:54:54 UTC (rev 3624)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/AWTSurfaceLock.java 2011-08-29 13:34:17 UTC (rev 3625)
@@ -78,14 +78,15 @@
// We need to elevate privileges because of an AWT bug. Please see
// http://192.18.37.44/forums/index.php?topic=10572 for a discussion.
// It is only needed on first call, so we avoid it on all subsequent calls
- // due to performance.
+ // due to performance..
+ final Canvas parent = component instanceof AWTGLCanvas ? component : Display.getParent();
if (firstLockSucceeded)
- return lockAndInitHandle(lock_buffer, component);
+ return lockAndInitHandle(lock_buffer, component, parent);
else
try {
firstLockSucceeded = AccessController.doPrivileged(new PrivilegedExceptionAction<Boolean>() {
public Boolean run() throws LWJGLException {
- return lockAndInitHandle(lock_buffer, component);
+ return lockAndInitHandle(lock_buffer, component, parent);
}
});
return firstLockSucceeded;
@@ -94,7 +95,7 @@
}
}
- private static native boolean lockAndInitHandle(ByteBuffer lock_buffer, Canvas component) throws LWJGLException;
+ private static native boolean lockAndInitHandle(ByteBuffer lock_buffer, Canvas component, Canvas display_parent) throws LWJGLException;
void unlock() throws LWJGLException {
nUnlock(lock_buffer);
Modified: trunk/LWJGL/src/native/common/org_lwjgl_opengl_AWTSurfaceLock.c
===================================================================
--- trunk/LWJGL/src/native/common/org_lwjgl_opengl_AWTSurfaceLock.c 2011-08-29 00:54:54 UTC (rev 3624)
+++ trunk/LWJGL/src/native/common/org_lwjgl_opengl_AWTSurfaceLock.c 2011-08-29 13:34:17 UTC (rev 3625)
@@ -49,15 +49,29 @@
}
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_AWTSurfaceLock_lockAndInitHandle
- (JNIEnv *env, jclass clazz, jobject lock_buffer_handle, jobject canvas) {
+ (JNIEnv *env, jclass clazz, jobject lock_buffer_handle, jobject canvas, jobject display_parent) {
JAWT awt;
JAWT_DrawingSurface* ds;
JAWT_DrawingSurfaceInfo *dsi;
AWTSurfaceLock *awt_lock = (AWTSurfaceLock *)(*env)->GetDirectBufferAddress(env, lock_buffer_handle);
- awt.version = JAWT_VERSION_1_4;
- if (JAWT_GetAWT(env, &awt) == JNI_FALSE) {
- throwException(env, "Could not get the JAWT interface");
- return JNI_FALSE;
+
+ jboolean result = JNI_FALSE;
+
+ #ifdef __MACH__
+ if (display_parent) {
+ //first try CALAYER
+ awt.version = JAWT_VERSION_1_4 | JAWT_MACOSX_USE_CALAYER;
+ result = JAWT_GetAWT(env, &awt);
+ }
+ #endif
+
+ if (result == JNI_FALSE) {
+ // now try without CALAYER
+ awt.version = JAWT_VERSION_1_4;
+ if (JAWT_GetAWT(env, &awt) == JNI_FALSE) {
+ throwException(env, "Could not get the JAWT interface");
+ return JNI_FALSE;
+ }
}
ds = awt.GetDrawingSurface(env, canvas);
Modified: trunk/LWJGL/src/native/macosx/context.h
===================================================================
--- trunk/LWJGL/src/native/macosx/context.h 2011-08-29 00:54:54 UTC (rev 3624)
+++ trunk/LWJGL/src/native/macosx/context.h 2011-08-29 13:34:17 UTC (rev 3625)
@@ -50,6 +50,7 @@
typedef struct {
NSOpenGLPixelFormat *pixel_format;
bool window;
+ bool canDrawGL;
union {
NSView *nsview;
NSOpenGLPixelBuffer *pbuffer;
Modified: trunk/LWJGL/src/native/macosx/org_lwjgl_opengl_MacOSXCanvasPeerInfo.m
===================================================================
--- trunk/LWJGL/src/native/macosx/org_lwjgl_opengl_MacOSXCanvasPeerInfo.m 2011-08-29 00:54:54 UTC (rev 3624)
+++ trunk/LWJGL/src/native/macosx/org_lwjgl_opengl_MacOSXCanvasPeerInfo.m 2011-08-29 13:34:17 UTC (rev 3625)
@@ -37,6 +37,9 @@
* @version $Revision$
*/
+#import <Cocoa/Cocoa.h>
+#import <JavaNativeFoundation.h>
+
#include <jni.h>
#include <jawt_md.h>
#include "awt_tools.h"
@@ -44,13 +47,147 @@
#include "context.h"
#include "common_tools.h"
+// forward declaration
+@interface PBufferGLLayer : NSOpenGLLayer {
+ MacOSXPeerInfo *peer_info;
+ GLuint textureID;
+ BOOL canDraw;
+}
+
+@property (nonatomic) MacOSXPeerInfo *peer_info;
+@property (nonatomic) GLuint textureID;
+@end
+
+
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXCanvasPeerInfo_nInitHandle
- (JNIEnv *env, jclass clazz, jobject lock_buffer_handle, jobject peer_info_handle) {
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+(JNIEnv *env, jclass clazz, jobject lock_buffer_handle, jobject peer_info_handle) {
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+
MacOSXPeerInfo *peer_info = (MacOSXPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle);
AWTSurfaceLock *surface = (AWTSurfaceLock *)(*env)->GetDirectBufferAddress(env, lock_buffer_handle);
JAWT_MacOSXDrawingSurfaceInfo *macosx_dsi = (JAWT_MacOSXDrawingSurfaceInfo *)surface->dsi->platformInfo;
- peer_info->nsview = macosx_dsi->cocoaViewRef;
- peer_info->window = true;
+
+ // check for CALayer support
+ if(surface->awt.version & JAWT_MACOSX_USE_CALAYER) {
+ jint width = surface->dsi->bounds.width;
+ jint height = surface->dsi->bounds.height;
+
+ if(peer_info->pbuffer == NULL ||
+ width != [peer_info->pbuffer pixelsWide] || height != [peer_info->pbuffer pixelsHigh]) {
+ if(peer_info->pbuffer != NULL) {
+ [peer_info->pbuffer release];
+ }
+
+ // make pbuffer
+ NSOpenGLPixelBuffer *pbuffer = nil;
+ NSLog(@"Make pbuffer: %d x %d", width, height);
+ pbuffer = [[NSOpenGLPixelBuffer alloc] initWithTextureTarget:GL_TEXTURE_RECTANGLE_EXT
+ textureInternalFormat:GL_RGBA
+ textureMaxMipMapLevel:0
+ pixelsWide:width
+ pixelsHigh:height];
+
+ peer_info->pbuffer = pbuffer;
+ peer_info->window = false;
+ peer_info->canDrawGL = true;
+ }
+
+ if (macosx_dsi != NULL) {
+ [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){
+ // attach the "root layer" to the AWT Canvas surface layers
+ id <JAWT_SurfaceLayers> surfaceLayers = (id <JAWT_SurfaceLayers>)macosx_dsi;//dsi->platformInfo;
+ if(surfaceLayers.layer == NULL) {
+ PBufferGLLayer *caGLLayer = [[PBufferGLLayer new] autorelease];
+ caGLLayer.peer_info = peer_info;
+ caGLLayer.asynchronous = YES;
+ caGLLayer.needsDisplayOnBoundsChange = YES;
+ caGLLayer.opaque = YES;
+ surfaceLayers.layer = caGLLayer;
+ }
+ }];
+ }
+ } else {
+ peer_info->nsview = macosx_dsi->cocoaViewRef;
+ peer_info->window = true;
+ }
+
[pool release];
}
+
+// rotates a red square when asked to draw
+@implementation PBufferGLLayer
+
+@synthesize peer_info;
+@synthesize textureID;
+
+// override to draw custom GL content
+-(void)drawInCGLContext:(CGLContextObj)glContext
+ pixelFormat:(CGLPixelFormatObj)pixelFormat
+ forLayerTime:(CFTimeInterval)timeInterval
+ displayTime:(const CVTimeStamp *)timeStamp {
+
+ if(!peer_info || !peer_info->pbuffer) {
+ return;
+ }
+
+ peer_info->canDrawGL = false;
+
+ NSOpenGLPixelBuffer *pbuffer = self.peer_info->pbuffer;
+
+ // set the current context
+ CGLSetCurrentContext(glContext);
+
+ GLsizei width = [pbuffer pixelsWide];
+ GLsizei height = [pbuffer pixelsHigh];
+
+ if(textureID == 0) {
+ glGenTextures(1, &textureID);
+ }
+ glBindTexture(GL_TEXTURE_RECTANGLE_EXT, self.textureID);
+ CGLTexImagePBuffer(glContext,[pbuffer CGLPBufferObj], GL_FRONT);
+
+ glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+
+ glEnable(GL_TEXTURE_RECTANGLE_EXT);
+
+ static GLfloat verts[] = {
+ -1.0, -1.0,
+ -1.0, 1.0,
+ 1.0, 1.0,
+ 1.0, -1.0
+ };
+
+ GLfloat tex[] = {
+ 0.0, 0.0,
+ 0.0, height,
+ width, height,
+ width, 0.0
+ };
+
+ glEnableClientState(GL_VERTEX_ARRAY);
+ glEnableClientState(GL_TEXTURE_COORD_ARRAY);
+ glVertexPointer(2, GL_FLOAT, 0, verts);
+ glTexCoordPointer(2, GL_FLOAT, 0, tex);
+
+ glDrawArrays(GL_QUADS, 0, 4);
+
+ glDisableClientState(GL_VERTEX_ARRAY);
+ glDisableClientState(GL_TEXTURE_COORD_ARRAY);
+
+ glDisable(GL_TEXTURE_RECTANGLE_EXT);
+
+ // call super to finalize the drawing - by default all it does is call glFlush()
+ [super drawInCGLContext:glContext pixelFormat:pixelFormat forLayerTime:timeInterval displayTime:timeStamp];
+}
+
+-(BOOL)canDrawInCGLContext:(CGLContextObj)glContext
+ pixelFormat:(CGLPixelFormatObj)pixelFormat
+ forLayerTime:(CFTimeInterval)timeInterval
+ displayTime:(const CVTimeStamp *)timeStamp {
+ return peer_info->canDrawGL ? YES : NO;
+}
+
+@end
\ No newline at end of file
Modified: trunk/LWJGL/src/native/macosx/org_lwjgl_opengl_MacOSXContextImplementation.m
===================================================================
--- trunk/LWJGL/src/native/macosx/org_lwjgl_opengl_MacOSXContextImplementation.m 2011-08-29 00:54:54 UTC (rev 3624)
+++ trunk/LWJGL/src/native/macosx/org_lwjgl_opengl_MacOSXContextImplementation.m 2011-08-29 13:34:17 UTC (rev 3625)
@@ -45,6 +45,7 @@
typedef struct {
NSOpenGLContext *context;
+ MacOSXPeerInfo *peer_info;
} MacOSXContext;
JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_MacOSXContextImplementation_nCreate
@@ -72,6 +73,7 @@
}
context_info = (MacOSXContext *)(*env)->GetDirectBufferAddress(env, context_handle);
context_info->context = context;
+ context_info->peer_info = peer_info;
[pool release];
return context_handle;
}
@@ -79,8 +81,9 @@
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXContextImplementation_nSwapBuffers
(JNIEnv *env, jclass clazz, jobject context_handle) {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
- MacOSXContext *peer_info = (MacOSXContext *)(*env)->GetDirectBufferAddress(env, context_handle);
- [peer_info->context flushBuffer];
+ MacOSXContext *context_info = (MacOSXContext *)(*env)->GetDirectBufferAddress(env, context_handle);
+ [context_info->context flushBuffer];
+ context_info->peer_info->canDrawGL = true;
[pool release];
}
@@ -90,6 +93,7 @@
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
MacOSXContext *context_info = (MacOSXContext *)(*env)->GetDirectBufferAddress(env, context_handle);
[context_info->context update];
+ context_info->peer_info->canDrawGL = true;
[pool release];
}
@@ -118,6 +122,7 @@
} else {
[context_info->context setPixelBuffer:peer_info->pbuffer cubeMapFace:0 mipMapLevel:0 currentVirtualScreen:0];
}
+ peer_info->canDrawGL = true;
[pool release];
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2011-08-29 00:55:01
|
Revision: 3624
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3624&view=rev
Author: kappa1
Date: 2011-08-29 00:54:54 +0000 (Mon, 29 Aug 2011)
Log Message:
-----------
AppletLoader: somehow removed patch 3559 with last appletloader patch, readded removed code.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java
Modified: trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java 2011-08-29 00:40:28 UTC (rev 3623)
+++ trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java 2011-08-29 00:54:54 UTC (rev 3624)
@@ -146,6 +146,7 @@
* <li>Bobjob</li>
* <li>Dashiva</li>
* <li>Dr_evil</li>
+ * <li>Elias Naur</li>
* <li>Kevin Glass</li>
* <li>Matthias Mann</li>
* <li>Mickelukas</li>
@@ -837,14 +838,12 @@
// if specified applet version already available don't download anything
boolean versionAvailable = false;
- // version of applet
+ // version string of applet
String version = getParameter("al_version");
- float latestVersion = 0;
// if applet version specifed, compare with version in the cache
if (version != null) {
- latestVersion = Float.parseFloat(version);
- versionAvailable = compareVersion(versionFile, latestVersion);
+ versionAvailable = compareVersion(versionFile, version.toLowerCase());
}
// if jars not available or need updating download them
@@ -867,7 +866,7 @@
// save version information once jars downloaded successfully
if (version != null) {
percentage = 90;
- writeObjectFile(versionFile, latestVersion);
+ writeObjectFile(versionFile, version.toLowerCase());
}
// save file names with last modified info once downloaded successfully
@@ -959,21 +958,23 @@
/**
* This method will return true if the version stored in the file
- * matches the supplied float version.
+ * matches the supplied String version.
*
* @param versionFile - location to file containing version information
- * @param version - float version that needs to be compared
+ * @param version - String version that needs to be compared
* @return returns true if the version in file matches specified version
*/
- protected boolean compareVersion(File versionFile, float version) {
+ protected boolean compareVersion(File versionFile, String version) {
// if version file exists
if (versionFile.exists()) {
+ String s = readStringFile(versionFile);
+
// compare to version with file
- if (version == readFloatFile(versionFile)) {
+ if (s != null && s.equals(version)) {
percentage = 90; // not need to download cache files again
if(debugMode) {
- System.out.println("Loading Cached Applet Version " + version);
+ System.out.println("Loading Cached Applet Version: " + version);
}
debug_sleep(2000);
@@ -1056,22 +1057,21 @@
}
/**
- * read float from File
+ * read String object from File
*
* @param file to be read
- * @return the float stored in the file or 0 if it fails
+ * @return the String stored in the file or null if it fails
*/
- protected float readFloatFile(File file) {
+ protected String readStringFile(File file) {
try {
- Float version = (Float)readObjectFile(file);
- return version.floatValue();
+ return (String)readObjectFile(file);
} catch (Exception e) {
// failed to read version file
e.printStackTrace();
}
- // return 0 if failed to read file
- return 0;
+ // return null if failed to read file
+ return null;
}
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2011-08-29 00:40:37
|
Revision: 3623
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3623&view=rev
Author: kappa1
Date: 2011-08-29 00:40:28 +0000 (Mon, 29 Aug 2011)
Log Message:
-----------
AppletLoader: implement al_min_jre parameter, various small refactoring, update comments and javadoc.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java
Modified: trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java 2011-08-27 22:21:13 UTC (rev 3622)
+++ trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java 2011-08-29 00:40:28 UTC (rev 3623)
@@ -98,7 +98,7 @@
* The following applet parameters are required:
* <ul>
* <li>al_main - [String] Full package and class the applet to instantiate and display when loaded.</li>
- * <li>al_jars - [String] Comma seperated list of jars to download.</li>
+ * <li>al_jars - [String] Comma separated list of jars to download.</li>
* <p>
* <li>al_windows - [String] Jar containing native files for windows.</li>
* <li>al_linux - [String] Jar containing native files for linux.</li>
@@ -110,19 +110,21 @@
* <p>
* Additionally the following parameters can be supplied to tweak the behaviour of the AppletLoader.
* <ul>
+ * <li>al_cache - [boolean] Whether to use cache system. <i>Default: true</i>.</li>
* <li>al_version - [int or float] Version of deployment. If this is specified, the jars will be cached and
* reused if the version matches. If version doesn't match all of the files are reloaded.</li>
- * <li>al_cache - [boolean] Whether to use cache system. <i>Default: true</i>.</li>
+ *
* <li>al_debug - [boolean] Whether to enable debug mode. <i>Default: false</i>.</li>
- * <li>al_prepend_host - [boolean] Whether to limit caching to this domain, disable if your applet is hosted on multple domains and needs to share the cache. <i>Default: true</i>.</li>
+ * <li>al_min_jre - [String] Specify the minimum jre version that the applet requires, should be in format like 1.6.0_24 or a subset like 1.6 <i>Default: 1.5</i>.</li>
+ * <li>al_prepend_host - [boolean] Whether to limit caching to this domain, disable if your applet is hosted on multiple domains and needs to share the cache. <i>Default: true</i>.</li>
* <p>
* <li>al_windows64 - [String] If specified it will be used instead of al_windows on 64bit windows systems.</li>
- * <li>al_windows32 - [String] If specifed it will be used instead of al_windows on 32bit windows systems.</li>
- * <li>al_linux64 - [String] If specifed it will be used instead of al_linux on 64bit linux systems.</li>
- * <li>al_linux32 - [String] If specifed it will be used instead of al_linux on 32bit linux systems.</li>
- * <li>al_mac32 - [String] If specifed it will be used instead of al_mac on 64bit mac systems.</li>
- * <li>al_mac64 - [String] If specifed it will be used instead of al_mac on 32bit mac systems.</li>
- * <li>al_macppc - [String] If specifed it will be used instead of al_mac on PPC mac systems.</li>
+ * <li>al_windows32 - [String] If specified it will be used instead of al_windows on 32bit windows systems.</li>
+ * <li>al_linux64 - [String] If specified it will be used instead of al_linux on 64bit linux systems.</li>
+ * <li>al_linux32 - [String] If specified it will be used instead of al_linux on 32bit linux systems.</li>
+ * <li>al_mac32 - [String] If specified it will be used instead of al_mac on 64bit mac systems.</li>
+ * <li>al_mac64 - [String] If specified it will be used instead of al_mac on 32bit mac systems.</li>
+ * <li>al_macppc - [String] If specified it will be used instead of al_mac on PPC mac systems.</li>
* <p>
* <li>boxbgcolor - [String] any String AWT color ("red", "blue", etc), RGB (0-255) or hex formated color (#RRGGBB) to use as background. <i>Default: #ffffff</i>.</li>
* <li>boxfgcolor - [String] any String AWT color ("red", "blue", etc), RGB (0-255) or hex formated color (#RRGGBB) to use as foreground. <i>Default: #000000</i>.</li>
@@ -144,7 +146,6 @@
* <li>Bobjob</li>
* <li>Dashiva</li>
* <li>Dr_evil</li>
- * <li>Elias Naur</li>
* <li>Kevin Glass</li>
* <li>Matthias Mann</li>
* <li>Mickelukas</li>
@@ -160,36 +161,39 @@
/** initializing */
public static final int STATE_INIT = 1;
+
+ /** checking version of jre */
+ public static final int STATE_CHECK_JRE_VERSION = 2;
/** determining which packages that are required */
- public static final int STATE_DETERMINING_PACKAGES = 2;
+ public static final int STATE_DETERMINING_PACKAGES = 3;
/** checking for already downloaded files */
- public static final int STATE_CHECKING_CACHE = 3;
+ public static final int STATE_CHECKING_CACHE = 4;
/** downloading packages */
- public static final int STATE_DOWNLOADING = 4;
+ public static final int STATE_DOWNLOADING = 5;
/** extracting packages */
- public static final int STATE_EXTRACTING_PACKAGES = 5;
+ public static final int STATE_EXTRACTING_PACKAGES = 6;
/** validating packages */
- public static final int STATE_VALIDATING_PACKAGES = 6;
+ public static final int STATE_VALIDATING_PACKAGES = 7;
/** updating the classpath */
- public static final int STATE_UPDATING_CLASSPATH = 7;
+ public static final int STATE_UPDATING_CLASSPATH = 8;
/** switching to real applet */
- public static final int STATE_SWITCHING_APPLET = 8;
+ public static final int STATE_SWITCHING_APPLET = 9;
/** initializing real applet */
- public static final int STATE_INITIALIZE_REAL_APPLET = 9;
+ public static final int STATE_INITIALIZE_REAL_APPLET = 10;
/** stating real applet */
- public static final int STATE_START_REAL_APPLET = 10;
+ public static final int STATE_START_REAL_APPLET = 11;
/** done */
- public static final int STATE_DONE = 11;
+ public static final int STATE_DONE = 12;
/** used to calculate length of progress bar */
protected int percentage;
@@ -239,9 +243,6 @@
/** applet to load after all downloads are complete */
protected Applet lwjglApplet;
- /** whether a fatal error occured */
- protected boolean fatalError;
-
/** whether we're running in debug mode */
protected boolean debugMode;
@@ -280,19 +281,33 @@
/** messages to be passed via liveconnect in headless mode */
protected String[] headlessMessage;
+
+ /** whether a fatal error occurred */
+ protected boolean fatalError;
+
+ /** whether a certificate refused error occurred */
+ protected boolean certificateRefused;
+
+ /** whether the minimum required JRE version is not found */
+ protected boolean minimumJreNotFound;
/** generic error message to display on error */
protected String[] genericErrorMessage = { "An error occured while loading the applet.",
"Please contact support to resolve this issue.",
"<placeholder for error message>"};
- /** whether a certificate refused error occured */
- protected boolean certificateRefused;
-
- /** error message to display if user refuses to accept certicate*/
+ /** error message to display if user refuses to accept certificate*/
protected String[] certificateRefusedMessage = { "Permissions for Applet Refused.",
"Please accept the permissions dialog to allow",
"the applet to continue the loading process."};
+
+ /** error message to display if minimum JRE version is not met */
+ protected String[] minimumJREMessage = { "Your version of Java is out of date.",
+ "Visit java.com to get the latest version.",
+ "Java <al_min_jre> or greater is required."};
+
+ /** fatal error message to display */
+ protected String[] errorMessage;
/** have natives been loaded by another instance of this applet */
protected static boolean natives_loaded;
@@ -439,6 +454,7 @@
* This method will return the current progress of the AppletLoader
* as a value from 0-100. In the case of a fatal error it will
* return -1. If the certificate is refused it will return -2.
+ * If the minimum jre requirement is not met will return -3.
*
* When method returns 100 the AppletLoader will sleep until the
* method is called again. When called again it will switch to the
@@ -447,8 +463,10 @@
*/
public int getStatus() {
if (fatalError) {
+ headlessMessage = errorMessage;
+
if (certificateRefused) return -2;
- headlessMessage = (certificateRefused) ? certificateRefusedMessage : genericErrorMessage;
+ if (minimumJreNotFound) return -3;
return -1;
}
@@ -497,6 +515,9 @@
cleanUp(); // clean up resources
return;
}
+
+ // no drawing in headless mode
+ if (headless) return;
// create offscreen if missing
if (offscreen == null) {
@@ -529,12 +550,9 @@
og.fillRect(0, 0, offscreen.getWidth(null), offscreen.getHeight(null));
og.setColor(fgColor);
- String message = getDescriptionForState();
-
+
// if we had a failure of some sort, notify the user
if (fatalError) {
- String[] errorMessage = (certificateRefused) ? certificateRefusedMessage : genericErrorMessage;
-
for(int i=0; i<errorMessage.length; i++) {
if(errorMessage[i] != null) {
int messageX = (offscreen.getWidth(null) - fm.stringWidth(errorMessage[i])) / 2;
@@ -543,7 +561,7 @@
og.drawString(errorMessage[i], messageX, messageY + i*fm.getHeight());
}
}
- } else if (!headless) {
+ } else {
og.setColor(fgColor);
painting = true;
@@ -558,6 +576,8 @@
}
// draw message
+ String message = getDescriptionForState();
+
int messageX = (offscreen.getWidth(null) - fm.stringWidth(message)) / 2;
int messageY = y + 20;
@@ -572,7 +592,7 @@
og.drawString(subtaskMessage, messageX, messageY+20);
}
- // draw loading bar, clipping it depending on percentage done
+ // draw loading progress bar, clipping it depending on percentage done
if (progressbar != null) {
int barSize = (progressbar.getWidth(null) * percentage) / 100;
og.clipRect(x-progressbar.getWidth(null)/2, 0, barSize, offscreen.getHeight(null));
@@ -636,6 +656,8 @@
switch (state) {
case STATE_INIT:
return "Initializing loader";
+ case STATE_CHECK_JRE_VERSION:
+ return "Checking version";
case STATE_DETERMINING_PACKAGES:
return "Determining packages to load";
case STATE_CHECKING_CACHE:
@@ -772,24 +794,30 @@
}
/**
- * 8 steps
+ * 9 steps
*
- * 1) check applet cache and decide whether to download jars
- * 2) download the jars
- * 3) extract native files
- * 4) validate jars for any corruption
- * 5) save applet cache information
- * 6) add jars to class path
- * 7) set any lwjgl properties
- * 8) switch to loaded applet
+ * 1) check jre version meets minimum requirements
+ * 2) check applet cache and decide which jars to download
+ * 3) download the jars
+ * 4) extract native files
+ * 5) validate jars for any corruption
+ * 6) save applet cache information
+ * 7) add jars to class path
+ * 8) set any lwjgl properties
+ * 9) switch to loaded applet
*/
public void run() {
- setState(STATE_CHECKING_CACHE);
+ percentage = 5;
- percentage = 5;
-
try {
debug_sleep(2000);
+
+ // check JRE version meets minimum requirements
+ if (!isMinJREVersionAvailable()) {
+ minimumJreNotFound = true;
+ fatalErrorOccured("Java " + getStringParameter("al_min_jre", "1.5") + " or greater is required.", null);
+ return;
+ }
// parse the urls for the jars into the url list
loadJarURLs();
@@ -809,12 +837,14 @@
// if specified applet version already available don't download anything
boolean versionAvailable = false;
- // version string of applet
+ // version of applet
String version = getParameter("al_version");
-
+ float latestVersion = 0;
+
// if applet version specifed, compare with version in the cache
if (version != null) {
- versionAvailable = compareVersion(versionFile, version.toLowerCase());
+ latestVersion = Float.parseFloat(version);
+ versionAvailable = compareVersion(versionFile, latestVersion);
}
// if jars not available or need updating download them
@@ -837,7 +867,7 @@
// save version information once jars downloaded successfully
if (version != null) {
percentage = 90;
- writeObjectFile(versionFile, version.toLowerCase());
+ writeObjectFile(versionFile, latestVersion);
}
// save file names with last modified info once downloaded successfully
@@ -871,8 +901,8 @@
});
} catch (AccessControlException ace) {
+ certificateRefused = true;
fatalErrorOccured(ace.getMessage(), ace);
- certificateRefused = true;
} catch (Exception e) {
fatalErrorOccured("This occurred while '" + getDescriptionForState() + "'", e);
} finally {
@@ -881,24 +911,69 @@
}
/**
+ * When this method is supplied with a JRE version it will compare it to the
+ * current JRE version.
+ *
+ * minimum requried JRE version is set using al_min_jre parameter, if not
+ * this is not set then the value will default to version 1.5
+ *
+ * The minimumVersion should follow a structure such as x.x.x_x
+ * Example values would include 1.6.0_10 or a subset like 1.6.0 or 1.6
+ *
+ * @return returns true if the available version is greater or equal to the
+ * minimum version required
+ *
+ * @throws Exception a NumberFormatException is thrown if the string is not valid
+ */
+ public boolean isMinJREVersionAvailable() throws Exception {
+ setState(STATE_CHECK_JRE_VERSION);
+
+ String minimumVersion = getStringParameter("al_min_jre", "1.5");
+ String javaVersion = System.getProperty("java.version");
+
+ // split version string into a string arrays
+ String[] jvmVersionData = javaVersion.split("[_\\.]");
+ String[] minVersionData = minimumVersion.split("[_\\.]");
+
+ int maxLength = Math.max(jvmVersionData.length, minVersionData.length);
+
+ // convert string arrays into int arrays
+ int[] jvmVersion = new int[maxLength];
+ int[] minVersion = new int[maxLength];
+
+ for (int i = 0; i < jvmVersionData.length; i++) {
+ jvmVersion[i] = Integer.parseInt(jvmVersionData[i]);
+ }
+
+ for (int i = 0; i < minVersionData.length; i++) {
+ minVersion[i] = Integer.parseInt(minVersionData[i]);
+ }
+
+ // compare versions
+ for (int i = 0; i < maxLength; i++) {
+ if (jvmVersion[i] < minVersion[i]) return false; // minVersion is greater then jvmVersion
+ }
+
+ return true;
+ }
+
+ /**
* This method will return true if the version stored in the file
- * matches the supplied String version.
+ * matches the supplied float version.
*
* @param versionFile - location to file containing version information
- * @param version - String version that needs to be compared
+ * @param version - float version that needs to be compared
* @return returns true if the version in file matches specified version
*/
- protected boolean compareVersion(File versionFile, String version) {
+ protected boolean compareVersion(File versionFile, float version) {
// if version file exists
if (versionFile.exists()) {
- String s = readStringFile(versionFile);
-
// compare to version with file
- if (s != null && s.equals(version)) {
+ if (version == readFloatFile(versionFile)) {
percentage = 90; // not need to download cache files again
if(debugMode) {
- System.out.println("Loading Cached Applet Version: " + version);
+ System.out.println("Loading Cached Applet Version " + version);
}
debug_sleep(2000);
@@ -981,21 +1056,22 @@
}
/**
- * read String object from File
+ * read float from File
*
* @param file to be read
- * @return the String stored in the file or null if it fails
+ * @return the float stored in the file or 0 if it fails
*/
- protected String readStringFile(File file) {
+ protected float readFloatFile(File file) {
try {
- return (String)readObjectFile(file);
+ Float version = (Float)readObjectFile(file);
+ return version.floatValue();
} catch (Exception e) {
// failed to read version file
e.printStackTrace();
}
- // return null if failed to read file
- return null;
+ // return 0 if failed to read file
+ return 0;
}
/**
@@ -1226,7 +1302,8 @@
* @throws Exception - if fails to get infomation
*/
protected void getJarInfo(File dir) throws Exception {
-
+ setState(STATE_CHECKING_CACHE);
+
filesLastModified = new HashMap<String, Long>();
// store file sizes and mark which files not to download
@@ -1285,7 +1362,6 @@
* @throws Exception if download fails
*/
protected void downloadJars(String path) throws Exception {
-
setState(STATE_DOWNLOADING);
URLConnection urlconnection;
@@ -1980,13 +2056,25 @@
}
/**
- * Sets the state of the loaded and prints some debug information
+ * Sets the error message and print debug information
*
* @param error Error message to print
*/
protected void fatalErrorOccured(String error, Exception e) {
fatalError = true;
- genericErrorMessage[genericErrorMessage.length-1] = error;
+
+ if (minimumJreNotFound) {
+ errorMessage = minimumJREMessage;
+ errorMessage[errorMessage.length-1] = error;
+ }
+ else if (certificateRefused) {
+ errorMessage = certificateRefusedMessage;
+ }
+ else {
+ errorMessage = genericErrorMessage;
+ errorMessage[errorMessage.length-1] = error;
+ }
+
System.out.println(error);
if(e != null) {
System.out.println(e.getMessage());
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2011-08-27 22:21:20
|
Revision: 3622
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3622&view=rev
Author: kappa1
Date: 2011-08-27 22:21:13 +0000 (Sat, 27 Aug 2011)
Log Message:
-----------
Mac Ant build.xml - bump minimum requirements for compiling lwjgl on OS X to prepare for new plugin2 patch. OS X SDK 10.6 and Java 6 update 4 (1.6.0_24) are now the minimum requirements to compile LWJGL on OS X however OS X 10.3+ is still the targeted for compatibility.
Modified Paths:
--------------
trunk/LWJGL/platform_build/macosx_ant/build.xml
Modified: trunk/LWJGL/platform_build/macosx_ant/build.xml
===================================================================
--- trunk/LWJGL/platform_build/macosx_ant/build.xml 2011-08-24 23:18:56 UTC (rev 3621)
+++ trunk/LWJGL/platform_build/macosx_ant/build.xml 2011-08-27 22:21:13 UTC (rev 3622)
@@ -20,7 +20,7 @@
<target name="compile">
<apply dir="${dstdir}" executable="${compiler}" os="Mac OS X" skipemptyfilesets="true" failonerror="true" dest="${dstdir}">
- <arg line="${cflags} -ObjC -O2 -Wall -Wunused -c -fPIC -I${sdkroot}/System/Library/Frameworks/JavaVM.framework/Versions/A/Headers -I${native}/common -I${native}/common/opengl -I${native}/macosx"/>
+ <arg line="${cflags} -ObjC -O2 -Wall -Wunused -c -fPIC -I${sdkroot}/System/Library/Frameworks/JavaVM.framework/Versions/A/Headers -I${sdkroot}/System/Library/Frameworks/JavaVM.framework/Versions/A/Frameworks/JavaNativeFoundation.framework/Headers -I${native}/common -I${native}/common/opengl -I${native}/macosx"/>
<!-- Map from *.m and *.c to .o -->
<mapper type="regexp" from="^(.*)\.(c|m)" to="\1.o"/>
<fileset dir="${native}/macosx" includes="*.m"/>
@@ -35,7 +35,7 @@
<target name="link">
<apply dir="${objdir}" parallel="true" executable="${linker}" os="Mac OS X" failonerror="true" skipemptyfilesets="true">
- <arg line="${linkerflags} -exported_symbols_list ../lwjgl.symbols -dynamiclib -o ${libname} -framework Foundation -framework AppKit -framework JavaVM -framework Carbon"/>
+ <arg line="${linkerflags} -exported_symbols_list ../lwjgl.symbols -dynamiclib -o ${libname} -framework Foundation -framework AppKit -framework JavaVM -framework Carbon -framework OpenGL"/>
<fileset dir="${objdir}" includes="*.o"/>
</apply>
<apply dir="${objdir}" executable="strip" os="Mac OS X" failonerror="true">
@@ -45,9 +45,9 @@
</target>
<target name="nativelibrary" depends="init">
- <property name="universal_sdkroot" location="/Developer/SDKs/MacOSX10.4u.sdk"/>
- <property name="ppc_sdkroot" location="/Developer/SDKs/MacOSX10.4u.sdk"/>
- <property name="x86_64_sdkroot" location="/Developer/SDKs/MacOSX10.5.sdk"/>
+ <property name="universal_sdkroot" location="/Developer/SDKs/MacOSX10.6.sdk"/>
+ <property name="ppc_sdkroot" location="/Developer/SDKs/MacOSX10.6.sdk"/>
+ <property name="x86_64_sdkroot" location="/Developer/SDKs/MacOSX10.6.sdk"/>
<property name="universal_flags" value="-isysroot ${universal_sdkroot}"/>
<property name="ppc_flags" value="-isysroot ${ppc_sdkroot}"/>
<antcall target="compile">
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2011-08-24 23:19:03
|
Revision: 3621
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3621&view=rev
Author: spasi
Date: 2011-08-24 23:18:56 +0000 (Wed, 24 Aug 2011)
Log Message:
-----------
Fixed Pbuffer init when Display has not been created.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/opengl/Pbuffer.java
trunk/LWJGL/src/java/org/lwjgl/opengl/PixelFormat.java
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/Pbuffer.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/Pbuffer.java 2011-08-20 16:38:45 UTC (rev 3620)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/Pbuffer.java 2011-08-24 23:18:56 UTC (rev 3621)
@@ -217,11 +217,11 @@
this.width = width;
this.height = height;
this.peer_info = createPbuffer(width, height, pixel_format, renderTexture);
- Context shared_context;
+ Context shared_context = null;
+ if ( shared_drawable == null )
+ shared_drawable = Display.getDrawable(); // May be null
if (shared_drawable != null)
shared_context = ((DrawableLWJGL)shared_drawable).getContext();
- else
- shared_context = ((DrawableLWJGL)Display.getDrawable()).getContext(); // May be null
this.context = new ContextGL(peer_info, attribs, (ContextGL)shared_context);
}
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/PixelFormat.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/PixelFormat.java 2011-08-20 16:38:45 UTC (rev 3620)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/PixelFormat.java 2011-08-24 23:18:56 UTC (rev 3621)
@@ -38,7 +38,7 @@
* <p/>
* Instants of this class are immutable. An example of the expected way to set
* the PixelFormat property values is the following:
- * <code>PixelFormat pf = new PixelFormat().withDepth(24).withSamples(4).withSRGB(true);</code>
+ * <code>PixelFormat pf = new PixelFormat().withDepthBits(24).withSamples(4).withSRGB(true);</code>
* <p/>
* WARNING: Some pixel formats are known to cause troubles on certain buggy drivers.
* Example: Under Windows, specifying samples != 0 will enable the ARB
@@ -47,7 +47,6 @@
* @author eli...@so...
* @version $Revision$
*/
-
public final class PixelFormat implements PixelFormatLWJGL {
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2011-08-20 16:38:52
|
Revision: 3620
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3620&view=rev
Author: spasi
Date: 2011-08-20 16:38:45 +0000 (Sat, 20 Aug 2011)
Log Message:
-----------
Text encoding improvements.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/MemoryUtil.java
trunk/LWJGL/src/java/org/lwjgl/WindowsSysImplementation.java
trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java
trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java
trunk/LWJGL/src/native/linux/opengl/org_lwjgl_opengl_Display.c
trunk/LWJGL/src/native/linux/opengles/org_lwjgl_opengl_Display.c
Modified: trunk/LWJGL/src/java/org/lwjgl/MemoryUtil.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/MemoryUtil.java 2011-08-20 11:56:46 UTC (rev 3619)
+++ trunk/LWJGL/src/java/org/lwjgl/MemoryUtil.java 2011-08-20 16:38:45 UTC (rev 3620)
@@ -33,26 +33,28 @@
import java.lang.reflect.Field;
import java.nio.*;
+import java.nio.charset.CharacterCodingException;
import java.nio.charset.Charset;
import java.nio.charset.CharsetEncoder;
+import java.nio.charset.CoderResult;
/**
* [INTERNAL USE ONLY]
* <p/>
- * This class provides utility methods for passing buffer addresses to JNI API calls.
+ * This class provides utility methods for passing buffers to JNI API calls.
*
* @author Spasi
*/
public final class MemoryUtil {
- private static final CharsetEncoder textEncoder;
+ private static final Charset ascii;
+ private static final Charset utf8;
+ private static final Charset utf16;
static {
- CharsetEncoder encoder = Charset.defaultCharset().newEncoder();
- if ( 1.0f < encoder.maxBytesPerChar() )
- encoder = Charset.forName("ISO-8859-1").newEncoder();
-
- textEncoder = encoder;
+ ascii = Charset.forName("ISO-8859-1");
+ utf8 = Charset.forName("UTF-8");
+ utf16 = Charset.forName("UTF-16LE");
}
private static final Accessor memUtil;
@@ -190,63 +192,128 @@
// --- [ String utilities ] ---
/**
- * Returns the specified text as a null-terminated CharBuffer.
+ * Returns a ByteBuffer containing the specified text ASCII encoded and null-terminated.
+ * If text is null, null is returned.
*
* @param text the text to encode
*
- * @return the encoded text
+ * @return the encoded text or null
+ *
+ * @see String#getBytes()
*/
- public static CharBuffer encodeUTF16(final CharSequence text) {
- CharBuffer buffer = BufferUtils.createCharBuffer(text.length() + 1);
- buffer.append(text).append('\0');
- buffer.flip();
- return buffer;
+ public static ByteBuffer encodeASCII(final CharSequence text) {
+ return encode(text, ascii);
}
/**
- * Returns the specified text array as a CharBuffer. The CharBuffer is packed
- * and each text is null-terminated.
+ * Returns a ByteBuffer containing the specified text UTF-8 encoded and null-terminated.
+ * If text is null, null is returned.
*
- * @param text the text array to encode
+ * @param text the text to encode
*
- * @return the encoded text
+ * @return the encoded text or null
+ *
+ * @see String#getBytes()
*/
- public static CharBuffer encodeUTF16(final CharSequence... text) {
- int len = 0;
- for ( CharSequence cs : text )
- len += cs.length();
-
- final CharBuffer buffer = BufferUtils.createCharBuffer(len + text.length);
- for ( CharSequence cs : text )
- buffer.append(cs).append('\0');
-
- buffer.flip();
- return buffer;
+ public static ByteBuffer encodeUTF8(final CharSequence text) {
+ return encode(text, utf8);
}
/**
- * Encodes and null-terminated the specified text and returns a ByteBuffer.
+ * Returns a ByteBuffer containing the specified text UTF-16LE encoded and null-terminated.
* If text is null, null is returned.
*
* @param text the text to encode
*
- * @return the encoded text or null
+ * @return the encoded text
+ */
+ public static ByteBuffer encodeUTF16(final CharSequence text) {
+ return encode(text, utf16);
+ }
+
+ /**
+ * Wraps the specified text in a null-terminated CharBuffer and encodes it using the specified Charset.
*
- * @see String#getBytes()
+ * @param text the text to encode
+ * @param charset the charset to use for encoding
+ *
+ * @return the encoded text
*/
- public static ByteBuffer encodeASCII(final CharSequence text) {
+ private static ByteBuffer encode(final CharSequence text, final Charset charset) {
if ( text == null )
return null;
- final ByteBuffer buffer = BufferUtils.createByteBuffer(text.length() + 1);
+ return encode(CharBuffer.wrap(new CharSequenceNT(text)), charset);
+ }
- textEncoder.encode(CharBuffer.wrap(text), buffer, true);
- buffer.put((byte)0);
- buffer.flip();
+ /**
+ * A {@link CharsetEncoder#encode(java.nio.CharBuffer)} implementation that uses {@link BufferUtils#createByteBuffer(int)}
+ * instead of {@link ByteBuffer#allocate(int)}.
+ *
+ * @see CharsetEncoder#encode(java.nio.CharBuffer)
+ */
+ private static ByteBuffer encode(final CharBuffer in, final Charset charset) {
+ final CharsetEncoder encoder = charset.newEncoder(); // encoders are not thread-safe, create a new one on every call
- return buffer;
+ int n = (int)(in.remaining() * encoder.averageBytesPerChar());
+ ByteBuffer out = BufferUtils.createByteBuffer(n);
+
+ if ( n == 0 && in.remaining() == 0 )
+ return out;
+
+ encoder.reset();
+ while ( true ) {
+ CoderResult cr = in.hasRemaining() ? encoder.encode(in, out, true) : CoderResult.UNDERFLOW;
+ if ( cr.isUnderflow() )
+ cr = encoder.flush(out);
+
+ if ( cr.isUnderflow() )
+ break;
+
+ if ( cr.isOverflow() ) {
+ n = 2 * n + 1; // Ensure progress; n might be 0!
+ ByteBuffer o = BufferUtils.createByteBuffer(n);
+ out.flip();
+ o.put(out);
+ out = o;
+ continue;
+ }
+
+ try {
+ cr.throwException();
+ } catch (CharacterCodingException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ out.flip();
+ return out;
}
+ /** A null-terminated CharSequence. */
+ private static class CharSequenceNT implements CharSequence {
+
+ final CharSequence source;
+
+ CharSequenceNT(CharSequence source) {
+ this.source = source;
+ }
+
+ public int length() {
+ return source.length() + 1;
+
+ }
+
+ public char charAt(final int index) {
+ return index == source.length() ? '\0' : source.charAt(index);
+
+ }
+
+ public CharSequence subSequence(final int start, final int end) {
+ return new CharSequenceNT(source.subSequence(start, Math.min(end, source.length())));
+ }
+
+ }
+
interface Accessor {
long getAddress(Buffer buffer);
@@ -307,4 +374,4 @@
throw new NoSuchFieldException(fieldName + " does not exist in " + type.getSimpleName() + " or any of its superclasses.");
}
-}
\ No newline at end of file
+}
Modified: trunk/LWJGL/src/java/org/lwjgl/WindowsSysImplementation.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/WindowsSysImplementation.java 2011-08-20 11:56:46 UTC (rev 3619)
+++ trunk/LWJGL/src/java/org/lwjgl/WindowsSysImplementation.java 2011-08-20 16:38:45 UTC (rev 3620)
@@ -31,7 +31,7 @@
*/
package org.lwjgl;
-import java.nio.CharBuffer;
+import java.nio.ByteBuffer;
import java.security.PrivilegedExceptionAction;
import java.security.PrivilegedActionException;
import java.security.AccessController;
@@ -99,10 +99,9 @@
LWJGLUtil.log(String.format("*** Alert *** %s\n%s\n", title, message));
- // Pack both strings in the same buffer
- final CharBuffer buffer = MemoryUtil.encodeUTF16(title, message);
- final long address = MemoryUtil.getAddress0(buffer);
- nAlert(getHwnd(), address, address + (title.length() + 1) * 2);
+ final ByteBuffer titleText = MemoryUtil.encodeUTF16(title);
+ final ByteBuffer messageText = MemoryUtil.encodeUTF16(message);
+ nAlert(getHwnd(), MemoryUtil.getAddress(titleText), MemoryUtil.getAddress(messageText));
}
private static native void nAlert(long parent_hwnd, long title, long message);
private static native void initCommonControls();
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java 2011-08-20 11:56:46 UTC (rev 3619)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java 2011-08-20 16:38:45 UTC (rev 3620)
@@ -53,6 +53,7 @@
import org.lwjgl.BufferUtils;
import org.lwjgl.LWJGLException;
import org.lwjgl.LWJGLUtil;
+import org.lwjgl.MemoryUtil;
import org.lwjgl.opengl.XRandR.Screen;
import org.lwjgl.opengles.EGL;
@@ -138,7 +139,7 @@
private long current_cursor;
private long blank_cursor;
private boolean mouseInside = true;
-
+
private Canvas parent;
private long parent_window;
private boolean xembedded;
@@ -148,7 +149,7 @@
private LinuxKeyboard keyboard;
private LinuxMouse mouse;
-
+
private final FocusListener focus_listener = new FocusListener() {
public void focusGained(FocusEvent e) {
synchronized (GlobalLock.lock) {
@@ -499,7 +500,7 @@
private static native void reparentWindow(long display, long window, long parent, int x, int y);
private static native long nGetInputFocus(long display) throws LWJGLException;
private static native void nSetInputFocus(long display, long window, long time);
-
+
private static boolean isAncestorXEmbedded(long window) throws LWJGLException {
long xembed_atom = internAtom("_XEMBED_INFO", true);
if (xembed_atom != None) {
@@ -728,12 +729,13 @@
public void setTitle(String title) {
lockAWT();
try {
- nSetTitle(getDisplay(), getWindow(), title);
+ final ByteBuffer titleText = MemoryUtil.encodeUTF8(title);
+ nSetTitle(getDisplay(), getWindow(), MemoryUtil.getAddress(titleText), titleText.remaining() - 1);
} finally {
unlockAWT();
}
}
- private static native void nSetTitle(long display, long window, String title);
+ private static native void nSetTitle(long display, long window, long title, int len);
public boolean isCloseRequested() {
boolean result = close_requested;
@@ -915,19 +917,19 @@
unlockAWT();
}
}
-
+
private void checkInput() {
if (parent == null) return;
-
+
if (xembedded) {
long current_focus_window = 0;
-
+
try {
current_focus_window = nGetInputFocus(getDisplay());
} catch (LWJGLException e) {
return; // fail silently as it can fail whilst splitting browser tabs
}
-
+
if (last_window_focus != current_focus_window || parent_focused != focused) {
if (isParentWindowActive(current_focus_window)) {
if (parent_focused) {
@@ -963,49 +965,49 @@
}
}
}
-
+
/**
* This method will check if the parent window is active when running
- * in xembed mode. Every xembed embedder window has a focus proxy
- * window that recieves all the input. This method will test whether
- * the provided window handle is the focus proxy, if so it will get its
+ * in xembed mode. Every xembed embedder window has a focus proxy
+ * window that recieves all the input. This method will test whether
+ * the provided window handle is the focus proxy, if so it will get its
* parent window and then test whether this is an ancestor to our
* current_window. If so then parent window is active.
- *
+ *
* @param window - the window handle to test
*/
private boolean isParentWindowActive(long window) {
try {
// parent window already active as window is current_window
if (window == current_window) return true;
-
+
// xembed focus proxy will have no children
if (getChildCount(getDisplay(), window) != 0) return false;
-
+
// get parent, will be xembed embedder window and ancestor of current_window
long parent_window = getParentWindow(getDisplay(), window);
-
+
// parent must not be None
if (parent_window == None) return false;
-
+
// scroll current_window's ancestors to find parent_window
long w = current_window;
-
+
while (w != None) {
w = getParentWindow(getDisplay(), w);
if (w == parent_window) {
parent_proxy_focus_window = window; // save focus proxy window
return true;
}
- }
+ }
} catch (LWJGLException e) {
LWJGLUtil.log("Failed to detect if parent window is active: " + e.getMessage());
return true; // on failure assume still active
}
-
+
return false; // failed to find an active parent window
}
-
+
private void setFocused(boolean got_focus, int focus_detail) {
if (focused == got_focus || focus_detail == NotifyDetailNone || focus_detail == NotifyPointer || focus_detail == NotifyPointerRoot || parent != null)
return;
@@ -1356,11 +1358,11 @@
public boolean isInsideWindow() {
return mouseInside;
}
-
+
public void setResizable(boolean resizable) {
-
+
}
-
+
public boolean wasResized() {
return false;
}
@@ -1552,4 +1554,4 @@
}
}
-}
\ No newline at end of file
+}
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java 2011-08-20 11:56:46 UTC (rev 3619)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java 2011-08-20 16:38:45 UTC (rev 3620)
@@ -438,7 +438,7 @@
private static native DisplayMode getCurrentDisplayMode() throws LWJGLException;
public void setTitle(String title) {
- CharBuffer buffer = MemoryUtil.encodeUTF16(title);
+ ByteBuffer buffer = MemoryUtil.encodeUTF16(title);
nSetTitle(hwnd, MemoryUtil.getAddress0(buffer));
}
private static native void nSetTitle(long hwnd, long title);
Modified: trunk/LWJGL/src/native/linux/opengl/org_lwjgl_opengl_Display.c
===================================================================
--- trunk/LWJGL/src/native/linux/opengl/org_lwjgl_opengl_Display.c 2011-08-20 11:56:46 UTC (rev 3619)
+++ trunk/LWJGL/src/native/linux/opengl/org_lwjgl_opengl_Display.c 2011-08-20 16:38:45 UTC (rev 3620)
@@ -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.
*/
@@ -72,8 +72,8 @@
static Colormap cmap;
static int current_depth;
-static Pixmap current_icon_pixmap;
-static Pixmap current_icon_mask_pixmap;
+static Pixmap current_icon_pixmap;
+static Pixmap current_icon_mask_pixmap;
static Visual *current_visual;
@@ -94,7 +94,7 @@
jmethodID handler_method = (*env)->GetStaticMethodID(env, org_lwjgl_LinuxDisplay_class, "globalErrorHandler", "(JJJJJJJ)I");
if (handler_method == NULL)
return 0;
- return (*env)->CallStaticIntMethod(env, org_lwjgl_LinuxDisplay_class, handler_method, (jlong)(intptr_t)disp, (jlong)(intptr_t)error,
+ return (*env)->CallStaticIntMethod(env, org_lwjgl_LinuxDisplay_class, handler_method, (jlong)(intptr_t)disp, (jlong)(intptr_t)error,
(jlong)(intptr_t)error->display, (jlong)error->serial, (jlong)error->error_code, (jlong)error->request_code, (jlong)error->minor_code);
} else
return 0;
@@ -170,15 +170,16 @@
return window_mode == org_lwjgl_opengl_LinuxDisplay_FULLSCREEN_LEGACY;
}
-static void setWindowTitle(Display *disp, Window window, const char *title) {
- XStoreName(disp, window, title);
+static void setWindowTitle(Display *disp, Window window, jlong title, jint len) {
+ // ASCII fallback if XChangeProperty fails.
+ XStoreName(disp, window, (const char *)(intptr_t)title);
- // tell WM to use Unicode
+ // Set the UTF-8 encoded title
XChangeProperty(disp, window,
XInternAtom(disp, "_NET_WM_NAME", False),
XInternAtom(disp, "UTF8_STRING", False),
- 8, PropModeReplace, (unsigned char *) title,
- strlen(title));
+ 8, PropModeReplace, (const char *)(intptr_t)title,
+ len);
}
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_openDisplay(JNIEnv *env, jclass clazz) {
@@ -202,13 +203,11 @@
Display *disp = (Display *)(intptr_t)display;
initPeerInfo(env, peer_info_handle, disp, screen, pixel_format, true, GLX_WINDOW_BIT, true, false);
}
-
-JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSetTitle(JNIEnv * env, jclass clazz, jlong display, jlong window_ptr, jstring title_obj) {
+
+JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSetTitle(JNIEnv * env, jclass clazz, jlong display, jlong window_ptr, jlong title, jint len) {
Display *disp = (Display *)(intptr_t)display;
Window window = (Window)window_ptr;
- char * title = GetStringNativeChars(env, title_obj);
- setWindowTitle(disp, window, title);
- free(title);
+ setWindowTitle(disp, window, title, len);
}
static void freeIconPixmap(Display *disp) {
@@ -285,7 +284,7 @@
throwException(env, "XAllocWMHints failed");
return;
}
-
+
win_hints->flags = InputHint;
win_hints->input = True;
if (current_icon_pixmap != 0) {
@@ -321,10 +320,10 @@
attribs.override_redirect = True;
}
win = XCreateWindow(disp, parent, x, y, width, height, 0, vis_info->depth, InputOutput, vis_info->visual, attribmask, &attribs);
-
+
current_depth = vis_info->depth;
current_visual = vis_info->visual;
-
+
XFree(vis_info);
if (!checkXError(env, disp)) {
XFreeColormap(disp, cmap);
@@ -511,7 +510,7 @@
throwException(env, "XCreateImage failed");
return None;
}
-
+
GC gc = XCreateGC(disp, pixmap, 0, NULL);
XPutImage(disp, pixmap, gc, image, 0, 0, 0, 0, width, height);
XFreeGC(disp, gc);
@@ -530,7 +529,7 @@
freeIconPixmap(disp);
return;
}
-
+
updateWindowHints(env, disp, window);
}
Modified: trunk/LWJGL/src/native/linux/opengles/org_lwjgl_opengl_Display.c
===================================================================
--- trunk/LWJGL/src/native/linux/opengles/org_lwjgl_opengl_Display.c 2011-08-20 11:56:46 UTC (rev 3619)
+++ trunk/LWJGL/src/native/linux/opengles/org_lwjgl_opengl_Display.c 2011-08-20 16:38:45 UTC (rev 3620)
@@ -167,15 +167,16 @@
return window_mode == org_lwjgl_opengl_LinuxDisplay_FULLSCREEN_LEGACY;
}
-static void setWindowTitle(Display *disp, Window window, const char *title) {
- XStoreName(disp, window, title);
+static void setWindowTitle(Display *disp, Window window, jlong title, jint len) {
+ // ASCII fallback if XChangeProperty fails.
+ XStoreName(disp, window, (const char *)(intptr_t)title);
- // tell WM to use Unicode
+ // Set the UTF-8 encoded title
XChangeProperty(disp, window,
XInternAtom(disp, "_NET_WM_NAME", False),
XInternAtom(disp, "UTF8_STRING", False),
- 8, PropModeReplace, (unsigned char *) title,
- strlen(title));
+ 8, PropModeReplace, (const char *)(intptr_t)title,
+ len);
}
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_openDisplay(JNIEnv *env, jclass clazz) {
@@ -197,12 +198,10 @@
//initPeerInfo(env, peer_info_handle, disp, screen);
}
-JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSetTitle(JNIEnv * env, jclass clazz, jlong display, jlong window_ptr, jstring title_obj) {
+JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSetTitle(JNIEnv * env, jclass clazz, jlong display, jlong window_ptr, jlong title, jint len) {
Display *disp = (Display *)(intptr_t)display;
Window window = (Window)window_ptr;
- char * title = GetStringNativeChars(env, title_obj);
- setWindowTitle(disp, window, title);
- free(title);
+ setWindowTitle(disp, window, title, len);
}
static void freeIconPixmap(Display *disp) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2011-08-20 11:56:53
|
Revision: 3619
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3619&view=rev
Author: kappa1
Date: 2011-08-20 11:56:46 +0000 (Sat, 20 Aug 2011)
Log Message:
-----------
Add Unicode support to the native Window title on Linux
Modified Paths:
--------------
trunk/LWJGL/src/native/linux/opengl/org_lwjgl_opengl_Display.c
trunk/LWJGL/src/native/linux/opengles/org_lwjgl_opengl_Display.c
Modified: trunk/LWJGL/src/native/linux/opengl/org_lwjgl_opengl_Display.c
===================================================================
--- trunk/LWJGL/src/native/linux/opengl/org_lwjgl_opengl_Display.c 2011-08-18 23:17:17 UTC (rev 3618)
+++ trunk/LWJGL/src/native/linux/opengl/org_lwjgl_opengl_Display.c 2011-08-20 11:56:46 UTC (rev 3619)
@@ -172,6 +172,13 @@
static void setWindowTitle(Display *disp, Window window, const char *title) {
XStoreName(disp, window, title);
+
+ // tell WM to use Unicode
+ XChangeProperty(disp, window,
+ XInternAtom(disp, "_NET_WM_NAME", False),
+ XInternAtom(disp, "UTF8_STRING", False),
+ 8, PropModeReplace, (unsigned char *) title,
+ strlen(title));
}
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_openDisplay(JNIEnv *env, jclass clazz) {
Modified: trunk/LWJGL/src/native/linux/opengles/org_lwjgl_opengl_Display.c
===================================================================
--- trunk/LWJGL/src/native/linux/opengles/org_lwjgl_opengl_Display.c 2011-08-18 23:17:17 UTC (rev 3618)
+++ trunk/LWJGL/src/native/linux/opengles/org_lwjgl_opengl_Display.c 2011-08-20 11:56:46 UTC (rev 3619)
@@ -169,6 +169,13 @@
static void setWindowTitle(Display *disp, Window window, const char *title) {
XStoreName(disp, window, title);
+
+ // tell WM to use Unicode
+ XChangeProperty(disp, window,
+ XInternAtom(disp, "_NET_WM_NAME", False),
+ XInternAtom(disp, "UTF8_STRING", False),
+ 8, PropModeReplace, (unsigned char *) title,
+ strlen(title));
}
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_openDisplay(JNIEnv *env, jclass clazz) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2011-08-18 23:17:23
|
Revision: 3618
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3618&view=rev
Author: spasi
Date: 2011-08-18 23:17:17 +0000 (Thu, 18 Aug 2011)
Log Message:
-----------
Added glRotated.
Modified Paths:
--------------
trunk/LWJGL/src/templates/org/lwjgl/opengl/GL11.java
Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/GL11.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/GL11.java 2011-08-18 17:13:05 UTC (rev 3617)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/GL11.java 2011-08-18 23:17:17 UTC (rev 3618)
@@ -1351,6 +1351,9 @@
void glRotatef(float angle, float x, float y, float z);
@DeprecatedGL
+ void glRotated(double angle, double x, double y, double z);
+
+ @DeprecatedGL
int glRenderMode(@GLenum int mode);
@DeprecatedGL
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2011-08-18 17:13:12
|
Revision: 3617
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3617&view=rev
Author: spasi
Date: 2011-08-18 17:13:05 +0000 (Thu, 18 Aug 2011)
Log Message:
-----------
Fixed GLX extension detection.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/util/generator/RegisterStubsGenerator.java
trunk/LWJGL/src/native/linux/opengl/extgl_glx.c
Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/RegisterStubsGenerator.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/RegisterStubsGenerator.java 2011-08-16 22:17:32 UTC (rev 3616)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/RegisterStubsGenerator.java 2011-08-18 17:13:05 UTC (rev 3617)
@@ -41,8 +41,6 @@
* $Id$
*/
-import org.lwjgl.opencl.CLMem;
-
import com.sun.mirror.declaration.*;
import com.sun.mirror.type.*;
Modified: trunk/LWJGL/src/native/linux/opengl/extgl_glx.c
===================================================================
--- trunk/LWJGL/src/native/linux/opengl/extgl_glx.c 2011-08-16 22:17:32 UTC (rev 3616)
+++ trunk/LWJGL/src/native/linux/opengl/extgl_glx.c 2011-08-18 17:13:05 UTC (rev 3617)
@@ -97,9 +97,8 @@
static GLXExtensions symbols_flags;
/** returns true if the extention is available */
-static bool GLXQueryExtension(Display *disp, int screen, const char *name) {
- const GLubyte *exts = (const GLubyte *)lwjgl_glXQueryExtensionsString(disp, screen);
- return extgl_QueryExtension(exts, name);
+static bool GLXQueryExtension(const GLubyte *serverExts, const GLubyte *clientExts, const char *name) {
+ return extgl_QueryExtension(clientExts, name) || extgl_QueryExtension(serverExts, name);
}
static void extgl_InitGLX13() {
@@ -184,17 +183,20 @@
}
static void extgl_InitGLXSupportedExtensions(Display *disp, int screen, GLXExtensions *extension_flags) {
-/* extension_flags.GLX_EXT_visual_info = GLXQueryExtension(disp, screen, "GLX_EXT_visual_info");
- extension_flags.GLX_EXT_visual_rating = GLXQueryExtension(disp, screen, "GLX_EXT_visual_rating");*/
- extension_flags->GLX_SGI_swap_control = symbols_flags.GLX_SGI_swap_control && GLXQueryExtension(disp, screen, "GLX_SGI_swap_control");
- extension_flags->GLX_ARB_multisample = GLXQueryExtension(disp, screen, "GLX_ARB_multisample");
- extension_flags->GLX_ARB_fbconfig_float = GLXQueryExtension(disp, screen, "GLX_ARB_fbconfig_float");
- extension_flags->GLX_EXT_fbconfig_packed_float = GLXQueryExtension(disp, screen, "GLX_EXT_fbconfig_packed_float");
- extension_flags->GLX_ARB_framebuffer_sRGB = GLXQueryExtension(disp, screen, "GLX_ARB_framebuffer_sRGB") || GLXQueryExtension(disp, screen, "GLX_EXT_framebuffer_sRGB");
- extension_flags->GLX_ARB_create_context = GLXQueryExtension(disp, screen, "GLX_ARB_create_context");
- extension_flags->GLX_NV_multisample_coverage = GLXQueryExtension(disp, screen, "GLX_NV_multisample_coverage");
- extension_flags->GLX_NV_present_video = GLXQueryExtension(disp, screen, "GLX_NV_present_video");
- extension_flags->GLX_NV_video_capture = GLXQueryExtension(disp, screen, "GLX_NV_video_capture");
+ const GLubyte *serverExts = (const GLubyte *)lwjgl_glXQueryServerString(disp, screen, GLX_EXTENSIONS);
+ const GLubyte *clientExts = (const GLubyte *)lwjgl_glXGetClientString(disp, GLX_EXTENSIONS);
+
+/* extension_flags.GLX_EXT_visual_info = GLXQueryExtension(serverExts, clientExts, "GLX_EXT_visual_info");
+ extension_flags.GLX_EXT_visual_rating = GLXQueryExtension(serverExts, clientExts, "GLX_EXT_visual_rating");*/
+ extension_flags->GLX_SGI_swap_control = symbols_flags.GLX_SGI_swap_control && GLXQueryExtension(serverExts, clientExts, "GLX_SGI_swap_control");
+ extension_flags->GLX_ARB_multisample = GLXQueryExtension(serverExts, clientExts, "GLX_ARB_multisample");
+ extension_flags->GLX_ARB_fbconfig_float = GLXQueryExtension(serverExts, clientExts, "GLX_ARB_fbconfig_float");
+ extension_flags->GLX_EXT_fbconfig_packed_float = GLXQueryExtension(serverExts, clientExts, "GLX_EXT_fbconfig_packed_float");
+ extension_flags->GLX_ARB_framebuffer_sRGB = GLXQueryExtension(serverExts, clientExts, "GLX_ARB_framebuffer_sRGB") || GLXQueryExtension(serverExts, clientExts, "GLX_EXT_framebuffer_sRGB");
+ extension_flags->GLX_ARB_create_context = GLXQueryExtension(serverExts, clientExts, "GLX_ARB_create_context");
+ extension_flags->GLX_NV_multisample_coverage = GLXQueryExtension(serverExts, clientExts, "GLX_NV_multisample_coverage");
+ extension_flags->GLX_NV_present_video = GLXQueryExtension(serverExts, clientExts, "GLX_NV_present_video");
+ extension_flags->GLX_NV_video_capture = GLXQueryExtension(serverExts, clientExts, "GLX_NV_video_capture");
}
bool extgl_Open(JNIEnv *env) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2011-08-16 22:17:39
|
Revision: 3616
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3616&view=rev
Author: spasi
Date: 2011-08-16 22:17:32 +0000 (Tue, 16 Aug 2011)
Log Message:
-----------
Added unicode support on Windows.
Fixed AL and GLES native stub bindings.
Replaced many GetStringNativeChars usages with a Java implementation.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/MemoryUtil.java
trunk/LWJGL/src/java/org/lwjgl/WindowsSysImplementation.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/opencl/CL.java
trunk/LWJGL/src/java/org/lwjgl/opengl/GLContext.java
trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/SignatureTranslator.java
trunk/LWJGL/src/native/common/opengl/org_lwjgl_opengl_GLContext.c
trunk/LWJGL/src/native/common/org_lwjgl_openal_ALC10.c
trunk/LWJGL/src/native/common/org_lwjgl_openal_ALC11.c
trunk/LWJGL/src/native/common/org_lwjgl_opencl_CL.c
trunk/LWJGL/src/native/windows/Window.h
trunk/LWJGL/src/native/windows/opengl/context.c
trunk/LWJGL/src/native/windows/opengl/context.h
trunk/LWJGL/src/native/windows/opengles/context.c
trunk/LWJGL/src/native/windows/opengles/context.h
trunk/LWJGL/src/native/windows/org_lwjgl_Sys.c
trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Display.c
Modified: trunk/LWJGL/src/java/org/lwjgl/MemoryUtil.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/MemoryUtil.java 2011-08-15 19:24:39 UTC (rev 3615)
+++ trunk/LWJGL/src/java/org/lwjgl/MemoryUtil.java 2011-08-16 22:17:32 UTC (rev 3616)
@@ -33,6 +33,8 @@
import java.lang.reflect.Field;
import java.nio.*;
+import java.nio.charset.Charset;
+import java.nio.charset.CharsetEncoder;
/**
* [INTERNAL USE ONLY]
@@ -43,6 +45,16 @@
*/
public final class MemoryUtil {
+ private static final CharsetEncoder textEncoder;
+
+ static {
+ CharsetEncoder encoder = Charset.defaultCharset().newEncoder();
+ if ( 1.0f < encoder.maxBytesPerChar() )
+ encoder = Charset.forName("ISO-8859-1").newEncoder();
+
+ textEncoder = encoder;
+ }
+
private static final Accessor memUtil;
static {
@@ -92,10 +104,6 @@
private MemoryUtil() {
}
- public static String wrap(final String test) {
- return "MemoryUtil.getAddress(" + test + ")";
- }
-
/**
* Returns the memory address of the specified buffer. [INTERNAL USE ONLY]
*
@@ -179,6 +187,66 @@
public static long getAddressSafe(PointerBuffer buffer, int position) { return buffer == null ? 0L : getAddress(buffer, position); }
+ // --- [ String utilities ] ---
+
+ /**
+ * Returns the specified text as a null-terminated CharBuffer.
+ *
+ * @param text the text to encode
+ *
+ * @return the encoded text
+ */
+ public static CharBuffer encodeUTF16(final CharSequence text) {
+ CharBuffer buffer = BufferUtils.createCharBuffer(text.length() + 1);
+ buffer.append(text).append('\0');
+ buffer.flip();
+ return buffer;
+ }
+
+ /**
+ * Returns the specified text array as a CharBuffer. The CharBuffer is packed
+ * and each text is null-terminated.
+ *
+ * @param text the text array to encode
+ *
+ * @return the encoded text
+ */
+ public static CharBuffer encodeUTF16(final CharSequence... text) {
+ int len = 0;
+ for ( CharSequence cs : text )
+ len += cs.length();
+
+ final CharBuffer buffer = BufferUtils.createCharBuffer(len + text.length);
+ for ( CharSequence cs : text )
+ buffer.append(cs).append('\0');
+
+ buffer.flip();
+ return buffer;
+ }
+
+ /**
+ * Encodes and null-terminated the specified text and returns a ByteBuffer.
+ * If text is null, null is returned.
+ *
+ * @param text the text to encode
+ *
+ * @return the encoded text or null
+ *
+ * @see String#getBytes()
+ */
+ public static ByteBuffer encodeASCII(final CharSequence text) {
+ if ( text == null )
+ return null;
+
+ final ByteBuffer buffer = BufferUtils.createByteBuffer(text.length() + 1);
+
+ textEncoder.encode(CharBuffer.wrap(text), buffer, true);
+ buffer.put((byte)0);
+ buffer.flip();
+
+ return buffer;
+ }
+
interface Accessor {
long getAddress(Buffer buffer);
Modified: trunk/LWJGL/src/java/org/lwjgl/WindowsSysImplementation.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/WindowsSysImplementation.java 2011-08-15 19:24:39 UTC (rev 3615)
+++ trunk/LWJGL/src/java/org/lwjgl/WindowsSysImplementation.java 2011-08-16 22:17:32 UTC (rev 3616)
@@ -31,6 +31,7 @@
*/
package org.lwjgl;
+import java.nio.CharBuffer;
import java.security.PrivilegedExceptionAction;
import java.security.PrivilegedActionException;
import java.security.AccessController;
@@ -95,9 +96,15 @@
if(!Display.isCreated()) {
initCommonControls();
}
- nAlert(getHwnd(), title, message);
+
+ LWJGLUtil.log(String.format("*** Alert *** %s\n%s\n", title, message));
+
+ // Pack both strings in the same buffer
+ final CharBuffer buffer = MemoryUtil.encodeUTF16(title, message);
+ final long address = MemoryUtil.getAddress0(buffer);
+ nAlert(getHwnd(), address, address + (title.length() + 1) * 2);
}
- private static native void nAlert(long parent_hwnd, String title, String message);
+ private static native void nAlert(long parent_hwnd, long title, long message);
private static native void initCommonControls();
public boolean openURL(final String url) {
Modified: trunk/LWJGL/src/java/org/lwjgl/openal/ALC10.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/openal/ALC10.java 2011-08-15 19:24:39 UTC (rev 3615)
+++ trunk/LWJGL/src/java/org/lwjgl/openal/ALC10.java 2011-08-16 22:17:32 UTC (rev 3616)
@@ -31,7 +31,7 @@
*/
package org.lwjgl.openal;
-import java.nio.Buffer;
+import java.nio.ByteBuffer;
import java.nio.IntBuffer;
import java.util.HashMap;
@@ -199,7 +199,8 @@
* @return opened device, or null
*/
public static ALCdevice alcOpenDevice(String devicename) {
- long device_address = nalcOpenDevice(devicename);
+ ByteBuffer buffer = MemoryUtil.encodeASCII(devicename);
+ long device_address = nalcOpenDevice(MemoryUtil.getAddressSafe(buffer));
if(device_address != 0) {
ALCdevice device = new ALCdevice(device_address);
synchronized (ALC10.devices) {
@@ -209,7 +210,7 @@
}
return null;
}
- static native long nalcOpenDevice(String devicename);
+ static native long nalcOpenDevice(long devicename);
/**
* The <code>alcCloseDevice</code> function allows the application (i.e. the client program) to
@@ -395,11 +396,12 @@
* @return true if extension is available, false if not
*/
public static boolean alcIsExtensionPresent(ALCdevice device, String extName) {
- boolean result = nalcIsExtensionPresent(getDevice(device), extName);
+ ByteBuffer buffer = MemoryUtil.encodeASCII(extName);
+ boolean result = nalcIsExtensionPresent(getDevice(device), MemoryUtil.getAddress(buffer));
Util.checkALCError(device);
return result;
}
- static native boolean nalcIsExtensionPresent(long device, String extName);
+ private static native boolean nalcIsExtensionPresent(long device, long extName);
/**
* Enumeration/token values are device independend, but tokens defined for
@@ -412,11 +414,12 @@
* @return value of enumeration
*/
public static int alcGetEnumValue(ALCdevice device, String enumName) {
- int result = nalcGetEnumValue(getDevice(device), enumName);
+ ByteBuffer buffer = MemoryUtil.encodeASCII(enumName);
+ int result = nalcGetEnumValue(getDevice(device), MemoryUtil.getAddress(buffer));
Util.checkALCError(device);
return result;
}
- static native int nalcGetEnumValue(long device, String enumName);
+ private static native int nalcGetEnumValue(long device, long enumName);
static long getDevice(ALCdevice device) {
if(device != null) {
Modified: trunk/LWJGL/src/java/org/lwjgl/openal/ALC11.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/openal/ALC11.java 2011-08-15 19:24:39 UTC (rev 3615)
+++ trunk/LWJGL/src/java/org/lwjgl/openal/ALC11.java 2011-08-16 22:17:32 UTC (rev 3616)
@@ -92,7 +92,8 @@
* @return ALCdevice if it was possible to open a device
*/
public static ALCdevice alcCaptureOpenDevice(String devicename, int frequency, int format, int buffersize) {
- long device_address = nalcCaptureOpenDevice(devicename, frequency, format, buffersize);
+ ByteBuffer buffer = MemoryUtil.encodeASCII(devicename);
+ long device_address = nalcCaptureOpenDevice(MemoryUtil.getAddress(buffer), frequency, format, buffersize);
if(device_address != 0) {
ALCdevice device = new ALCdevice(device_address);
synchronized (ALC10.devices) {
@@ -102,7 +103,7 @@
}
return null;
}
- static native long nalcCaptureOpenDevice( String devicename, int frequency, int format, int buffersize);
+ private static native long nalcCaptureOpenDevice(long devicename, int frequency, int format, int buffersize);
/**
* The alcCaptureCloseDevice function allows the application to disconnect from a capture
Modified: trunk/LWJGL/src/java/org/lwjgl/opencl/CL.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opencl/CL.java 2011-08-15 19:24:39 UTC (rev 3615)
+++ trunk/LWJGL/src/java/org/lwjgl/opencl/CL.java 2011-08-16 22:17:32 UTC (rev 3616)
@@ -33,6 +33,7 @@
import org.lwjgl.LWJGLException;
import org.lwjgl.LWJGLUtil;
+import org.lwjgl.MemoryUtil;
import org.lwjgl.Sys;
import java.nio.ByteBuffer;
@@ -143,7 +144,12 @@
return 0;
}
- static native long getFunctionAddress(String name);
+ /** Helper method to get a pointer to a named function in the OpenCL library. */
+ static long getFunctionAddress(String name) {
+ ByteBuffer buffer = MemoryUtil.encodeASCII(name);
+ return ngetFunctionAddress(MemoryUtil.getAddress(buffer));
+ }
+ private static native long ngetFunctionAddress(long name);
static native ByteBuffer getHostBuffer(final long address, final int size);
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/GLContext.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/GLContext.java 2011-08-15 19:24:39 UTC (rev 3615)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/GLContext.java 2011-08-16 22:17:32 UTC (rev 3616)
@@ -33,9 +33,11 @@
import org.lwjgl.LWJGLException;
import org.lwjgl.LWJGLUtil;
+import org.lwjgl.MemoryUtil;
import org.lwjgl.Sys;
import java.lang.reflect.Method;
+import java.nio.ByteBuffer;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.security.PrivilegedExceptionAction;
@@ -187,8 +189,12 @@
return 0;
}
- /** Helper method to get a pointer to a named function in the OpenGL library */
- static native long getFunctionAddress(String name);
+ /** Helper method to get a pointer to a named function in the OpenGL library. */
+ static long getFunctionAddress(String name) {
+ ByteBuffer buffer = MemoryUtil.encodeASCII(name);
+ return ngetFunctionAddress(MemoryUtil.getAddress(buffer));
+ }
+ private static native long ngetFunctionAddress(long name);
/**
* Determine which extensions are available and returns the context profile mask. Helper method to ContextCapabilities.
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java 2011-08-15 19:24:39 UTC (rev 3615)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java 2011-08-16 22:17:32 UTC (rev 3616)
@@ -38,15 +38,13 @@
* @author elias_naur
*/
-import java.nio.ByteBuffer;
-import java.nio.FloatBuffer;
-import java.nio.IntBuffer;
-import java.nio.LongBuffer;
+import java.nio.*;
import java.awt.Canvas;
import org.lwjgl.LWJGLException;
import org.lwjgl.LWJGLUtil;
import org.lwjgl.BufferUtils;
+import org.lwjgl.MemoryUtil;
import org.lwjgl.input.Cursor;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengles.EGL;
@@ -141,11 +139,11 @@
private static final int SWP_FRAMECHANGED = 0x0020;
private static final int GWL_STYLE = -16;
- private static final int GWL_EXSTYLE = -20;
-
+ private static final int GWL_EXSTYLE = -20;
+
private static final int WS_THICKFRAME = 0x00040000;
-
+
private static WindowsDisplay current_display;
private static boolean cursor_clipped;
@@ -217,9 +215,9 @@
}
peer_info.initDC(getHwnd(), getHdc());
showWindow(getHwnd(), SW_SHOWDEFAULT);
-
+
updateWidthAndHeight();
-
+
if ( parent == null ) {
if(Display.isResizable()) {
setResizable(true);
@@ -233,7 +231,7 @@
throw e;
}
}
-
+
private void updateWidthAndHeight() {
getClientRect(hwnd, rect_buffer);
rect.copyFromBuffer(rect_buffer);
@@ -440,9 +438,10 @@
private static native DisplayMode getCurrentDisplayMode() throws LWJGLException;
public void setTitle(String title) {
- nSetTitle(hwnd, title);
+ CharBuffer buffer = MemoryUtil.encodeUTF16(title);
+ nSetTitle(hwnd, MemoryUtil.getAddress0(buffer));
}
- private static native void nSetTitle(long hwnd, String title);
+ private static native void nSetTitle(long hwnd, long title);
public boolean isCloseRequested() {
boolean saved = close_requested;
@@ -786,7 +785,7 @@
byte state = (byte)(1 - ((lParam >>> 31) & 0x1));
boolean repeat = state == previous_state;
if (keyboard != null)
- keyboard.handleChar((int)(wParam & 0xFF), millis, repeat);
+ keyboard.handleChar((int)(wParam & 0xFFFF), millis, repeat);
}
private void handleKeyButton(long wParam, long lParam, long millis) {
@@ -991,12 +990,12 @@
public boolean isInsideWindow() {
return mouseInside;
}
-
+
public void setResizable(boolean resizable) {
if(this.resizable != resizable) {
long style = getWindowLongPtr(hwnd, GWL_STYLE);
long styleex = getWindowLongPtr(hwnd, GWL_EXSTYLE);
-
+
// update frame style
if(resizable) {
setWindowLongPtr(hwnd, GWL_STYLE, style |= WS_THICKFRAME);
@@ -1010,16 +1009,16 @@
rect.copyFromBuffer(rect_buffer);
adjustWindowRectEx(rect_buffer, style, false, styleex);
rect.copyFromBuffer(rect_buffer);
-
+
// force a frame update and resize accordingly
setWindowPos(hwnd, HWND_TOP, 0, 0, rect.right - rect.left, rect.bottom - rect.top, SWP_NOMOVE | SWP_NOZORDER | SWP_FRAMECHANGED);
-
+
updateWidthAndHeight();
resized = false;
}
- this.resizable = resizable;
+ this.resizable = resizable;
}
-
+
private native boolean adjustWindowRectEx(IntBuffer rectBuffer, long style, boolean menu, long styleex);
public boolean wasResized() {
Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/SignatureTranslator.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/SignatureTranslator.java 2011-08-15 19:24:39 UTC (rev 3615)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/SignatureTranslator.java 2011-08-16 22:17:32 UTC (rev 3616)
@@ -91,11 +91,13 @@
} else
type_name = t.getDeclaration().getQualifiedName();
- signature.append("L");
- signature.append(getNativeNameFromClassName(type_name));
- signature.append(";");
- if ( add_position_signature && Utils.isAddressableType(type) && !String.class.equals(type) )
- signature.append("I");
+ if ( Utils.isAddressableType(type) && !String.class.equals(type) )
+ signature.append("J");
+ else {
+ signature.append("L");
+ signature.append(getNativeNameFromClassName(type_name));
+ signature.append(";");
+ }
}
public void visitDeclaredType(DeclaredType t) {
Modified: trunk/LWJGL/src/native/common/opengl/org_lwjgl_opengl_GLContext.c
===================================================================
--- trunk/LWJGL/src/native/common/opengl/org_lwjgl_opengl_GLContext.c 2011-08-15 19:24:39 UTC (rev 3615)
+++ trunk/LWJGL/src/native/common/opengl/org_lwjgl_opengl_GLContext.c 2011-08-16 22:17:32 UTC (rev 3616)
@@ -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,13 +35,8 @@
#include "org_lwjgl_opengl_GLContext.h"
#include "extgl.h"
-JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_GLContext_getFunctionAddress(JNIEnv *env, jclass clazz, jstring function_name) {
- jlong address_jlong;
- char *function_name_pointer = GetStringNativeChars(env, function_name);
- void *address = extgl_GetProcAddress(function_name_pointer);
- free(function_name_pointer);
- address_jlong = (jlong)(intptr_t)address;
- return address_jlong;
+JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_GLContext_ngetFunctionAddress(JNIEnv *env, jclass clazz, jlong function_name) {
+ return (jlong)(intptr_t)extgl_GetProcAddress((char *)(intptr_t)function_name);
}
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GLContext_nLoadOpenGLLibrary(JNIEnv * env, jclass clazz) {
Modified: trunk/LWJGL/src/native/common/org_lwjgl_openal_ALC10.c
===================================================================
--- trunk/LWJGL/src/native/common/org_lwjgl_openal_ALC10.c 2011-08-15 19:24:39 UTC (rev 3615)
+++ trunk/LWJGL/src/native/common/org_lwjgl_openal_ALC10.c 2011-08-16 22:17:32 UTC (rev 3616)
@@ -131,24 +131,8 @@
* C Specification:
* ALCdevice *alcOpenDevice( const ALubyte *tokstr );
*/
-static jlong JNICALL Java_org_lwjgl_openal_ALC10_nalcOpenDevice (JNIEnv *env, jclass clazz, jstring tokstr) {
- char * tokenstring;
- ALCdevice* device;
-
- if(tokstr != NULL) {
- tokenstring = GetStringNativeChars(env, tokstr);
- } else {
- tokenstring = NULL;
- }
-
- /* get device */
- device = alcOpenDevice((ALubyte *) tokenstring);
-
- if(tokenstring != NULL) {
- free(tokenstring);
- }
-
- return (jlong)((intptr_t)device);
+static jlong JNICALL Java_org_lwjgl_openal_ALC10_nalcOpenDevice (JNIEnv *env, jclass clazz, jlong tokstr) {
+ return (jlong)(intptr_t)alcOpenDevice((ALubyte *)(intptr_t)tokstr);
}
/**
@@ -255,15 +239,8 @@
* C Specification:
* ALboolean alcIsExtensionPresent(ALCdevice *device, ALubyte *extName);
*/
-static jboolean JNICALL Java_org_lwjgl_openal_ALC10_nalcIsExtensionPresent (JNIEnv *env, jclass clazz, jlong deviceaddress, jstring extName) {
- /* get extension */
- ALubyte* functionname = (ALubyte*) GetStringNativeChars(env, extName);
-
- jboolean result = (jboolean) alcIsExtensionPresent((ALCdevice*)((intptr_t)deviceaddress), functionname);
-
- free(functionname);
-
- return result;
+static jboolean JNICALL Java_org_lwjgl_openal_ALC10_nalcIsExtensionPresent (JNIEnv *env, jclass clazz, jlong deviceaddress, jlong extName) {
+ return (jboolean) alcIsExtensionPresent((ALCdevice*)((intptr_t)deviceaddress), (ALubyte*)(intptr_t)extName);
}
/**
@@ -272,15 +249,8 @@
* C Specification:
* ALenum alcGetEnumValue(ALCdevice *device, ALubyte *enumName);
*/
-static jint JNICALL Java_org_lwjgl_openal_ALC10_nalcGetEnumValue (JNIEnv *env, jclass clazz, jlong deviceaddress, jstring enumName) {
- /* get extension */
- ALubyte* enumerationname = (ALubyte*) GetStringNativeChars(env, enumName);
-
- jint result = (jint) alcGetEnumValue((ALCdevice*)((intptr_t)deviceaddress), enumerationname);
-
- free(enumerationname);
-
- return result;
+static jint JNICALL Java_org_lwjgl_openal_ALC10_nalcGetEnumValue (JNIEnv *env, jclass clazz, jlong deviceaddress, jlong enumName) {
+ return (jint) alcGetEnumValue((ALCdevice*)((intptr_t)deviceaddress), (ALubyte*)(intptr_t)enumName);
}
/**
@@ -294,10 +264,10 @@
JNIEXPORT void JNICALL Java_org_lwjgl_openal_ALC10_initNativeStubs(JNIEnv *env, jclass clazz) {
JavaMethodAndExtFunction functions[] = {
{"nalcGetString", "(JI)Ljava/lang/String;", (void*)&Java_org_lwjgl_openal_ALC10_nalcGetString, "alcGetString", (void*)&alcGetString},
- {"nalcGetIntegerv", "(JIILjava/nio/Buffer;I)V", (void*)&Java_org_lwjgl_openal_ALC10_nalcGetIntegerv, "alcGetIntegerv", (void*)&alcGetIntegerv},
- {"nalcOpenDevice", "(Ljava/lang/String;)J", (void*)&Java_org_lwjgl_openal_ALC10_nalcOpenDevice, "alcOpenDevice", (void*)&alcOpenDevice},
+ {"nalcGetIntegerv", "(JIIJ)V", (void*)&Java_org_lwjgl_openal_ALC10_nalcGetIntegerv, "alcGetIntegerv", (void*)&alcGetIntegerv},
+ {"nalcOpenDevice", "(J)J", (void*)&Java_org_lwjgl_openal_ALC10_nalcOpenDevice, "alcOpenDevice", (void*)&alcOpenDevice},
{"nalcCloseDevice", "(J)Z", (void*)&Java_org_lwjgl_openal_ALC10_nalcCloseDevice, "alcCloseDevice", (void*)&alcCloseDevice},
- {"nalcCreateContext", "(JLjava/nio/IntBuffer;)J", (void*)&Java_org_lwjgl_openal_ALC10_nalcCreateContext, "alcCreateContext", (void*)&alcCreateContext},
+ {"nalcCreateContext", "(JJ)J", (void*)&Java_org_lwjgl_openal_ALC10_nalcCreateContext, "alcCreateContext", (void*)&alcCreateContext},
{"nalcMakeContextCurrent", "(J)I", (void*)&Java_org_lwjgl_openal_ALC10_nalcMakeContextCurrent, "alcMakeContextCurrent", (void*)&alcMakeContextCurrent},
{"nalcProcessContext", "(J)V", (void*)&Java_org_lwjgl_openal_ALC10_nalcProcessContext, "alcProcessContext", (void*)&alcProcessContext},
{"nalcGetCurrentContext", "()J", (void*)&Java_org_lwjgl_openal_ALC10_nalcGetCurrentContext, "alcGetCurrentContext", (void*)&alcGetCurrentContext},
@@ -305,8 +275,8 @@
{"nalcSuspendContext", "(J)V", (void*)&Java_org_lwjgl_openal_ALC10_nalcSuspendContext, "alcSuspendContext", (void*)&alcSuspendContext},
{"nalcDestroyContext", "(J)V", (void*)&Java_org_lwjgl_openal_ALC10_nalcDestroyContext, "alcDestroyContext", (void*)&alcDestroyContext},
{"nalcGetError", "(J)I", (void*)&Java_org_lwjgl_openal_ALC10_nalcGetError, "alcGetError", (void*)&alcGetError},
- {"nalcIsExtensionPresent", "(JLjava/lang/String;)Z", (void*)&Java_org_lwjgl_openal_ALC10_nalcIsExtensionPresent, "alcIsExtensionPresent", (void*)&alcIsExtensionPresent},
- {"nalcGetEnumValue", "(JLjava/lang/String;)I", (void*)&Java_org_lwjgl_openal_ALC10_nalcGetEnumValue, "alcGetEnumValue", (void*)&alcGetEnumValue}
+ {"nalcIsExtensionPresent", "(JJ)Z", (void*)&Java_org_lwjgl_openal_ALC10_nalcIsExtensionPresent, "alcIsExtensionPresent", (void*)&alcIsExtensionPresent},
+ {"nalcGetEnumValue", "(JJ)I", (void*)&Java_org_lwjgl_openal_ALC10_nalcGetEnumValue, "alcGetEnumValue", (void*)&alcGetEnumValue}
};
int num_functions = NUMFUNCTIONS(functions);
extal_InitializeClass(env, clazz, num_functions, functions);
Modified: trunk/LWJGL/src/native/common/org_lwjgl_openal_ALC11.c
===================================================================
--- trunk/LWJGL/src/native/common/org_lwjgl_openal_ALC11.c 2011-08-15 19:24:39 UTC (rev 3615)
+++ trunk/LWJGL/src/native/common/org_lwjgl_openal_ALC11.c 2011-08-16 22:17:32 UTC (rev 3616)
@@ -60,18 +60,8 @@
* Method: nalcCaptureOpenDevice
* Signature: (Ljava/lang/String;III)J
*/
-static jlong JNICALL Java_org_lwjgl_openal_ALC11_nalcCaptureOpenDevice(JNIEnv *env, jclass clazz, jstring devicename, jint frequency, jint format, jint buffersize) {
- ALubyte* dev_name = NULL;
- ALCdevice* device = NULL;
-
- if(devicename != NULL) {
- dev_name = (ALubyte*) GetStringNativeChars(env, devicename);
- }
-
- device = alcCaptureOpenDevice((const char *)dev_name, (unsigned int) frequency, format, buffersize);
-
- free(dev_name);
- return (jlong) ((intptr_t)device);
+static jlong JNICALL Java_org_lwjgl_openal_ALC11_nalcCaptureOpenDevice(JNIEnv *env, jclass clazz, jlong devicename, jint frequency, jint format, jint buffersize) {
+ return (jlong)(intptr_t)alcCaptureOpenDevice((const char *)(intptr_t)devicename, (unsigned int) frequency, format, buffersize);
}
/*
@@ -121,11 +111,11 @@
#endif
JNIEXPORT void JNICALL Java_org_lwjgl_openal_ALC11_initNativeStubs(JNIEnv *env, jclass clazz) {
JavaMethodAndExtFunction functions[] = {
- {"nalcCaptureOpenDevice", "(Ljava/lang/String;III)J", (void*)&Java_org_lwjgl_openal_ALC11_nalcCaptureOpenDevice, "alcCaptureOpenDevice", (void*)&alcCaptureOpenDevice},
+ {"nalcCaptureOpenDevice", "(JIII)J", (void*)&Java_org_lwjgl_openal_ALC11_nalcCaptureOpenDevice, "alcCaptureOpenDevice", (void*)&alcCaptureOpenDevice},
{"nalcCaptureCloseDevice", "(J)Z", (void*)&Java_org_lwjgl_openal_ALC11_nalcCaptureCloseDevice, "alcCaptureCloseDevice", (void*)&alcCaptureCloseDevice},
{"nalcCaptureStart", "(J)V", (void*)&Java_org_lwjgl_openal_ALC11_nalcCaptureStart, "alcCaptureStart", (void*)&alcCaptureStart},
{"nalcCaptureStop", "(J)V", (void*)&Java_org_lwjgl_openal_ALC11_nalcCaptureStop, "alcCaptureStop", (void*)&alcCaptureStop},
- {"nalcCaptureSamples", "(JLjava/nio/ByteBuffer;II)V", (void*)&Java_org_lwjgl_openal_ALC11_nalcCaptureSamples, "alcCaptureSamples", (void*)&alcCaptureSamples}
+ {"nalcCaptureSamples", "(JJI)V", (void*)&Java_org_lwjgl_openal_ALC11_nalcCaptureSamples, "alcCaptureSamples", (void*)&alcCaptureSamples}
};
int num_functions = NUMFUNCTIONS(functions);
extal_InitializeClass(env, clazz, num_functions, functions);
Modified: trunk/LWJGL/src/native/common/org_lwjgl_opencl_CL.c
===================================================================
--- trunk/LWJGL/src/native/common/org_lwjgl_opencl_CL.c 2011-08-15 19:24:39 UTC (rev 3615)
+++ trunk/LWJGL/src/native/common/org_lwjgl_opencl_CL.c 2011-08-16 22:17:32 UTC (rev 3616)
@@ -42,13 +42,8 @@
extcl_UnloadLibrary();
}
-JNIEXPORT jlong JNICALL Java_org_lwjgl_opencl_CL_getFunctionAddress(JNIEnv *env, jclass clazz, jstring function_name) {
- jlong address_jlong;
- char *function_name_pointer = GetStringNativeChars(env, function_name);
- void *address = extcl_GetProcAddress(function_name_pointer);
- free(function_name_pointer);
- address_jlong = (jlong)(intptr_t)address;
- return address_jlong;
+JNIEXPORT jlong JNICALL Java_org_lwjgl_opencl_CL_ngetFunctionAddress(JNIEnv *env, jclass clazz, jlong function_name) {
+ return (jlong)(intptr_t)extcl_GetProcAddress((char *)(intptr_t)function_name);
}
JNIEXPORT jobject JNICALL Java_org_lwjgl_opencl_CL_getHostBuffer(JNIEnv *env, jclass clazz, jlong address, jint size) {
Modified: trunk/LWJGL/src/native/windows/Window.h
===================================================================
--- trunk/LWJGL/src/native/windows/Window.h 2011-08-15 19:24:39 UTC (rev 3615)
+++ trunk/LWJGL/src/native/windows/Window.h 2011-08-16 22:17:32 UTC (rev 3616)
@@ -1,35 +1,35 @@
-/*
+/*
* 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.
*/
-
+
/**
* $Id$
*
@@ -52,6 +52,10 @@
#define _WIN32_WINNT 0x0400
#endif
+ #define _UNICODE
+ #include <tchar.h>
+
+ #define UNICODE
#include <windows.h>
#include <jni.h>
#include "common_tools.h"
Modified: trunk/LWJGL/src/native/windows/opengl/context.c
===================================================================
--- trunk/LWJGL/src/native/windows/opengl/context.c 2011-08-15 19:24:39 UTC (rev 3615)
+++ trunk/LWJGL/src/native/windows/opengl/context.c 2011-08-16 22:17:32 UTC (rev 3616)
@@ -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.
*/
@@ -38,15 +38,14 @@
*/
#include <malloc.h>
-#include <jni.h>
-#include "common_tools.h"
+#include "Window.h"
#include "extgl.h"
#include "extgl_wgl.h"
#include "context.h"
extern HINSTANCE dll_handle; // Handle to the LWJGL dll
-#define _CONTEXT_PRIVATE_CLASS_NAME "__lwjgl_context_class_name"
+#define _CONTEXT_PRIVATE_CLASS_NAME _T("__lwjgl_context_class_name")
/*
* Register the LWJGL window class.
@@ -85,7 +84,7 @@
return false;
}
- // make that the pixel format of the device context
+ // make that the pixel format of the device context
if (SetPixelFormat(hdc, iPixelFormat, &desc) == FALSE) {
throwFormattedException(env, "SetPixelFormat failed (%d)", GetLastError());
return false;
@@ -134,14 +133,14 @@
RECT clientSize;
DWORD exstyle, windowflags;
HWND new_hwnd;
-
+
getWindowFlags(&windowflags, &exstyle, undecorated, child_window);
clientSize.bottom = height;
clientSize.left = 0;
clientSize.right = width;
clientSize.top = 0;
-
+
AdjustWindowRectEx(
&clientSize, // client-rectangle structure
windowflags, // window styles
@@ -150,9 +149,9 @@
);
// Create the window now, using that class:
new_hwnd = CreateWindowEx (
- exstyle,
+ exstyle,
window_class_name,
- "",
+ _T(""),
windowflags,
x, y, clientSize.right - clientSize.left, clientSize.bottom - clientSize.top,
parent,
@@ -191,12 +190,12 @@
int num_aux_buffers = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "num_aux_buffers", "I"));
int accum_bpp = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "accum_bpp", "I"));
int accum_alpha = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "accum_alpha", "I"));
-
+
jboolean stereo = (*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "stereo", "Z"));
jboolean floating_point = (*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "floating_point", "Z"));
jboolean floating_point_packed = (*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "floating_point_packed", "Z"));
jboolean sRGB = (*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "sRGB", "Z"));
-
+
int pixel_type;
int iPixelFormat;
unsigned int num_formats_returned;
@@ -206,18 +205,18 @@
BOOL result;
jlong i;
int bpe = convertToBPE(bpp);
-
+
if ( floating_point )
pixel_type = WGL_TYPE_RGBA_FLOAT_ARB;
else if ( floating_point_packed )
pixel_type = WGL_TYPE_RGBA_UNSIGNED_FLOAT_EXT;
else
pixel_type = WGL_TYPE_RGBA_ARB;
-
+
initAttribList(&attrib_list);
if (window) {
putAttrib(&attrib_list, WGL_DRAW_TO_WINDOW_ARB); putAttrib(&attrib_list, TRUE);
- }
+ }
if (pbuffer) {
putAttrib(&attrib_list, WGL_DRAW_TO_PBUFFER_ARB); putAttrib(&attrib_list, TRUE);
}
@@ -299,31 +298,31 @@
int accum_bpp = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "accum_bpp", "I"));
int accum_alpha = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "accum_alpha", "I"));
jboolean stereo = (*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "stereo", "Z"));
- unsigned int flags = PFD_DRAW_TO_WINDOW | // support window
+ unsigned int flags = PFD_DRAW_TO_WINDOW | // support window
PFD_SUPPORT_OPENGL |
(double_buffer ? PFD_DOUBLEBUFFER : 0) |
(stereo ? PFD_STEREO : 0);
PIXELFORMATDESCRIPTOR desc;
int iPixelFormat;
- PIXELFORMATDESCRIPTOR pfd = {
- sizeof(PIXELFORMATDESCRIPTOR), // size of this pfd
- 1, // version number
- flags, // RGBA type
+ PIXELFORMATDESCRIPTOR pfd = {
+ sizeof(PIXELFORMATDESCRIPTOR), // size of this pfd
+ 1, // version number
+ flags, // RGBA type
PFD_TYPE_RGBA,
- (BYTE)bpp,
- 0, 0, 0, 0, 0, 0, // color bits ignored
- (BYTE)alpha,
- 0, // shift bit ignored
- accum_bpp + accum_alpha, // no accumulation buffer
- 0, 0, 0, 0, // accum bits ignored
- (BYTE)depth,
- (BYTE)stencil,
- num_aux_buffers,
+ (BYTE)bpp,
+ 0, 0, 0, 0, 0, 0, // color bits ignored
+ (BYTE)alpha,
+ 0, // shift bit ignored
+ accum_bpp + accum_alpha, // no accumulation buffer
+ 0, 0, 0, 0, // accum bits ignored
+ (BYTE)depth,
+ (BYTE)stencil,
+ num_aux_buffers,
PFD_MAIN_PLANE, // main layer
- 0, // reserved
+ 0, // reserved
0, 0, 0 // layer masks ignored
};
- // get the best available match of pixel format for the device context
+ // get the best available match of pixel format for the device context
iPixelFormat = ChoosePixelFormat(hdc, &pfd);
if (iPixelFormat == 0) {
throwException(env, "Failed to choose pixel format");
@@ -442,14 +441,14 @@
HDC dummy_hdc;
int pixel_format_id;
jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format);
-
+
int samples = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "samples", "I"));
int colorSamples = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "colorSamples", "I"));
bool floating_point = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "floating_point", "Z"));
bool floating_point_packed = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "floating_point_packed", "Z"));
bool sRGB = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "sRGB", "Z"));
bool use_arb_selection = samples > 0 || floating_point || floating_point_packed || sRGB || pbuffer || pixelFormatCaps != NULL;
-
+
pixel_format_id = findPixelFormatDefault(env, hdc, pixel_format, use_hdc_bpp, double_buffer);
if (!(*env)->ExceptionOccurred(env) && use_arb_selection) {
dummy_hwnd = createDummyWindow(origin_x, origin_y);
Modified: trunk/LWJGL/src/native/windows/opengl/context.h
===================================================================
--- trunk/LWJGL/src/native/windows/opengl/context.h 2011-08-15 19:24:39 UTC (rev 3615)
+++ trunk/LWJGL/src/native/windows/opengl/context.h 2011-08-16 22:17:32 UTC (rev 3616)
@@ -40,9 +40,7 @@
#ifndef __LWJGL_CONTEXT_H
#define __LWJGL_CONTEXT_H
-#include <windows.h>
-#include <jni.h>
-#include "common_tools.h"
+#include "Window.h"
#include "extgl.h"
#include "extgl_wgl.h"
Modified: trunk/LWJGL/src/native/windows/opengles/context.c
===================================================================
--- trunk/LWJGL/src/native/windows/opengles/context.c 2011-08-15 19:24:39 UTC (rev 3615)
+++ trunk/LWJGL/src/native/windows/opengles/context.c 2011-08-16 22:17:32 UTC (rev 3616)
@@ -38,15 +38,14 @@
*/
#include <malloc.h>
-#include <jni.h>
-#include "common_tools.h"
+#include "Window.h"
#include "extgl.h"
/*#include "extgl_wgl.h"*/
#include "context.h"
extern HINSTANCE dll_handle; // Handle to the LWJGL dll
-#define _CONTEXT_PRIVATE_CLASS_NAME "__lwjgl_context_class_name"
+#define _CONTEXT_PRIVATE_CLASS_NAME _T("__lwjgl_context_class_name")
/*
* Register the LWJGL window class.
@@ -154,7 +153,7 @@
new_hwnd = CreateWindowEx (
exstyle,
window_class_name,
- "",
+ _T(""),
windowflags,
x, y, clientSize.right - clientSize.left, clientSize.bottom - clientSize.top,
parent,
Modified: trunk/LWJGL/src/native/windows/opengles/context.h
===================================================================
--- trunk/LWJGL/src/native/windows/opengles/context.h 2011-08-15 19:24:39 UTC (rev 3615)
+++ trunk/LWJGL/src/native/windows/opengles/context.h 2011-08-16 22:17:32 UTC (rev 3616)
@@ -40,9 +40,7 @@
#ifndef __LWJGL_CONTEXT_H
#define __LWJGL_CONTEXT_H
-#include <windows.h>
-#include <jni.h>
-#include "common_tools.h"
+#include "Window.h"
#include "extgl.h"
typedef struct {
Modified: trunk/LWJGL/src/native/windows/org_lwjgl_Sys.c
===================================================================
--- trunk/LWJGL/src/native/windows/org_lwjgl_Sys.c 2011-08-15 19:24:39 UTC (rev 3615)
+++ trunk/LWJGL/src/native/windows/org_lwjgl_Sys.c 2011-08-16 22:17:32 UTC (rev 3616)
@@ -1,35 +1,35 @@
-/*
+/*
* 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.
*/
-
+
/**
* $Id$
*
@@ -56,16 +56,9 @@
return time;
}
-JNIEXPORT void JNICALL Java_org_lwjgl_WindowsSysImplementation_nAlert(JNIEnv * env, jclass unused, jlong hwnd_ptr, jstring title, jstring message) {
+JNIEXPORT void JNICALL Java_org_lwjgl_WindowsSysImplementation_nAlert(JNIEnv * env, jclass unused, jlong hwnd_ptr, jlong title, jlong message) {
HWND hwnd = (HWND)(INT_PTR)hwnd_ptr;
- char * eMessageText = GetStringNativeChars(env, message);
- char * cTitleBarText = GetStringNativeChars(env, title);
- MessageBox(hwnd, eMessageText, cTitleBarText, MB_OK | MB_TOPMOST);
-
- printfDebugJava(env, "*** Alert ***%s\n%s\n", cTitleBarText, eMessageText);
-
- free(eMessageText);
- free(cTitleBarText);
+ MessageBox(hwnd, (LPCTSTR)(intptr_t)message, (LPCTSTR)(intptr_t)title, MB_OK | MB_TOPMOST);
}
JNIEXPORT void JNICALL Java_org_lwjgl_WindowsSysImplementation_initCommonControls(JNIEnv * env, jclass unused) {
Modified: trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Display.c
===================================================================
--- trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Display.c 2011-08-15 19:24:39 UTC (rev 3615)
+++ trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Display.c 2011-08-16 22:17:32 UTC (rev 3616)
@@ -40,9 +40,9 @@
*/
#define _PRIVATE_WINDOW_H_
-#include <windowsx.h>
#include <malloc.h>
#include "Window.h"
+#include <windowsx.h>
/*#include "extgl_wgl.h"*/
#include "common_tools.h"
#include "display.h"
@@ -51,7 +51,7 @@
#include "context.h"
#include <commctrl.h>
-#define WINDOWCLASSNAME "LWJGL"
+#define WINDOWCLASSNAME _T("LWJGL")
/*
* WindowProc for the GL window.
@@ -134,11 +134,9 @@
}
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nSetTitle
- (JNIEnv * env, jclass unused, jlong hwnd_ptr, jstring title_obj) {
+ (JNIEnv * env, jclass unused, jlong hwnd_ptr, jlong title) {
HWND hwnd = (HWND)(INT_PTR)hwnd_ptr;
- char * title = GetStringNativeChars(env, title_obj);
- SetWindowText(hwnd, title);
- free(title);
+ SetWindowText(hwnd, (LPCTSTR)(intptr_t)title);
}
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nUpdate(JNIEnv * env, jclass class) {
@@ -429,22 +427,19 @@
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsDisplay_setWindowLongPtr
(JNIEnv *env, jclass clazz, jlong hwnd_ptr, jint nindex, jlong longPtr) {
-
HWND hwnd = (HWND)(INT_PTR)hwnd_ptr;
return SetWindowLongPtr(hwnd, nindex, (LONG_PTR) longPtr);
}
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsDisplay_getWindowLongPtr
(JNIEnv *env, jclass clazz, jlong hwnd_ptr, jint nindex) {
-
HWND hwnd = (HWND)(INT_PTR)hwnd_ptr;
jlong result = GetWindowLongPtr(hwnd, nindex);
return result;
}
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_WindowsDisplay_setWindowPos
- (JNIEnv *env, jclass clazz, jlong hwnd_ptr, jlong hwnd_after_ptr, jint x, jint y, jint width, jint height, jlong uflags) {
-
+ (JNIEnv *env, jclass clazz, jlong hwnd_ptr, jlong hwnd_after_ptr, jint x, jint y, jint width, jint height, jlong uflags) {
jboolean result;
HWND hwnd = (HWND)(INT_PTR)hwnd_ptr;
HWND hwnd_after = (HWND)(INT_PTR)hwnd_after_ptr;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2011-08-15 19:24:45
|
Revision: 3615
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3615&view=rev
Author: matzon
Date: 2011-08-15 19:24:39 +0000 (Mon, 15 Aug 2011)
Log Message:
-----------
Updating version to 2.8.0, still some stuff to do tho
Modified Paths:
--------------
trunk/LWJGL/platform_build/build-definitions.xml
trunk/LWJGL/src/java/org/lwjgl/Sys.java
Modified: trunk/LWJGL/platform_build/build-definitions.xml
===================================================================
--- trunk/LWJGL/platform_build/build-definitions.xml 2011-08-14 17:07:23 UTC (rev 3614)
+++ trunk/LWJGL/platform_build/build-definitions.xml 2011-08-15 19:24:39 UTC (rev 3615)
@@ -12,7 +12,7 @@
<property name="lwjgl.docs" location="doc" />
<property name="lwjgl.temp" location="temp" />
<property name="lwjgl.res" location="res" />
- <property name="lwjgl.version" value="2.7.1" />
+ <property name="lwjgl.version" value="2.8.0" />
<property name="lwjgl.web" location="www" />
<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"/>
Modified: trunk/LWJGL/src/java/org/lwjgl/Sys.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/Sys.java 2011-08-14 17:07:23 UTC (rev 3614)
+++ trunk/LWJGL/src/java/org/lwjgl/Sys.java 2011-08-15 19:24:39 UTC (rev 3615)
@@ -54,7 +54,7 @@
private static final String JNI_LIBRARY_NAME = "lwjgl";
/** Current version of library */
- private static final String VERSION = "2.7.1";
+ private static final String VERSION = "2.8.0";
private static final String POSTFIX64BIT = "64";
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2011-08-14 17:07:29
|
Revision: 3614
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3614&view=rev
Author: kappa1
Date: 2011-08-14 17:07:23 +0000 (Sun, 14 Aug 2011)
Log Message:
-----------
AppletLoader: al_version tag now uses a case insensitive String (instead of float), much nicer for specifying application versions (e.g. "10.3.3.1 Beta"), still backwards compatible too :)
Modified Paths:
--------------
trunk/LWJGL/applet/advance/appletloader.html
trunk/LWJGL/applet/basic/basicapplet.html
trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java
Modified: trunk/LWJGL/applet/advance/appletloader.html
===================================================================
--- trunk/LWJGL/applet/advance/appletloader.html 2011-08-14 10:46:00 UTC (rev 3613)
+++ trunk/LWJGL/applet/advance/appletloader.html 2011-08-14 17:07:23 UTC (rev 3614)
@@ -32,12 +32,12 @@
<!-- Tags under here are optional -->
- <!-- Version of Applet, important otherwise applet won't be cached, version change will update applet, must be int or float -->
- <!-- <param name="al_version" value="0.1"> -->
-
<!-- whether to use cache - defaults to true -->
<!-- <param name="al_cache" value="true"> -->
+ <!-- Version of Applet (case insensitive String), applet files not redownloaded if same version already in cache -->
+ <!-- <param name="al_version" value="0.1"> -->
+
<!-- background color to paint with, defaults to white -->
<!-- <param name="boxbgcolor" value="#000000"> -->
Modified: trunk/LWJGL/applet/basic/basicapplet.html
===================================================================
--- trunk/LWJGL/applet/basic/basicapplet.html 2011-08-14 10:46:00 UTC (rev 3613)
+++ trunk/LWJGL/applet/basic/basicapplet.html 2011-08-14 17:07:23 UTC (rev 3614)
@@ -32,12 +32,12 @@
<!-- Tags under here are optional -->
- <!-- Version of Applet, important otherwise applet won't be cached, version change will update applet, must be int or float -->
- <!-- <param name="al_version" value="0.1"> -->
-
<!-- whether to use cache - defaults to true -->
<!-- <param name="al_cache" value="true"> -->
+ <!-- Version of Applet (case insensitive String), applet files not redownloaded if same version already in cache -->
+ <!-- <param name="al_version" value="0.1"> -->
+
<!-- background color to paint with, defaults to white -->
<!-- <param name="boxbgcolor" value="#000000"> -->
Modified: trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java 2011-08-14 10:46:00 UTC (rev 3613)
+++ trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java 2011-08-14 17:07:23 UTC (rev 3614)
@@ -144,6 +144,7 @@
* <li>Bobjob</li>
* <li>Dashiva</li>
* <li>Dr_evil</li>
+ * <li>Elias Naur</li>
* <li>Kevin Glass</li>
* <li>Matthias Mann</li>
* <li>Mickelukas</li>
@@ -808,14 +809,12 @@
// if specified applet version already available don't download anything
boolean versionAvailable = false;
- // version of applet
+ // version string of applet
String version = getParameter("al_version");
- float latestVersion = 0;
-
+
// if applet version specifed, compare with version in the cache
if (version != null) {
- latestVersion = Float.parseFloat(version);
- versionAvailable = compareVersion(versionFile, latestVersion);
+ versionAvailable = compareVersion(versionFile, version.toLowerCase());
}
// if jars not available or need updating download them
@@ -838,7 +837,7 @@
// save version information once jars downloaded successfully
if (version != null) {
percentage = 90;
- writeObjectFile(versionFile, latestVersion);
+ writeObjectFile(versionFile, version.toLowerCase());
}
// save file names with last modified info once downloaded successfully
@@ -883,21 +882,23 @@
/**
* This method will return true if the version stored in the file
- * matches the supplied float version.
+ * matches the supplied String version.
*
* @param versionFile - location to file containing version information
- * @param version - float version that needs to be compared
+ * @param version - String version that needs to be compared
* @return returns true if the version in file matches specified version
*/
- protected boolean compareVersion(File versionFile, float version) {
+ protected boolean compareVersion(File versionFile, String version) {
// if version file exists
if (versionFile.exists()) {
+ String s = readStringFile(versionFile);
+
// compare to version with file
- if (version == readFloatFile(versionFile)) {
+ if (s != null && s.equals(version)) {
percentage = 90; // not need to download cache files again
if(debugMode) {
- System.out.println("Loading Cached Applet Version " + version);
+ System.out.println("Loading Cached Applet Version: " + version);
}
debug_sleep(2000);
@@ -980,22 +981,21 @@
}
/**
- * read float from File
+ * read String object from File
*
* @param file to be read
- * @return the float stored in the file or 0 if it fails
+ * @return the String stored in the file or null if it fails
*/
- protected float readFloatFile(File file) {
+ protected String readStringFile(File file) {
try {
- Float version = (Float)readObjectFile(file);
- return version.floatValue();
+ return (String)readObjectFile(file);
} catch (Exception e) {
// failed to read version file
e.printStackTrace();
}
- // return 0 if failed to read file
- return 0;
+ // return null if failed to read file
+ return null;
}
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2011-08-14 10:46:06
|
Revision: 3613
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3613&view=rev
Author: spasi
Date: 2011-08-14 10:46:00 +0000 (Sun, 14 Aug 2011)
Log Message:
-----------
Added support for AMD_pinned_memory.
Added Paths:
-----------
trunk/LWJGL/src/templates/org/lwjgl/opengl/AMD_pinned_memory.java
Added: trunk/LWJGL/src/templates/org/lwjgl/opengl/AMD_pinned_memory.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/AMD_pinned_memory.java (rev 0)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/AMD_pinned_memory.java 2011-08-14 10:46:00 UTC (rev 3613)
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2002-2011 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.opengl;
+
+public interface AMD_pinned_memory {
+
+ /**
+ * <strong>Official spec not released yet. Info from AMD developer forums:</strong><br/>
+ * Create a buffer object, bind it to the GL_EXTERNAL_VIRTUAL_MEMORY_AMD target and call glBufferData to 'allocate' space.
+ * When the driver sees you do this, it will use the pointer you supply directly rather than copying the data (that is, the
+ * GPU will access your application's memory). You can then use the buffer for other purposes such as a UBO, TBO or VBO by
+ * binding it to the appropriate targets. Synchronization is left to the application - make use of glFenceSync and glWaitSync.
+ * To release the memory, simply call glBufferData again on the buffer object on a different target, or delete the buffer
+ * object. Don't free the memory in the application until you've detached it from the buffer object or bad stuff will happen.
+ * <p/>
+ * Keep in mind that any memory you access will go over the PCIe bus which will be limited to 3-4 GB/s. This will work much
+ * better on Fusion systems (APUs). Theoretically, there isn't a limit to the amount of memory that can be pinned. However,
+ * when the OS pins memory, it removes it from the regular pagable pool and cannot swap it to disk (this is what pinning
+ * means). If you ask for too much, the OS will refuse to do it and the call will fail (the GL driver will return generate
+ * a GL_OUT_OF_MEMORY error). It is very likely that you'll hit this limit long before you run out of address space on the
+ * GPU, although in practice we do impose a moderate limit on the amount of pinned memory so as to not impact system stability
+ * and performance.
+ */
+ int GL_EXTERNAL_VIRTUAL_MEMORY_AMD = 0x9160;
+
+}
\ 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...> - 2011-08-13 19:17:04
|
Revision: 3612
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3612&view=rev
Author: spasi
Date: 2011-08-13 19:16:58 +0000 (Sat, 13 Aug 2011)
Log Message:
-----------
Replaced Arrays.copyof with custom implementation for Java 5 compatibility.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedObjectClassLoader.java
Modified: trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedObjectClassLoader.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedObjectClassLoader.java 2011-08-13 18:53:54 UTC (rev 3611)
+++ trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedObjectClassLoader.java 2011-08-13 19:16:58 UTC (rev 3612)
@@ -38,7 +38,6 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.URLClassLoader;
-import java.util.Arrays;
/**
* This classloader is responsible for applying the bytecode transformation to mapped objects.
@@ -167,7 +166,7 @@
try {
while ( true ) {
if ( bytecode.length == len )
- bytecode = Arrays.copyOf(bytecode, len * 2);
+ bytecode = copyOf(bytecode, len * 2);
int got = in.read(bytecode, len, bytecode.length - len);
if ( got == -1 )
break;
@@ -182,7 +181,13 @@
// ignore...
}
}
- return Arrays.copyOf(bytecode, len);
+ return copyOf(bytecode, len);
}
+ private static byte[] copyOf(byte[] original, int newLength) {
+ byte[] copy = new byte[newLength];
+ System.arraycopy(original, 0, copy, 0, Math.min(original.length, newLength));
+ return copy;
+ }
+
}
\ 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: <ka...@us...> - 2011-08-13 18:54:00
|
Revision: 3611
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3611&view=rev
Author: kappa1
Date: 2011-08-13 18:53:54 +0000 (Sat, 13 Aug 2011)
Log Message:
-----------
Fix issue with Mouse getWidth/getHeight values being wrongly clipped when using Display.setParent(), thx to MatthiasM for finding this.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/input/Mouse.java
Modified: trunk/LWJGL/src/java/org/lwjgl/input/Mouse.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/input/Mouse.java 2011-08-13 17:20:59 UTC (rev 3610)
+++ trunk/LWJGL/src/java/org/lwjgl/input/Mouse.java 2011-08-13 18:53:54 UTC (rev 3611)
@@ -362,8 +362,8 @@
y = poll_coord2;
}
if(clipMouseCoordinatesToWindow) {
- x = Math.min(implementation.getWidth() - 1, Math.max(0, x));
- y = Math.min(implementation.getHeight() - 1, Math.max(0, y));
+ x = Math.min(Display.getWidth() - 1, Math.max(0, x));
+ y = Math.min(Display.getHeight() - 1, Math.max(0, y));
}
dwheel += poll_dwheel;
read();
@@ -453,8 +453,8 @@
last_event_raw_y = new_event_y;
}
if(clipMouseCoordinatesToWindow) {
- event_x = Math.min(implementation.getWidth() - 1, Math.max(0, event_x));
- event_y = Math.min(implementation.getHeight() - 1, Math.max(0, event_y));
+ event_x = Math.min(Display.getWidth() - 1, Math.max(0, event_x));
+ event_y = Math.min(Display.getHeight() - 1, Math.max(0, event_y));
}
event_dwheel = readBuffer.getInt();
event_nanos = readBuffer.getLong();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2011-08-13 17:21:06
|
Revision: 3610
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3610&view=rev
Author: spasi
Date: 2011-08-13 17:20:59 +0000 (Sat, 13 Aug 2011)
Log Message:
-----------
Fixed GL42 detection and added an @Optional so that AMD's beta driver works.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/opengl/GLContext.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/GL42.java
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/GLContext.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/GLContext.java 2011-08-10 17:27:49 UTC (rev 3609)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/GLContext.java 2011-08-13 17:20:59 UTC (rev 3610)
@@ -221,7 +221,7 @@
{ 1, 2, 3, 4, 5 }, // OpenGL 1
{ 0, 1 }, // OpenGL 2
{ 0, 1, 2, 3 }, // OpenGL 3
- { 0, 1 }, // OpenGL 4
+ { 0, 1, 2 }, // OpenGL 4
};
for ( int major = 1; major <= GL_VERSIONS.length; major++ ) {
Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/GL42.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/GL42.java 2011-08-10 17:27:49 UTC (rev 3609)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/GL42.java 2011-08-13 17:20:59 UTC (rev 3610)
@@ -127,6 +127,7 @@
/** Returned in <params> by GetActiveUniform and GetActiveUniformsiv: */
int GL_UNSIGNED_INT_ATOMIC_COUNTER = 0x92DB;
+ @Optional(reason = "AMD's beta 4.2 driver (11.8) does not expose this")
@StripPostfix("params")
void glGetActiveAtomicCounterBufferiv(@GLuint int program, @GLuint int bufferIndex, @GLenum int pname, @Check("1") @OutParameter IntBuffer params);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2011-08-10 17:27:55
|
Revision: 3609
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3609&view=rev
Author: spasi
Date: 2011-08-10 17:27:49 +0000 (Wed, 10 Aug 2011)
Log Message:
-----------
Added EXT_texture_storage alias.
Modified Paths:
--------------
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_texture_storage.java
Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_texture_storage.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_texture_storage.java 2011-08-10 16:05:46 UTC (rev 3608)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_texture_storage.java 2011-08-10 17:27:49 UTC (rev 3609)
@@ -31,6 +31,7 @@
*/
package org.lwjgl.opengl;
+import org.lwjgl.util.generator.Alias;
import org.lwjgl.util.generator.Dependent;
import org.lwjgl.util.generator.Reuse;
import org.lwjgl.util.generator.opengl.GLenum;
@@ -38,6 +39,7 @@
import org.lwjgl.util.generator.opengl.GLuint;
@Dependent
+@Alias(value = "EXT_texture_storage", postfix = "EXT")
public interface ARB_texture_storage {
/** Accepted by the <value> parameter of GetTexParameter{if}v: */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2011-08-10 16:05:54
|
Revision: 3608
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3608&view=rev
Author: spasi
Date: 2011-08-10 16:05:46 +0000 (Wed, 10 Aug 2011)
Log Message:
-----------
Added support for cache-line padding and alignment.
Made byteOffset() in MappedField optional.
Misc fixes and improvements.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/LWJGLUtil.java
trunk/LWJGL/src/java/org/lwjgl/test/mapped/MappedObjectTests3.java
trunk/LWJGL/src/java/org/lwjgl/test/mapped/MappedObjectTests4.java
trunk/LWJGL/src/java/org/lwjgl/test/mapped/MappedSomething.java
trunk/LWJGL/src/java/org/lwjgl/test/mapped/TestMappedObject.java
trunk/LWJGL/src/java/org/lwjgl/test/opengl/sprites/SpriteShootout.java
trunk/LWJGL/src/java/org/lwjgl/test/opengl/sprites/SpriteShootoutMapped.java
trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedField.java
trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedHelper.java
trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedObjectClassLoader.java
trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedObjectTransformer.java
trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedObjectUnsafe.java
trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedType.java
Added Paths:
-----------
trunk/LWJGL/src/java/org/lwjgl/util/mapped/CacheLinePad.java
trunk/LWJGL/src/java/org/lwjgl/util/mapped/CacheLineSize.java
trunk/LWJGL/src/java/org/lwjgl/util/mapped/CacheUtil.java
Modified: trunk/LWJGL/src/java/org/lwjgl/LWJGLUtil.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/LWJGLUtil.java 2011-08-08 17:02:20 UTC (rev 3607)
+++ trunk/LWJGL/src/java/org/lwjgl/LWJGLUtil.java 2011-08-10 16:05:46 UTC (rev 3608)
@@ -449,15 +449,45 @@
* Gets a boolean property as a privileged action.
*/
public static boolean getPrivilegedBoolean(final String property_name) {
- Boolean value = AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
+ return AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
public Boolean run() {
return Boolean.getBoolean(property_name);
}
});
- return value;
}
/**
+ * Gets an integer property as a privileged action.
+ *
+ * @param property_name the integer property name
+ *
+ * @return the property value
+ */
+ public static Integer getPrivilegedInteger(final String property_name) {
+ return AccessController.doPrivileged(new PrivilegedAction<Integer>() {
+ public Integer run() {
+ return Integer.getInteger(property_name);
+ }
+ });
+ }
+
+ /**
+ * Gets an integer property as a privileged action.
+ *
+ * @param property_name the integer property name
+ * @param default_val the default value to use if the property is not defined
+ *
+ * @return the property value
+ */
+ public static Integer getPrivilegedInteger(final String property_name, final int default_val) {
+ return AccessController.doPrivileged(new PrivilegedAction<Integer>() {
+ public Integer run() {
+ return Integer.getInteger(property_name, default_val);
+ }
+ });
+ }
+
+ /**
* Prints the given message to System.err if DEBUG is true.
*
* @param msg Message to print
Modified: trunk/LWJGL/src/java/org/lwjgl/test/mapped/MappedObjectTests3.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/test/mapped/MappedObjectTests3.java 2011-08-08 17:02:20 UTC (rev 3607)
+++ trunk/LWJGL/src/java/org/lwjgl/test/mapped/MappedObjectTests3.java 2011-08-10 16:05:46 UTC (rev 3608)
@@ -60,6 +60,16 @@
assert (addr2 - addr1 == 4);
assert (mapped.capacity() == MappedSomething.SIZEOF - 4);
+ {
+ assert (some.shared == 0);
+ assert (mapped.getInt(8) == 0);
+
+ some.shared = 1234;
+
+ assert (some.shared == 1234);
+ assert (mapped.getInt(8) == 1234);
+ }
+
some.view++;
mapped = some.data; // creates new ByteBuffer instance
Modified: trunk/LWJGL/src/java/org/lwjgl/test/mapped/MappedObjectTests4.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/test/mapped/MappedObjectTests4.java 2011-08-08 17:02:20 UTC (rev 3607)
+++ trunk/LWJGL/src/java/org/lwjgl/test/mapped/MappedObjectTests4.java 2011-08-10 16:05:46 UTC (rev 3608)
@@ -34,10 +34,10 @@
import org.lwjgl.MemoryUtil;
import org.lwjgl.PointerBuffer;
import org.lwjgl.opengl.Display;
-import org.lwjgl.util.mapped.MappedObject;
-import org.lwjgl.util.mapped.Pointer;
+import org.lwjgl.util.mapped.*;
import java.io.File;
+import java.lang.reflect.Field;
import java.nio.ByteBuffer;
/** @author Riven */
@@ -145,4 +145,109 @@
}
}
+ @MappedType(cacheLinePadding = true)
+ public static class MappedCacheLinePadded extends MappedObject {
+
+ int foo;
+ int bar;
+
+ }
+
+ public static void testCacheLineAlignment() {
+ MappedCacheLinePadded data = MappedCacheLinePadded.malloc(10);
+
+ assert (data.backingByteBuffer().capacity() == 10 * CacheUtil.getCacheLineSize());
+ assert (MemoryUtil.getAddress(data.backingByteBuffer()) % CacheUtil.getCacheLineSize() == 0);
+
+ for ( int i = 0; i < 10; i++ ) {
+ data.view = i;
+
+ data.foo = i;
+ data.bar = i * 2;
+ }
+
+ for ( int i = 0; i < 10; i++ ) {
+ data.view = i;
+
+ assert (data.foo == i);
+ assert (data.bar == i * 2);
+ }
+ }
+
+ public static class MappedFieldCacheLinePadded extends MappedObject {
+
+ // If we assume CacheUtil.getCacheLineSize() == 64
+ // 0 - 63
+ @CacheLinePad long longBar;
+ // 64 - 71
+ long longFoo;
+ // 72 - 75
+ int intFoo;
+ // 128 - 131
+ @CacheLinePad(before = true) int intBar;
+ // 192 - 195
+ int foo;
+ // 256 - 267
+ @CacheLinePad(before = true, after = false)
+ @MappedField(byteLength = 12)
+ ByteBuffer buffer;
+ // 268 - 271
+ int bar;
+
+ }
+
+ public static void testCacheLinePadding() {
+ MappedFieldCacheLinePadded data = MappedFieldCacheLinePadded.map(CacheUtil.createByteBuffer(10 * MappedFieldCacheLinePadded.SIZEOF));
+
+ final int sizeof =
+ CacheUtil.getCacheLineSize()
+ + 8
+ + (CacheUtil.getCacheLineSize() - 8)
+ + CacheUtil.getCacheLineSize()
+ + 4
+ + (CacheUtil.getCacheLineSize() - 4)
+ + 12
+ + 4;
+
+ assert (MappedFieldCacheLinePadded.SIZEOF == sizeof);
+ assert (data.backingByteBuffer().capacity() == sizeof * 10);
+
+ for ( int i = 0; i < 10; i++ ) {
+ data.view = i;
+
+ data.longFoo = i * 1000000000L;
+ data.longBar = i * 2000000000L;
+ data.intFoo = i * 1000;
+ data.intBar = i * 2000;
+ data.foo = i;
+ }
+
+ for ( int i = 0; i < 10; i++ ) {
+ data.view = i;
+
+ assert (data.longFoo == i * 1000000000L);
+ assert (data.longBar == i * 2000000000L);
+ assert (data.intFoo == i * 1000);
+ assert (data.intBar == i * 2000);
+ assert (data.foo == i);
+ }
+ }
+
+ public static class POJOFieldCacheLinePadded {
+
+ @CacheLinePad long longBar;
+ long longFoo;
+ int intFoo;
+ @CacheLinePad(before = true) int intBar;
+ int foo;
+ @CacheLinePad boolean bool;
+ int bar;
+
+ }
+
+ public static void testCacheLinePaddingPOJO() {
+ Field[] fields = new POJOFieldCacheLinePadded().getClass().getDeclaredFields();
+ assert (fields.length == (1 + 7) + 1 + 1 + (15 + 1 + 15) + 1 + (1 + 63) + 1);
+ }
+
}
\ No newline at end of file
Modified: trunk/LWJGL/src/java/org/lwjgl/test/mapped/MappedSomething.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/test/mapped/MappedSomething.java 2011-08-08 17:02:20 UTC (rev 3607)
+++ trunk/LWJGL/src/java/org/lwjgl/test/mapped/MappedSomething.java 2011-08-10 16:05:46 UTC (rev 3608)
@@ -42,9 +42,12 @@
@MappedField(byteOffset = 0)
public int used;
- @MappedField(byteOffset = 4, byteLength = 64 - 4)
+ @MappedField(byteLength = 64 - 4) // optional byteOffset
public ByteBuffer data;
+ @MappedField(byteOffset = 12) // inside data
+ public int shared;
+
@Override
public String toString() {
return "MappedSomething[" + used + "]";
Modified: trunk/LWJGL/src/java/org/lwjgl/test/mapped/TestMappedObject.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/test/mapped/TestMappedObject.java 2011-08-08 17:02:20 UTC (rev 3607)
+++ trunk/LWJGL/src/java/org/lwjgl/test/mapped/TestMappedObject.java 2011-08-10 16:05:46 UTC (rev 3608)
@@ -52,6 +52,8 @@
MappedObjectTransformer.register(MappedSomething.class);
MappedObjectTransformer.register(MappedObjectTests3.Xyz.class);
MappedObjectTransformer.register(MappedObjectTests4.MappedPointer.class);
+ MappedObjectTransformer.register(MappedObjectTests4.MappedCacheLinePadded.class);
+ MappedObjectTransformer.register(MappedObjectTests4.MappedFieldCacheLinePadded.class);
if ( MappedObjectClassLoader.fork(TestMappedObject.class, args) ) {
return;
@@ -75,6 +77,9 @@
MappedObjectTests4.testLocalView();
//MappedObjectTests4.testLWJGL();
MappedObjectTests4.testPointer();
+ MappedObjectTests4.testCacheLineAlignment();
+ MappedObjectTests4.testCacheLinePadding();
+ MappedObjectTests4.testCacheLinePaddingPOJO();
System.out.println("done");
}
Modified: trunk/LWJGL/src/java/org/lwjgl/test/opengl/sprites/SpriteShootout.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/test/opengl/sprites/SpriteShootout.java 2011-08-08 17:02:20 UTC (rev 3607)
+++ trunk/LWJGL/src/java/org/lwjgl/test/opengl/sprites/SpriteShootout.java 2011-08-10 16:05:46 UTC (rev 3608)
@@ -86,6 +86,8 @@
private int texBigID;
private int texSmallID;
+ long animateTime;
+
private SpriteShootout() {
}
@@ -276,6 +278,8 @@
long timeUsed = 5000 + (startTime - System.currentTimeMillis());
startTime = System.currentTimeMillis() + 5000;
System.out.println("FPS: " + (Math.round(fps / (timeUsed / 1000.0) * 10) / 10.0) + ", Balls: " + ballCount);
+ System.out.println("\tAnimation: " + (animateTime / fps / 1000) + "us");
+ animateTime = 0;
fps = 0;
}
}
@@ -582,8 +586,12 @@
if ( animate ) {
final ByteBuffer buffer = animVBO.map(batchSize * (2 * 4));
+ long t0 = System.nanoTime();
animate(transform, buffer.asFloatBuffer(), ballSize, ballIndex, batchSize, delta);
+ long t1 = System.nanoTime();
+ animateTime += t1 - t0;
+
animVBO.unmap();
}
Modified: trunk/LWJGL/src/java/org/lwjgl/test/opengl/sprites/SpriteShootoutMapped.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/test/opengl/sprites/SpriteShootoutMapped.java 2011-08-08 17:02:20 UTC (rev 3607)
+++ trunk/LWJGL/src/java/org/lwjgl/test/opengl/sprites/SpriteShootoutMapped.java 2011-08-10 16:05:46 UTC (rev 3608)
@@ -89,6 +89,8 @@
private int texBigID;
private int texSmallID;
+ long animateTime;
+
private SpriteShootoutMapped() {
}
@@ -312,6 +314,8 @@
long timeUsed = 5000 + (startTime - System.currentTimeMillis());
startTime = System.currentTimeMillis() + 5000;
System.out.println("FPS: " + (Math.round(fps / (timeUsed / 1000.0) * 10) / 10.0) + ", Balls: " + ballCount);
+ System.out.println("Animation: " + animateTime / fps);
+ animateTime = 0;
fps = 0;
}
}
@@ -414,8 +418,8 @@
public static class Sprite extends MappedObject {
- public float x, dx;
- public float y, dy;
+ public float dx, x;
+ public float dy, y;
}
@@ -527,8 +531,8 @@
final Sprite[] sprites = sprite.asArray();
final SpriteRender[] spritesRender = spriteRender.asArray();
for ( int b = ballIndex, r = 0, len = (ballIndex + batchSize); b < len; b++, r++ ) {
+ float dx = sprites[b].dx;
float x = sprites[b].x;
- float dx = sprites[b].dx;
x += dx * delta;
if ( x < ballRadius ) {
@@ -539,12 +543,12 @@
dx = -dx;
}
+ sprites[b].dx = dx;
sprites[b].x = x;
- sprites[b].dx = dx;
spritesRender[r].x = x;
+ float dy = sprites[b].dy;
float y = sprites[b].y;
- float dy = sprites[b].dy;
y += dy * delta;
if ( y < ballRadius ) {
@@ -555,8 +559,8 @@
dy = -dy;
}
+ sprites[b].dy = dy;
sprites[b].y = y;
- sprites[b].dy = dy;
spritesRender[r].y = y;
}
}
@@ -654,8 +658,12 @@
if ( animate ) {
final ByteBuffer buffer = animVBO.map(batchSize * (2 * 4));
+ long t0 = System.nanoTime();
animate(sprites, SpriteRender.<SpriteRender>map(buffer), ballSize, ballIndex, batchSize, delta);
+ long t1 = System.nanoTime();
+ animateTime += t1 - t0;
+
animVBO.unmap();
}
Added: trunk/LWJGL/src/java/org/lwjgl/util/mapped/CacheLinePad.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/mapped/CacheLinePad.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/util/mapped/CacheLinePad.java 2011-08-10 16:05:46 UTC (rev 3608)
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2002-2011 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.util.mapped;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * When this annotation is used on a field, automatic cache-line-sized padding
+ * will be inserted around the field. This is useful in multi-threaded algorithms
+ * to avoid cache line false sharing. The annotation defaults to padding after
+ * the field, but can be changed to before or both before and after. It can be
+ * applied to both mapped object fields and POJO primitive fields.
+ *
+ * @author Spasi
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.FIELD)
+public @interface CacheLinePad {
+
+ /**
+ * When true, cache-line padding will be inserted before the field.
+ *
+ * @return
+ */
+ boolean before() default false;
+
+ /**
+ * When true, cache-line padding will be inserted after the field.
+ *
+ * @return
+ */
+ boolean after() default true;
+
+}
\ No newline at end of file
Added: trunk/LWJGL/src/java/org/lwjgl/util/mapped/CacheLineSize.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/mapped/CacheLineSize.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/util/mapped/CacheLineSize.java 2011-08-10 16:05:46 UTC (rev 3608)
@@ -0,0 +1,141 @@
+package org.lwjgl.util.mapped;
+
+import org.lwjgl.LWJGLUtil;
+import org.lwjgl.MemoryUtil;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.nio.IntBuffer;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutorCompletionService;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+import static org.lwjgl.util.mapped.MappedHelper.*;
+
+/**
+ * This micro-benchmark tries to detect the CPU's cache line size. This is
+ * done by exploiting cache line false sharing in multi-threaded code:
+ * When 2 threads simultaneously access the same cache line (and at least
+ * 1 access is a write), performance drops considerably. We detect this
+ * performance drop while decreasing the memory padding in every test step.
+ *
+ * @author Spasi
+ */
+final class CacheLineSize {
+
+ private CacheLineSize() {
+ }
+
+ static int getCacheLineSize() {
+ final int THREADS = 2;
+ final int REPEATS = 100000 * THREADS;
+ final int LOCAL_REPEATS = REPEATS / THREADS;
+
+ // Detection will start from CacheLineMaxSize bytes.
+ final int MAX_SIZE = LWJGLUtil.getPrivilegedInteger("org.lwjgl.util.mapped.CacheLineMaxSize", 1024) / 4; // in # of integers
+ // Detection will stop when the execution time increases by more than CacheLineTimeThreshold %.
+ final double TIME_THRESHOLD = 1.0 + LWJGLUtil.getPrivilegedInteger("org.lwjgl.util.mapped.CacheLineTimeThreshold", 50) / 100.0;
+
+ final ExecutorService executorService = Executors.newFixedThreadPool(THREADS);
+ final ExecutorCompletionService<Long> completionService = new ExecutorCompletionService<Long>(executorService);
+
+ try {
+ // We need to use a NIO buffer in order to guarantee memory alignment.
+ final IntBuffer memory = getMemory(MAX_SIZE);
+
+ // -- WARMUP --
+
+ final int WARMUP = 10;
+ for ( int i = 0; i < WARMUP; i++ )
+ doTest(THREADS, LOCAL_REPEATS, 0, memory, completionService);
+
+ // -- CACHE LINE SIZE DETECTION --
+
+ long totalTime = 0;
+ int count = 0;
+ int cacheLineSize = 64; // fallback to the most common size these days
+ boolean found = false;
+ for ( int i = MAX_SIZE; i >= 1; i >>= 1 ) {
+ final long time = doTest(THREADS, LOCAL_REPEATS, i, memory, completionService);
+ if ( totalTime > 0 ) { // Ignore first run
+ final long avgTime = totalTime / count;
+ if ( (double)time / (double)avgTime > TIME_THRESHOLD ) { // Try to detect a noticeable jump in execution time
+ cacheLineSize = (i << 1) * 4;
+ found = true;
+ break;
+ }
+ }
+ totalTime += time;
+ count++;
+ }
+
+ if ( LWJGLUtil.DEBUG ) {
+ if ( found )
+ LWJGLUtil.log("Cache line size detected: " + cacheLineSize + " bytes");
+ else
+ LWJGLUtil.log("Failed to detect cache line size, assuming " + cacheLineSize + " bytes");
+ }
+
+ return cacheLineSize;
+ } finally {
+ executorService.shutdown();
+ }
+ }
+
+ public static void main(String[] args) {
+ CacheUtil.getCacheLineSize();
+ }
+
+ static long memoryLoop(final int index, final int repeats, final IntBuffer memory, final int padding) {
+ final long address = MemoryUtil.getAddress(memory) + (index * padding * 4);
+
+ final long time = System.nanoTime();
+ for ( int i = 0; i < repeats; i++ ) {
+ // Use volatile access to avoid server VM optimizations.
+ ivput(ivget(address) + 1, address);
+ }
+
+ return System.nanoTime() - time;
+ }
+
+ private static IntBuffer getMemory(final int START_SIZE) {
+ final int PAGE_SIZE = MappedObjectUnsafe.INSTANCE.pageSize();
+
+ final ByteBuffer buffer = ByteBuffer.allocateDirect((START_SIZE * 4) + PAGE_SIZE).order(ByteOrder.nativeOrder());
+
+ // Align to page and, consequently, to cache line. Otherwise results will be inconsistent.
+ if ( MemoryUtil.getAddress(buffer) % PAGE_SIZE != 0 ) {
+ // Round up to page boundary
+ buffer.position(PAGE_SIZE - (int)(MemoryUtil.getAddress(buffer) & (PAGE_SIZE - 1)));
+ }
+
+ return buffer.asIntBuffer();
+ }
+
+ private static long doTest(final int threads, final int repeats, final int padding, final IntBuffer memory, final ExecutorCompletionService<Long> completionService) {
+ for ( int i = 0; i < threads; i++ )
+ submitTest(completionService, i, repeats, memory, padding);
+ return waitForResults(threads, completionService);
+ }
+
+ private static void submitTest(final ExecutorCompletionService<Long> completionService, final int index, final int repeats, final IntBuffer memory, final int padding) {
+ completionService.submit(new Callable<Long>() {
+ public Long call() throws Exception {
+ return memoryLoop(index, repeats, memory, padding);
+ }
+ });
+ }
+
+ private static long waitForResults(final int count, final ExecutorCompletionService<Long> completionService) {
+ try {
+ long totalTime = 0;
+ for ( int i = 0; i < count; i++ )
+ totalTime += completionService.take().get();
+ return totalTime;
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+}
\ No newline at end of file
Added: trunk/LWJGL/src/java/org/lwjgl/util/mapped/CacheUtil.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/mapped/CacheUtil.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/util/mapped/CacheUtil.java 2011-08-10 16:05:46 UTC (rev 3608)
@@ -0,0 +1,193 @@
+/*
+ * Copyright (c) 2002-2011 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.util.mapped;
+
+import org.lwjgl.LWJGLUtil;
+import org.lwjgl.MemoryUtil;
+import org.lwjgl.PointerBuffer;
+
+import java.nio.*;
+
+/**
+ * This class provides utility methods for allocating cache-line-aligned
+ * NIO buffers. The CPU cache line size is detected using a micro-benchmark
+ * that exploits the performation degredation that occurs when different
+ * threads write to different locations of the same cache line. The detection
+ * should be reasonably robust on both the server and client VM, but there
+ * are a few system properties that can be used to tune it.
+ *
+ * @author Spasi
+ */
+public final class CacheUtil {
+
+ private static final int CACHE_LINE_SIZE;
+
+ static {
+ final Integer size = LWJGLUtil.getPrivilegedInteger("org.lwjgl.util.mapped.CacheLineSize"); // forces a specific cache line size
+
+ if ( size != null ) {
+ if ( size < 1 )
+ throw new IllegalStateException("Invalid CacheLineSize specified: " + size);
+ CACHE_LINE_SIZE = size;
+ } else if ( Runtime.getRuntime().availableProcessors() == 1 ) { // We cannot use false sharing to detect it
+ /*
+ Spasi:
+
+ I have implemented a single-threaded benchmark for this, but it requires
+ lots of memory allocations and could not tune it for both the client and
+ server VM. It's not a big deal anyway, 64 bytes should be ok for any
+ single-core CPU.
+ */
+ if ( LWJGLUtil.DEBUG )
+ LWJGLUtil.log("Cannot detect cache line size on single-core CPUs, assuming 64 bytes.");
+ CACHE_LINE_SIZE = 64;
+ } else
+ CACHE_LINE_SIZE = CacheLineSize.getCacheLineSize();
+ }
+
+ private CacheUtil() {
+ }
+
+ /**
+ * Returns the CPU cache line size, in number of bytes.
+ *
+ * @return the cache line size
+ */
+ public static int getCacheLineSize() {
+ return CACHE_LINE_SIZE;
+ }
+
+ /**
+ * Construct a direct, native-ordered and cache-line-aligned bytebuffer with the specified size.
+ *
+ * @param size The size, in bytes
+ *
+ * @return a ByteBuffer
+ */
+ public static ByteBuffer createByteBuffer(int size) {
+ ByteBuffer buffer = ByteBuffer.allocateDirect(size + CACHE_LINE_SIZE);
+
+ // Align to cache line.
+ if ( MemoryUtil.getAddress(buffer) % CACHE_LINE_SIZE != 0 ) {
+ // Round up to cache line boundary
+ buffer.position(CACHE_LINE_SIZE - (int)(MemoryUtil.getAddress(buffer) & (CACHE_LINE_SIZE - 1)));
+ }
+
+ buffer.limit(buffer.position() + size);
+ return buffer.slice().order(ByteOrder.nativeOrder());
+ }
+
+ /**
+ * Construct a direct, native-ordered and cache-line-aligned shortbuffer with the specified number
+ * of elements.
+ *
+ * @param size The size, in shorts
+ *
+ * @return a ShortBuffer
+ */
+ public static ShortBuffer createShortBuffer(int size) {
+ return createByteBuffer(size << 1).asShortBuffer();
+ }
+
+ /**
+ * Construct a direct, native-ordered and cache-line-aligned charbuffer with the specified number
+ * of elements.
+ *
+ * @param size The size, in chars
+ *
+ * @return an CharBuffer
+ */
+ public static CharBuffer createCharBuffer(int size) {
+ return createByteBuffer(size << 1).asCharBuffer();
+ }
+
+ /**
+ * Construct a direct, native-ordered and cache-line-aligned intbuffer with the specified number
+ * of elements.
+ *
+ * @param size The size, in ints
+ *
+ * @return an IntBuffer
+ */
+ public static IntBuffer createIntBuffer(int size) {
+ return createByteBuffer(size << 2).asIntBuffer();
+ }
+
+ /**
+ * Construct a direct, native-ordered and cache-line-aligned longbuffer with the specified number
+ * of elements.
+ *
+ * @param size The size, in longs
+ *
+ * @return an LongBuffer
+ */
+ public static LongBuffer createLongBuffer(int size) {
+ return createByteBuffer(size << 3).asLongBuffer();
+ }
+
+ /**
+ * Construct a direct, native-ordered and cache-line-aligned floatbuffer with the specified number
+ * of elements.
+ *
+ * @param size The size, in floats
+ *
+ * @return a FloatBuffer
+ */
+ public static FloatBuffer createFloatBuffer(int size) {
+ return createByteBuffer(size << 2).asFloatBuffer();
+ }
+
+ /**
+ * Construct a direct, native-ordered and cache-line-aligned doublebuffer with the specified number
+ * of elements.
+ *
+ * @param size The size, in floats
+ *
+ * @return a FloatBuffer
+ */
+ public static DoubleBuffer createDoubleBuffer(int size) {
+ return createByteBuffer(size << 3).asDoubleBuffer();
+ }
+
+ /**
+ * Construct a cache-line-aligned PointerBuffer with the specified number
+ * of elements.
+ *
+ * @param size The size, in memory addresses
+ *
+ * @return a PointerBuffer
+ */
+ public static PointerBuffer createPointerBuffer(int size) {
+ return new PointerBuffer(createByteBuffer(size * PointerBuffer.getPointerSize()));
+ }
+
+}
\ No newline at end of file
Modified: trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedField.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedField.java 2011-08-08 17:02:20 UTC (rev 3607)
+++ trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedField.java 2011-08-10 16:05:46 UTC (rev 3608)
@@ -53,7 +53,7 @@
*
* @return the field byte offset
*/
- long byteOffset();
+ long byteOffset() default -1;
/**
* Specifies the field byte length. Required for {@link java.nio.ByteBuffer} fields.
Modified: trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedHelper.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedHelper.java 2011-08-08 17:02:20 UTC (rev 3607)
+++ trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedHelper.java 2011-08-10 16:05:46 UTC (rev 3608)
@@ -68,7 +68,7 @@
mo.baseAddress = mo.viewAddress = addr;
}
- public static void checkAddress(MappedObject mapped, long viewAddress) {
+ public static void checkAddress(long viewAddress, MappedObject mapped) {
mapped.checkAddress(viewAddress);
}
@@ -317,7 +317,7 @@
return INSTANCE.getLong(addr);
}
- public static long lget(MappedObject mapped, int fieldOffset) {
+ public static long jget(MappedObject mapped, int fieldOffset) {
return INSTANCE.getLong(mapped.viewAddress + fieldOffset);
}
@@ -333,7 +333,7 @@
return INSTANCE.getLongVolatile(null, addr);
}
- public static long lvget(MappedObject mapped, int fieldOffset) {
+ public static long jvget(MappedObject mapped, int fieldOffset) {
return INSTANCE.getLongVolatile(null, mapped.viewAddress + fieldOffset);
}
Modified: trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedObjectClassLoader.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedObjectClassLoader.java 2011-08-08 17:02:20 UTC (rev 3607)
+++ trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedObjectClassLoader.java 2011-08-10 16:05:46 UTC (rev 3608)
@@ -48,12 +48,8 @@
*/
public class MappedObjectClassLoader extends URLClassLoader {
- static final String MAPPEDOBJECT_PACKAGE_PREFIX;
+ static final String MAPPEDOBJECT_PACKAGE_PREFIX = MappedObjectClassLoader.class.getPackage().getName() + ".";
- static {
- MAPPEDOBJECT_PACKAGE_PREFIX = MappedObjectClassLoader.class.getPackage().getName() + ".";
- }
-
static boolean FORKED;
/**
@@ -115,28 +111,28 @@
@Override
protected synchronized Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
- if ( name.startsWith("java.") )
+ if ( name.startsWith("java.")
+ || name.startsWith("javax.")
+ || name.startsWith("sun.")
+ || name.startsWith("sunw.")
+ || name.startsWith("org.objectweb.asm.")
+ )
return super.loadClass(name, resolve);
- if ( name.startsWith("javax.") )
- return super.loadClass(name, resolve);
- if ( name.startsWith("sun.") )
- return super.loadClass(name, resolve);
- if ( name.startsWith("sunw.") )
- return super.loadClass(name, resolve);
+ final String className = name.replace('.', '/');
+ final boolean inThisPackage = name.startsWith(MAPPEDOBJECT_PACKAGE_PREFIX);
- if ( name.startsWith("org.objectweb.asm.") )
+ if ( inThisPackage && (
+ name.equals(MappedObjectClassLoader.class.getName())
+ || name.equals((MappedObjectTransformer.class.getName()))
+ || name.equals((CacheUtil.class.getName()))
+ ) )
return super.loadClass(name, resolve);
- if ( name.equals(MappedObjectClassLoader.class.getName()) || name.equals((MappedObjectTransformer.class.getName())) )
- return super.loadClass(name, resolve);
-
- String className = name.replace('.', '/');
-
byte[] bytecode = readStream(this.getResourceAsStream(className.concat(".class")));
// Classes in this package do not get transformed, but need to go through here because we have transformed MappedObject.
- if ( !(name.startsWith(MAPPEDOBJECT_PACKAGE_PREFIX) && name.substring(MAPPEDOBJECT_PACKAGE_PREFIX.length()).indexOf('.') == -1) ) {
+ if ( !(inThisPackage && name.substring(MAPPEDOBJECT_PACKAGE_PREFIX.length()).indexOf('.') == -1) ) {
long t0 = System.nanoTime();
final byte[] newBytecode = MappedObjectTransformer.transformMappedAPI(className, bytecode);
long t1 = System.nanoTime();
Modified: trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedObjectTransformer.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedObjectTransformer.java 2011-08-08 17:02:20 UTC (rev 3607)
+++ trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedObjectTransformer.java 2011-08-10 16:05:46 UTC (rev 3608)
@@ -31,6 +31,7 @@
*/
package org.lwjgl.util.mapped;
+import org.lwjgl.BufferUtils;
import org.lwjgl.LWJGLUtil;
import org.lwjgl.MemoryUtil;
import org.objectweb.asm.*;
@@ -79,6 +80,8 @@
static final String MAPPED_SET3_JVM = jvmClassName(MappedSet3.class);
static final String MAPPED_SET4_JVM = jvmClassName(MappedSet4.class);
+ static final String CACHE_LINE_PAD_JVM = "L" + jvmClassName(CacheLinePad.class) + ";";
+
// Public methods
static final String VIEWADDRESS_METHOD_NAME = "getViewAddress";
static final String NEXT_METHOD_NAME = "next";
@@ -115,7 +118,7 @@
// => IADD
// => PUTFIELD MyMappedType.view
//
- className_to_subtype.put(MAPPED_OBJECT_JVM, new MappedSubtypeInfo(MAPPED_OBJECT_JVM, null, -1, -1, -1));
+ className_to_subtype.put(MAPPED_OBJECT_JVM, new MappedSubtypeInfo(MAPPED_OBJECT_JVM, null, -1, -1, -1, false));
}
final String vmName = System.getProperty("java.vm.name");
@@ -145,30 +148,44 @@
final String className = jvmClassName(type);
final Map<String, FieldInfo> fields = new HashMap<String, FieldInfo>();
- int advancingOffset = 0;
long sizeof = 0;
for ( Field field : type.getDeclaredFields() ) {
- FieldInfo fieldInfo = registerField(mapped == null || mapped.autoGenerateOffsets(), className, advancingOffset, field);
+ FieldInfo fieldInfo = registerField(mapped == null || mapped.autoGenerateOffsets(), className, sizeof, field);
if ( fieldInfo == null )
continue;
fields.put(field.getName(), fieldInfo);
- advancingOffset += fieldInfo.length;
- sizeof = Math.max(sizeof, fieldInfo.offset + fieldInfo.length);
+ sizeof = Math.max(sizeof, fieldInfo.offset + fieldInfo.lengthPadded);
}
- final int align = mapped == null ? 4 : mapped.align();
- final int padding = mapped == null ? 0 : mapped.padding();
+ int align = 4;
+ int padding = 0;
+ boolean cacheLinePadded = false;
+ if ( mapped != null ) {
+ align = mapped.align();
+ if ( mapped.cacheLinePadding() ) {
+ if ( mapped.padding() != 0 )
+ throw new ClassFormatError("Mapped type padding cannot be specified together with cacheLinePadding.");
+
+ final int cacheLineMod = (int)(sizeof % CacheUtil.getCacheLineSize());
+ if ( cacheLineMod != 0 )
+ padding = CacheUtil.getCacheLineSize() - cacheLineMod;
+
+ cacheLinePadded = true;
+ } else
+ padding = mapped.padding();
+ }
+
sizeof += padding;
- final MappedSubtypeInfo mappedType = new MappedSubtypeInfo(className, fields, (int)sizeof, align, padding);
+ final MappedSubtypeInfo mappedType = new MappedSubtypeInfo(className, fields, (int)sizeof, align, padding, cacheLinePadded);
if ( className_to_subtype.put(className, mappedType) != null )
throw new InternalError("duplicate mapped type: " + mappedType.className);
}
- private static FieldInfo registerField(final boolean autoGenerateOffsets, final String className, int advancingOffset, final Field field) {
+ private static FieldInfo registerField(final boolean autoGenerateOffsets, final String className, long advancingOffset, final Field field) {
if ( Modifier.isStatic(field.getModifiers()) ) // static fields are never mapped
return null;
@@ -188,7 +205,6 @@
throw new ClassFormatError("The volatile keyword is not supported for @Pointer or ByteBuffer fields. Volatile field found: " + className + "." + field.getName() + ": " + field.getType());
// quick hack
- long byteOffset = meta == null ? advancingOffset : meta.byteOffset();
long byteLength;
if ( field.getType() == long.class || field.getType() == double.class ) {
if ( pointer == null )
@@ -213,10 +229,36 @@
if ( field.getType() != ByteBuffer.class && (advancingOffset % byteLength) != 0 )
throw new IllegalStateException("misaligned mapped type: " + className + "." + field.getName());
+ CacheLinePad pad = field.getAnnotation(CacheLinePad.class);
+
+ long byteOffset = advancingOffset;
+ if ( meta != null && meta.byteOffset() != -1 ) {
+ if ( meta.byteOffset() < 0 )
+ throw new ClassFormatError("Invalid field byte offset: " + className + "." + field.getName() + " [byteOffset=" + meta.byteOffset() + "]");
+ if ( pad != null )
+ throw new ClassFormatError("A field byte offset cannot be specified together with cache-line padding: " + className + "." + field.getName());
+
+ byteOffset = meta.byteOffset();
+ }
+
+ long byteLengthPadded = byteLength;
+ if ( pad != null ) {
+ // Pad before
+ if ( pad.before() && byteOffset % CacheUtil.getCacheLineSize() != 0 )
+ byteOffset += CacheUtil.getCacheLineSize() - (byteOffset & (CacheUtil.getCacheLineSize() - 1));
+
+ // Pad after
+ if ( pad.after() && (byteOffset + byteLength) % CacheUtil.getCacheLineSize() != 0 )
+ byteLengthPadded += CacheUtil.getCacheLineSize() - (byteOffset + byteLength) % CacheUtil.getCacheLineSize();
+
+ assert !pad.before() || (byteOffset % CacheUtil.getCacheLineSize() == 0);
+ assert !pad.after() || ((byteOffset + byteLengthPadded) % CacheUtil.getCacheLineSize() == 0);
+ }
+
if ( PRINT_ACTIVITY )
LWJGLUtil.log(MappedObjectTransformer.class.getSimpleName() + ": " + className + "." + field.getName() + " [type=" + field.getType().getSimpleName() + ", offset=" + byteOffset + "]");
- return new FieldInfo(byteOffset, byteLength, Type.getType(field.getType()), Modifier.isVolatile(field.getModifiers()), pointer != null);
+ return new FieldInfo(byteOffset, byteLength, byteLengthPadded, Type.getType(field.getType()), Modifier.isVolatile(field.getModifiers()), pointer != null);
}
/** Removes final from methods that will be overriden by subclasses. */
@@ -318,17 +360,12 @@
mv.visitInsn(I2L);
mv.visitInsn(LADD);
if ( MappedObject.CHECKS ) {
- mv.visitVarInsn(LSTORE, 2);
+ mv.visitInsn(DUP2);
mv.visitVarInsn(ALOAD, 0);
- mv.visitVarInsn(LLOAD, 2);
- mv.visitMethodInsn(INVOKESTATIC, MAPPED_HELPER_JVM, "checkAddress", "(L" + MAPPED_OBJECT_JVM + ";J)V");
- mv.visitVarInsn(LLOAD, 2);
+ mv.visitMethodInsn(INVOKESTATIC, MAPPED_HELPER_JVM, "checkAddress", "(JL" + MAPPED_OBJECT_JVM + ";)V");
}
mv.visitInsn(LRETURN);
- if ( MappedObject.CHECKS )
- mv.visitMaxs(3, 4);
- else
- mv.visitMaxs(3, 2);
+ mv.visitMaxs(3, 2);
mv.visitEnd();
}
@@ -477,7 +514,71 @@
return null;
}
- return super.visitField(access, name, desc, signature, value);
+ if ( (access & ACC_STATIC) == 0 ) {
+ return new FieldNode(access, name, desc, signature, value) {
+ public void visitEnd() {
+ if ( visibleAnnotations == null ) { // early-out
+ accept(cv);
+ return;
+ }
+
+ boolean before = false;
+ boolean after = false;
+ int byteLength = 0;
+ for ( AnnotationNode pad : visibleAnnotations ) {
+ if ( CACHE_LINE_PAD_JVM.equals(pad.desc) ) {
+ if ( "J".equals(desc) || "D".equals(desc) )
+ byteLength = 8;
+ else if ( "I".equals(desc) || "F".equals(desc) )
+ byteLength = 4;
+ else if ( "S".equals(desc) || "C".equals(desc) )
+ byteLength = 2;
+ else if ( "B".equals(desc) || "Z".equals(desc) )
+ byteLength = 1;
+ else
+ throw new ClassFormatError("The @CacheLinePad annotation cannot be used on non-primitive fields: " + className + "." + name);
+
+ transformed = true;
+
+ after = true;
+ if ( pad.values != null ) {
+ for ( int i = 0; i < pad.values.size(); i += 2 ) {
+ final boolean value = pad.values.get(i + 1).equals(Boolean.TRUE);
+ if ( "before".equals(pad.values.get(i)) )
+ before = value;
+ else
+ after = value;
+ }
+ }
+ break;
+ }
+ }
+
+ /*
+ We make the fields public to force the JVM to keep the fields in the object.
+ Instead of using only longs or integers, we use the same type as the original
+ field. That's because modern JVMs usually reorder fields by type:
+ longs, then doubles, then integers, then booleans, etc. This way it's more
+ likely that the padding will work as expected.
+ */
+
+ if ( before ) {
+ final int count = CacheUtil.getCacheLineSize() / byteLength - 1;
+ for ( int i = count; i >= 1; i-- )
+ cv.visitField(access | ACC_PUBLIC | ACC_SYNTHETIC, name + "$PAD_" + i, desc, signature, null);
+ }
+
+ accept(cv);
+
+ if ( after ) {
+ final int count = CacheUtil.getCacheLineSize() / byteLength - 1;
+ for ( int i = 1; i <= count; i++ )
+ cv.visitField(access | ACC_PUBLIC | ACC_SYNTHETIC, name + "$PAD" + i, desc, signature, null);
+ }
+ }
+ };
+ } else
+ return super.visitField(access, name, desc, signature, value);
}
@Override
@@ -762,7 +863,7 @@
// stack: sizeof, count
trg.add(new InsnNode(IMUL));
// stack: bytes
- trg.add(new MethodInsnNode(INVOKESTATIC, jvmClassName(ByteBuffer.class), "allocateDirect", "(I)L" + jvmClassName(ByteBuffer.class) + ";"));
+ trg.add(new MethodInsnNode(INVOKESTATIC, mappedType.cacheLinePadded ? jvmClassName(CacheUtil.class) : jvmClassName(BufferUtils.class), "createByteBuffer", "(I)L" + jvmClassName(ByteBuffer.class) + ";"));
// stack: buffer
} else if ( mapDirectMethod ) {
// stack: capacity, address
@@ -1061,13 +1162,15 @@
final long offset;
final long length;
+ final long lengthPadded;
final Type type;
final boolean isVolatile;
final boolean isPointer;
- FieldInfo(final long offset, final long length, final Type type, final boolean isVolatile, final boolean isPointer) {
+ FieldInfo(final long offset, final long length, final long lengthPadded, final Type type, final boolean isVolatile, final boolean isPointer) {
this.offset = offset;
this.length = length;
+ this.lengthPadded = lengthPadded;
this.type = type;
this.isVolatile = isVolatile;
this.isPointer = isPointer;
@@ -1083,14 +1186,15 @@
final String className;
- final int sizeof;
- final int sizeof_shift;
- final int align;
- final int padding;
+ final int sizeof;
+ final int sizeof_shift;
+ final int align;
+ final int padding;
+ final boolean cacheLinePadded;
final Map<String, FieldInfo> fields;
- MappedSubtypeInfo(String className, Map<String, FieldInfo> fields, int sizeof, int align, int padding) {
+ MappedSubtypeInfo(String className, Map<String, FieldInfo> fields, int sizeof, int align, int padding, final boolean cacheLinePadded) {
this.className = className;
this.sizeof = sizeof;
@@ -1100,6 +1204,7 @@
this.sizeof_shift = 0;
this.align = align;
this.padding = padding;
+ this.cacheLinePadded = cacheLinePadded;
this.fields = fields;
}
Modified: trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedObjectUnsafe.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedObjectUnsafe.java 2011-08-08 17:02:20 UTC (rev 3607)
+++ trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedObjectUnsafe.java 2011-08-10 16:05:46 UTC (rev 3608)
@@ -34,6 +34,7 @@
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
import sun.misc.Unsafe;
@@ -55,7 +56,7 @@
if ( address <= 0L || capacity < 0 )
throw new IllegalStateException("you almost crashed the jvm");
- ByteBuffer buffer = global.duplicate();
+ ByteBuffer buffer = global.duplicate().order(ByteOrder.nativeOrder());
INSTANCE.putLong(buffer, BUFFER_ADDRESS_OFFSET, address);
INSTANCE.putInt(buffer, BUFFER_CAPACITY_OFFSET, capacity);
buffer.position(0);
Modified: trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedType.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedType.java 2011-08-08 17:02:20 UTC (rev 3607)
+++ trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedType.java 2011-08-10 16:05:46 UTC (rev 3608)
@@ -61,13 +61,28 @@
/**
* The number of bytes to add to the total byte size.
- * SIZEOF will be calculated as <code>SIZEOF = max(field_offset + field_length) + padding</code>
+ * SIZEOF will be calculated as <code>SIZEOF = max(field_offset + field_length) + padding</code>.
+ * <p/>
+ * Cannot be used with {@link #cacheLinePadding()}.
*
* @return the padding amount
*/
int padding() default 0;
/**
+ * When true, SIZEOF will be increased (if necessary) so that it's a multiple of the CPU cache line size.
+ * Additionally, {@link MappedObject#malloc(int)} on the mapped object type will automatically use
+ * {@link CacheUtil#createByteBuffer(int)} instead of the unaligned {@link org.lwjgl.BufferUtils#createByteBuffer(int)}.
+ * <p/>
+ * Cannot be used with {@link #padding()}.
+ *
+ * @return if cache-line padding should be applied
+ *
+ * @see CacheUtil
+ */
+ boolean cacheLinePadding() default false;
+
+ /**
* The mapped data memory alignment, in bytes.
*
* @return the memory alignment
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2011-08-08 17:02:26
|
Revision: 3607
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3607&view=rev
Author: spasi
Date: 2011-08-08 17:02:20 +0000 (Mon, 08 Aug 2011)
Log Message:
-----------
Added missing annotation and import.
Modified Paths:
--------------
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_texture_storage.java
Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_texture_storage.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_texture_storage.java 2011-08-08 16:42:37 UTC (rev 3606)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_texture_storage.java 2011-08-08 17:02:20 UTC (rev 3607)
@@ -35,7 +35,9 @@
import org.lwjgl.util.generator.Reuse;
import org.lwjgl.util.generator.opengl.GLenum;
import org.lwjgl.util.generator.opengl.GLsizei;
+import org.lwjgl.util.generator.opengl.GLuint;
+@Dependent
public interface ARB_texture_storage {
/** Accepted by the <value> parameter of GetTexParameter{if}v: */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2011-08-08 16:42:43
|
Revision: 3606
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3606&view=rev
Author: spasi
Date: 2011-08-08 16:42:37 +0000 (Mon, 08 Aug 2011)
Log Message:
-----------
Added DSA functions.
Modified Paths:
--------------
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_texture_storage.java
Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_texture_storage.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_texture_storage.java 2011-08-08 10:48:14 UTC (rev 3605)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_texture_storage.java 2011-08-08 16:42:37 UTC (rev 3606)
@@ -31,6 +31,7 @@
*/
package org.lwjgl.opengl;
+import org.lwjgl.util.generator.Dependent;
import org.lwjgl.util.generator.Reuse;
import org.lwjgl.util.generator.opengl.GLenum;
import org.lwjgl.util.generator.opengl.GLsizei;
@@ -55,4 +56,19 @@
@GLenum int internalformat,
@GLsizei int width, @GLsizei int height, @GLsizei int depth);
-}
+ @Dependent("EXT_direct_state_access")
+ void glTextureStorage1DEXT(@GLuint int texture, @GLenum int target, @GLsizei int levels,
+ @GLenum int internalformat,
+ @GLsizei int width);
+
+ @Dependent("EXT_direct_state_access")
+ void glTextureStorage2DEXT(@GLuint int texture, @GLenum int target, @GLsizei int levels,
+ @GLenum int internalformat,
+ @GLsizei int width, @GLsizei int height);
+
+ @Dependent("EXT_direct_state_access")
+ void glTextureStorage3DEXT(@GLuint int texture, @GLenum int target, @GLsizei int levels,
+ @GLenum int internalformat,
+ @GLsizei int width, @GLsizei int height, @GLsizei int depth);
+
+}
\ 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...> - 2011-08-08 10:48:23
|
Revision: 3605
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3605&view=rev
Author: spasi
Date: 2011-08-08 10:48:14 +0000 (Mon, 08 Aug 2011)
Log Message:
-----------
Added support for OpenGL 4.2
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/opengl/ContextAttribs.java
trunk/LWJGL/src/native/common/common_tools.c
trunk/LWJGL/src/templates/org/lwjgl/opencl/KHR_icd.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/GL41.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_half_float.java
Added Paths:
-----------
trunk/LWJGL/src/templates/org/lwjgl/opencl/AMD_vec3.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_base_instance.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_compressed_texture_pixel_storage.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_conservative_depth.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_internalformat_query.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_map_buffer_alignment.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shader_atomic_counters.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shader_image_load_store.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shading_language_420pack.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shading_language_packing.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_texture_storage.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_transform_feedback_instanced.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/GL42.java
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/ContextAttribs.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/ContextAttribs.java 2011-08-06 13:18:49 UTC (rev 3604)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/ContextAttribs.java 2011-08-08 10:48:14 UTC (rev 3605)
@@ -87,7 +87,7 @@
public ContextAttribs(final int majorVersion, final int minorVersion) {
if ( majorVersion < 0 || 4 < majorVersion ||
minorVersion < 0 ||
- (majorVersion == 4 && 1 < minorVersion) ||
+ (majorVersion == 4 && 2 < minorVersion) ||
(majorVersion == 3 && 3 < minorVersion) ||
(majorVersion == 2 && 1 < minorVersion) ||
(majorVersion == 1 && 5 < minorVersion) )
Modified: trunk/LWJGL/src/native/common/common_tools.c
===================================================================
--- trunk/LWJGL/src/native/common/common_tools.c 2011-08-06 13:18:49 UTC (rev 3604)
+++ trunk/LWJGL/src/native/common/common_tools.c 2011-08-08 10:48:14 UTC (rev 3605)
@@ -120,7 +120,7 @@
org_lwjgl_LWJGLUtil_class = (*env)->FindClass(env, "org/lwjgl/LWJGLUtil");
if (org_lwjgl_LWJGLUtil_class == NULL)
return;
- log_method = (*env)->GetStaticMethodID(env, org_lwjgl_LWJGLUtil_class, "log", "(Ljava/lang/String;)V");
+ log_method = (*env)->GetStaticMethodID(env, org_lwjgl_LWJGLUtil_class, "log", "(Ljava/lang/CharSequence;)V");
if (log_method == NULL)
return;
(*env)->CallStaticVoidMethod(env, org_lwjgl_LWJGLUtil_class, log_method, str);
Added: trunk/LWJGL/src/templates/org/lwjgl/opencl/AMD_vec3.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opencl/AMD_vec3.java (rev 0)
+++ trunk/LWJGL/src/templates/org/lwjgl/opencl/AMD_vec3.java 2011-08-08 10:48:14 UTC (rev 3605)
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2002-2011 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 AMD_vec3 {
+
+}
\ No newline at end of file
Modified: trunk/LWJGL/src/templates/org/lwjgl/opencl/KHR_icd.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opencl/KHR_icd.java 2011-08-06 13:18:49 UTC (rev 3604)
+++ trunk/LWJGL/src/templates/org/lwjgl/opencl/KHR_icd.java 2011-08-08 10:48:14 UTC (rev 3605)
@@ -49,7 +49,7 @@
/** Returned by clGetPlatformIDs when no platforms are found */
int CL_PLATFORM_NOT_FOUND_KHR = -1001;
- @Optional(reason = "AMD Stream does not expose this (version tested: 2.2)")
+ @Optional(reason = "AMD Stream does not expose this (version tested: 2.5)")
@cl_int
int clIcdGetPlatformIDsKHR(@AutoSize(value = "platforms", canBeNull = true) @cl_uint int num_entries,
@OutParameter @Check(canBeNull = true) @NativeType("cl_platform_id") PointerBuffer platforms,
Added: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_base_instance.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_base_instance.java (rev 0)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_base_instance.java 2011-08-08 10:48:14 UTC (rev 3605)
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2002-2011 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.opengl;
+
+import org.lwjgl.util.generator.*;
+import org.lwjgl.util.generator.opengl.*;
+
+import java.nio.Buffer;
+
+public interface ARB_base_instance {
+
+ @Reuse("GL42")
+ void glDrawArraysInstancedBaseInstance(@GLenum int mode,
+ int first,
+ @GLsizei int count,
+ @GLsizei int primcount,
+ @GLuint int baseinstance);
+
+ @Reuse("GL42")
+ void glDrawElementsInstancedBaseInstance(@GLenum int mode,
+ @AutoSize("indices") @GLsizei int count,
+ @AutoType("indices") @GLenum int type,
+ @Const
+ @BufferObject(BufferKind.ElementVBO)
+ @GLubyte
+ @GLushort
+ @GLuint Buffer indices,
+ @GLsizei int primcount,
+ @GLuint int baseinstance);
+
+ @Reuse("GL42")
+ void glDrawElementsInstancedBaseVertexBaseInstance(@GLenum int mode,
+ @AutoSize("indices") @GLsizei int count,
+ @AutoType("indices") @GLenum int type,
+ @Const
+ @BufferObject(BufferKind.ElementVBO)
+ @GLubyte
+ @GLushort
+ @GLuint Buffer indices,
+ @GLsizei int primcount,
+ int basevertex,
+ @GLuint int baseinstance);
+
+}
\ No newline at end of file
Added: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_compressed_texture_pixel_storage.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_compressed_texture_pixel_storage.java (rev 0)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_compressed_texture_pixel_storage.java 2011-08-08 10:48:14 UTC (rev 3605)
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2002-2011 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.opengl;
+
+public interface ARB_compressed_texture_pixel_storage {
+
+ /**
+ * Accepted by the <pname> parameter of PixelStore[fi], GetBooleanv,
+ * GetIntegerv, GetInteger64v, GetFloatv, and GetDoublev:
+ */
+ int GL_UNPACK_COMPRESSED_BLOCK_WIDTH = 0x9127,
+ GL_UNPACK_COMPRESSED_BLOCK_HEIGHT = 0x9128,
+ GL_UNPACK_COMPRESSED_BLOCK_DEPTH = 0x9129,
+ GL_UNPACK_COMPRESSED_BLOCK_SIZE = 0x912A,
+ GL_PACK_COMPRESSED_BLOCK_WIDTH = 0x912B,
+ GL_PACK_COMPRESSED_BLOCK_HEIGHT = 0x912C,
+ GL_PACK_COMPRESSED_BLOCK_DEPTH = 0x912D,
+ GL_PACK_COMPRESSED_BLOCK_SIZE = 0x912E;
+
+}
\ No newline at end of file
Added: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_conservative_depth.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_conservative_depth.java (rev 0)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_conservative_depth.java 2011-08-08 10:48:14 UTC (rev 3605)
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2002-2011 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.opengl;
+
+public interface ARB_conservative_depth {
+}
\ No newline at end of file
Added: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_internalformat_query.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_internalformat_query.java (rev 0)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_internalformat_query.java 2011-08-08 10:48:14 UTC (rev 3605)
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2002-2011 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.opengl;
+
+import org.lwjgl.util.generator.*;
+import org.lwjgl.util.generator.opengl.GLenum;
+import org.lwjgl.util.generator.opengl.GLreturn;
+import org.lwjgl.util.generator.opengl.GLsizei;
+
+import java.nio.IntBuffer;
+
+@Extension(postfix = "")
+public interface ARB_internalformat_query {
+
+ /** Accepted by the <pname> parameter of GetInternalformativ: */
+ int GL_NUM_SAMPLE_COUNTS = 0x9380;
+
+ @StripPostfix("params")
+ @Reuse("GL42")
+ void glGetInternalformativ(@GLenum int target, @GLenum int internalformat,
+ @GLenum int pname, @AutoSize("params") @GLsizei int bufSize, @OutParameter IntBuffer params);
+
+ @Alternate("glGetInternalformativ")
+ @StripPostfix("params")
+ @GLreturn("params")
+ @Reuse("GL42")
+ void glGetInternalformativ2(@GLenum int target, @GLenum int internalformat,
+ @GLenum int pname, @Constant("1") @GLsizei int bufSize, @OutParameter IntBuffer params);
+
+}
\ No newline at end of file
Added: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_map_buffer_alignment.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_map_buffer_alignment.java (rev 0)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_map_buffer_alignment.java 2011-08-08 10:48:14 UTC (rev 3605)
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2002-2011 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.opengl;
+
+public interface ARB_map_buffer_alignment {
+
+ /**
+ * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv,
+ * GetInteger64v, GetFloatv, and GetDoublev:
+ */
+ int GL_MIN_MAP_BUFFER_ALIGNMENT = 0x90BC;
+
+}
\ No newline at end of file
Added: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shader_atomic_counters.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shader_atomic_counters.java (rev 0)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shader_atomic_counters.java 2011-08-08 10:48:14 UTC (rev 3605)
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2002-2011 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.opengl;
+
+import org.lwjgl.util.generator.*;
+import org.lwjgl.util.generator.opengl.GLenum;
+import org.lwjgl.util.generator.opengl.GLreturn;
+import org.lwjgl.util.generator.opengl.GLuint;
+
+import java.nio.IntBuffer;
+
+@Extension(postfix = "")
+public interface ARB_shader_atomic_counters {
+
+ /** Accepted by the <target> parameter of BindBufferBase and BindBufferRange: */
+ int GL_ATOMIC_COUNTER_BUFFER = 0x92C0;
+
+ /**
+ * Accepted by the <pname> parameter of GetBooleani_v, GetIntegeri_v,
+ * GetFloati_v, GetDoublei_v, GetInteger64i_v, GetBooleanv, GetIntegerv,
+ * GetInteger64v, GetFloatv, GetDoublev, and GetActiveAtomicCounterBufferiv:
+ */
+ int GL_ATOMIC_COUNTER_BUFFER_BINDING = 0x92C1;
+
+ /** Accepted by the <pname> parameter of GetIntegeri_64v: */
+ int GL_ATOMIC_COUNTER_BUFFER_START = 0x92C2,
+ GL_ATOMIC_COUNTER_BUFFER_SIZE = 0x92C3;
+
+ /** Accepted by the <pname> parameter of GetActiveAtomicCounterBufferiv: */
+ int GL_ATOMIC_COUNTER_BUFFER_DATA_SIZE = 0x92C4,
+ GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTERS = 0x92C5,
+ GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTER_INDICES = 0x92C6,
+ GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_VERTEX_SHADER = 0x92C7,
+ GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_CONTROL_SHADER = 0x92C8,
+ GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_EVALUATION_SHADER = 0x92C9,
+ GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_GEOMETRY_SHADER = 0x92CA,
+ GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_FRAGMENT_SHADER = 0x92CB;
+
+ /**
+ * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv,
+ * GetInteger64v, GetFloatv, and GetDoublev:
+ */
+ int GL_MAX_VERTEX_ATOMIC_COUNTER_BUFFERS = 0x92CC,
+ GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS = 0x92CD,
+ GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS = 0x92CE,
+ GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS = 0x92CF,
+ GL_MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS = 0x92D0,
+ GL_MAX_COMBINED_ATOMIC_COUNTER_BUFFERS = 0x92D1,
+ GL_MAX_VERTEX_ATOMIC_COUNTERS = 0x92D2,
+ GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS = 0x92D3,
+ GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS = 0x92D4,
+ GL_MAX_GEOMETRY_ATOMIC_COUNTERS = 0x92D5,
+ GL_MAX_FRAGMENT_ATOMIC_COUNTERS = 0x92D6,
+ GL_MAX_COMBINED_ATOMIC_COUNTERS = 0x92D7,
+ GL_MAX_ATOMIC_COUNTER_BUFFER_SIZE = 0x92D8,
+ GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS = 0x92DC;
+
+ /** Accepted by the <pname> parameter of GetProgramiv: */
+ int GL_ACTIVE_ATOMIC_COUNTER_BUFFERS = 0x92D9;
+
+ /** Accepted by the <pname> parameter of GetActiveUniformsiv: */
+ int GL_UNIFORM_ATOMIC_COUNTER_BUFFER_INDEX = 0x92DA;
+
+ /** Returned in <params> by GetActiveUniform and GetActiveUniformsiv: */
+ int GL_UNSIGNED_INT_ATOMIC_COUNTER = 0x92DB;
+
+ @StripPostfix("params")
+ @Reuse("GL42")
+ void glGetActiveAtomicCounterBufferiv(@GLuint int program, @GLuint int bufferIndex, @GLenum int pname, @Check("1") @OutParameter IntBuffer params);
+
+ @Alternate("glGetActiveAtomicCounterBufferiv")
+ @StripPostfix("params")
+ @GLreturn("params")
+ @Reuse("GL42")
+ void glGetActiveAtomicCounterBufferiv2(@GLuint int program, @GLuint int bufferIndex, @GLenum int pname, @OutParameter IntBuffer params);
+
+}
\ No newline at end of file
Added: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shader_image_load_store.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shader_image_load_store.java (rev 0)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shader_image_load_store.java 2011-08-08 10:48:14 UTC (rev 3605)
@@ -0,0 +1,135 @@
+/*
+ * Copyright (c) 2002-2011 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.opengl;
+
+import org.lwjgl.util.generator.Reuse;
+import org.lwjgl.util.generator.opengl.GLbitfield;
+import org.lwjgl.util.generator.opengl.GLenum;
+import org.lwjgl.util.generator.opengl.GLuint;
+
+public interface ARB_shader_image_load_store {
+
+ /**
+ * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv,
+ * GetFloatv, GetDoublev, and GetInteger64v:
+ */
+ int GL_MAX_IMAGE_UNITS = 0x8F38,
+ GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS = 0x8F39,
+ GL_MAX_IMAGE_SAMPLES = 0x906D,
+ GL_MAX_VERTEX_IMAGE_UNIFORMS = 0x90CA,
+ GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS = 0x90CB,
+ GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS = 0x90CC,
+ GL_MAX_GEOMETRY_IMAGE_UNIFORMS = 0x90CD,
+ GL_MAX_FRAGMENT_IMAGE_UNIFORMS = 0x90CE,
+ GL_MAX_COMBINED_IMAGE_UNIFORMS = 0x90CF;
+
+ /** Accepted by the <target> parameter of GetIntegeri_v and GetBooleani_v: */
+ int GL_IMAGE_BINDING_NAME = 0x8F3A,
+ GL_IMAGE_BINDING_LEVEL = 0x8F3B,
+ GL_IMAGE_BINDING_LAYERED = 0x8F3C,
+ GL_IMAGE_BINDING_LAYER = 0x8F3D,
+ GL_IMAGE_BINDING_ACCESS = 0x8F3E,
+ GL_IMAGE_BINDING_FORMAT = 0x906E;
+
+ /** Accepted by the <barriers> parameter of MemoryBarrier: */
+ int GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT = 0x00000001,
+ GL_ELEMENT_ARRAY_BARRIER_BIT = 0x00000002,
+ GL_UNIFORM_BARRIER_BIT = 0x00000004,
+ GL_TEXTURE_FETCH_BARRIER_BIT = 0x00000008,
+ GL_SHADER_IMAGE_ACCESS_BARRIER_BIT = 0x00000020,
+ GL_COMMAND_BARRIER_BIT = 0x00000040,
+ GL_PIXEL_BUFFER_BARRIER_BIT = 0x00000080,
+ GL_TEXTURE_UPDATE_BARRIER_BIT = 0x00000100,
+ GL_BUFFER_UPDATE_BARRIER_BIT = 0x00000200,
+ GL_FRAMEBUFFER_BARRIER_BIT = 0x00000400,
+ GL_TRANSFORM_FEEDBACK_BARRIER_BIT = 0x00000800,
+ GL_ATOMIC_COUNTER_BARRIER_BIT = 0x00001000,
+ GL_ALL_BARRIER_BITS = 0xFFFFFFFF;
+
+ /** Returned by the <type> parameter of GetActiveUniform: */
+ int GL_IMAGE_1D = 0x904C,
+ GL_IMAGE_2D = 0x904D,
+ GL_IMAGE_3D = 0x904E,
+ GL_IMAGE_2D_RECT = 0x904F,
+ GL_IMAGE_CUBE = 0x9050,
+ GL_IMAGE_BUFFER = 0x9051,
+ GL_IMAGE_1D_ARRAY = 0x9052,
+ GL_IMAGE_2D_ARRAY = 0x9053,
+ GL_IMAGE_CUBE_MAP_ARRAY = 0x9054,
+ GL_IMAGE_2D_MULTISAMPLE = 0x9055,
+ GL_IMAGE_2D_MULTISAMPLE_ARRAY = 0x9056,
+ GL_INT_IMAGE_1D = 0x9057,
+ GL_INT_IMAGE_2D = 0x9058,
+ GL_INT_IMAGE_3D = 0x9059,
+ GL_INT_IMAGE_2D_RECT = 0x905A,
+ GL_INT_IMAGE_CUBE = 0x905B,
+ GL_INT_IMAGE_BUFFER = 0x905C,
+ GL_INT_IMAGE_1D_ARRAY = 0x905D,
+ GL_INT_IMAGE_2D_ARRAY = 0x905E,
+ GL_INT_IMAGE_CUBE_MAP_ARRAY = 0x905F,
+ GL_INT_IMAGE_2D_MULTISAMPLE = 0x9060,
+ GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY = 0x9061,
+ GL_UNSIGNED_INT_IMAGE_1D = 0x9062,
+ GL_UNSIGNED_INT_IMAGE_2D = 0x9063,
+ GL_UNSIGNED_INT_IMAGE_3D = 0x9064,
+ GL_UNSIGNED_INT_IMAGE_2D_RECT = 0x9065,
+ GL_UNSIGNED_INT_IMAGE_CUBE = 0x9066,
+ GL_UNSIGNED_INT_IMAGE_BUFFER = 0x9067,
+ GL_UNSIGNED_INT_IMAGE_1D_ARRAY = 0x9068,
+ GL_UNSIGNED_INT_IMAGE_2D_ARRAY = 0x9069,
+ GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY = 0x906A,
+ GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE = 0x906B,
+ GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY = 0x906C;
+
+ /**
+ * Accepted by the <value> parameter of GetTexParameteriv, GetTexParameterfv,
+ * GetTexParameterIiv, and GetTexParameterIuiv:
+ */
+ int GL_IMAGE_FORMAT_COMPATIBILITY_TYPE = 0x90C7;
+
+ /**
+ * Returned in the <data> parameter of GetTexParameteriv, GetTexParameterfv,
+ * GetTexParameterIiv, and GetTexParameterIuiv when <value> is
+ * IMAGE_FORMAT_COMPATIBILITY_TYPE:
+ */
+ int GL_IMAGE_FORMAT_COMPATIBILITY_BY_SIZE = 0x90C8,
+ IMAGE_FORMAT_COMPATIBILITY_BY_CLASS = 0x90C9;
+
+ @Reuse("GL42")
+ void glBindImageTexture(@GLuint int unit, @GLuint int texture, int level,
+ boolean layered, int layer, @GLenum int access,
+ @GLenum int format);
+
+ @Reuse("GL42")
+ void glMemoryBarrier(@GLbitfield int barriers);
+
+}
\ No newline at end of file
Added: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shading_language_420pack.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shading_language_420pack.java (rev 0)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shading_language_420pack.java 2011-08-08 10:48:14 UTC (rev 3605)
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2002-2011 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.opengl;
+
+public interface ARB_shading_language_420pack {
+
+}
Added: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shading_language_packing.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shading_language_packing.java (rev 0)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shading_language_packing.java 2011-08-08 10:48:14 UTC (rev 3605)
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2002-2011 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.opengl;
+
+public interface ARB_shading_language_packing {
+
+}
Added: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_texture_storage.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_texture_storage.java (rev 0)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_texture_storage.java 2011-08-08 10:48:14 UTC (rev 3605)
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2002-2011 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.opengl;
+
+import org.lwjgl.util.generator.Reuse;
+import org.lwjgl.util.generator.opengl.GLenum;
+import org.lwjgl.util.generator.opengl.GLsizei;
+
+public interface ARB_texture_storage {
+
+ /** Accepted by the <value> parameter of GetTexParameter{if}v: */
+ int GL_TEXTURE_IMMUTABLE_FORMAT = 0x912F;
+
+ @Reuse("GL42")
+ void glTexStorage1D(@GLenum int target, @GLsizei int levels,
+ @GLenum int internalformat,
+ @GLsizei int width);
+
+ @Reuse("GL42")
+ void glTexStorage2D(@GLenum int target, @GLsizei int levels,
+ @GLenum int internalformat,
+ @GLsizei int width, @GLsizei int height);
+
+ @Reuse("GL42")
+ void glTexStorage3D(@GLenum int target, @GLsizei int levels,
+ @GLenum int internalformat,
+ @GLsizei int width, @GLsizei int height, @GLsizei int depth);
+
+}
Added: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_transform_feedback_instanced.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_transform_feedback_instanced.java (rev 0)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_transform_feedback_instanced.java 2011-08-08 10:48:14 UTC (rev 3605)
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2002-2011 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.opengl;
+
+import org.lwjgl.util.generator.Reuse;
+import org.lwjgl.util.generator.opengl.GLenum;
+import org.lwjgl.util.generator.opengl.GLsizei;
+import org.lwjgl.util.generator.opengl.GLuint;
+
+public interface ARB_transform_feedback_instanced {
+
+ @Reuse("GL42")
+ void glDrawTransformFeedbackInstanced(@GLenum int mode, @GLuint int id, @GLsizei int primcount);
+
+ @Reuse("GL42")
+ void glDrawTransformFeedbackStreamInstanced(@GLenum int mode, @GLuint int id, @GLuint int stream, @GLsizei int primcount);
+
+}
\ No newline at end of file
Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_direct_state_access.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_direct_state_access.java 2011-08-06 13:18:49 UTC (rev 3604)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_direct_state_access.java 2011-08-08 10:48:14 UTC (rev 3605)
@@ -520,11 +520,11 @@
value parameters
*/
- @Optional(reason = "AMD does not expose this (last driver checked: 10.9)")
+ @Optional(reason = "AMD does not expose this (last driver checked: 11.7)")
@Dependent("OpenGL30")
void glEnableClientStateiEXT(@GLenum int array, @GLuint int index);
- @Optional(reason = "AMD does not expose this (last driver checked: 10.9)")
+ @Optional(reason = "AMD does not expose this (last driver checked: 11.7)")
@Dependent("OpenGL30")
void glDisableClientStateiEXT(@GLenum int array, @GLuint int index);
@@ -566,7 +566,7 @@
and before state value parameters
*/
- @Optional(reason = "AMD does not expose this (last driver checked: 10.9)")
+ @Optional(reason = "AMD does not expose this (last driver checked: 11.7)")
@Dependent("OpenGL30")
@StripPostfix("params")
void glGetFloati_vEXT(@GLenum int pname, @GLuint int index, @OutParameter @Check("16") FloatBuffer params);
@@ -577,7 +577,7 @@
@StripPostfix("params")
void glGetFloati_vEXT2(@GLenum int pname, @GLuint int index, @OutParameter FloatBuffer params);
- @Optional(reason = "AMD does not expose this (last driver checked: 10.9)")
+ @Optional(reason = "AMD does not expose this (last driver checked: 11.7)")
@Dependent("OpenGL30")
@StripPostfix("params")
void glGetDoublei_vEXT(@GLenum int pname, @GLuint int index, @OutParameter @Check("16") DoubleBuffer params);
@@ -588,7 +588,7 @@
@StripPostfix("params")
void glGetDoublei_vEXT2(@GLenum int pname, @GLuint int index, @OutParameter DoubleBuffer params);
- @Optional(reason = "AMD does not expose this (last driver checked: 10.9)")
+ @Optional(reason = "AMD does not expose this (last driver checked: 11.7)")
@Dependent("OpenGL30")
@StripPostfix(value = "params", hasPostfix = false)
void glGetPointeri_vEXT(@GLenum int pname, @GLuint int index, @Result @GLvoid ByteBuffer params);
Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/GL40.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/GL40.java 2011-08-06 13:18:49 UTC (rev 3604)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/GL40.java 2011-08-08 10:48:14 UTC (rev 3605)
@@ -184,7 +184,6 @@
*/
int GL_MIN_SAMPLE_SHADING_VALUE = 0x8C37;
- @Optional(reason = "AMD does not expose this (last driver checked: 10.9)")
void glMinSampleShading(@GLclampf float value);
// ---------------------------------------------------------------------
Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/GL41.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/GL41.java 2011-08-06 13:18:49 UTC (rev 3604)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/GL41.java 2011-08-08 10:48:14 UTC (rev 3605)
@@ -68,22 +68,17 @@
GL_MEDIUM_INT = 0x8DF4,
GL_HIGH_INT = 0x8DF5;
- @Optional(reason = "Not exposed in ATI Catalyst 10.10c")
void glReleaseShaderCompiler();
- @Optional(reason = "Not exposed in ATI Catalyst 10.10c")
void glShaderBinary(@AutoSize("shaders") @GLsizei int count, @Const @GLuint IntBuffer shaders,
@GLenum int binaryformat, @Const @GLvoid ByteBuffer binary, @AutoSize("binary") @GLsizei int length);
- @Optional(reason = "Not exposed in ATI Catalyst 10.10c")
void glGetShaderPrecisionFormat(@GLenum int shadertype, @GLenum int precisiontype,
@OutParameter @Check("2") IntBuffer range,
@OutParameter @Check("1") IntBuffer precision);
- @Optional(reason = "Not exposed in ATI Catalyst 10.10c")
void glDepthRangef(@GLclampf float n, @GLclampf float f);
- @Optional(reason = "Not exposed in ATI Catalyst 10.10c")
void glClearDepthf(@GLclampf float d);
// ----------------------------------------------------------------------
@@ -360,41 +355,31 @@
int GL_DOUBLE_MAT4x2 = 0x8F4D;
int GL_DOUBLE_MAT4x3 = 0x8F4E;
- @Optional(reason = "Not exposed in ATI Catalyst 10.10c")
void glVertexAttribL1d(@GLuint int index, double x);
- @Optional(reason = "Not exposed in ATI Catalyst 10.10c")
void glVertexAttribL2d(@GLuint int index, double x, double y);
- @Optional(reason = "Not exposed in ATI Catalyst 10.10c")
void glVertexAttribL3d(@GLuint int index, double x, double y, double z);
- @Optional(reason = "Not exposed in ATI Catalyst 10.10c")
void glVertexAttribL4d(@GLuint int index, double x, double y, double z, double w);
- @Optional(reason = "Not exposed in ATI Catalyst 10.10c")
@StripPostfix("v")
void glVertexAttribL1dv(@GLuint int index, @Const @Check("1") DoubleBuffer v);
- @Optional(reason = "Not exposed in ATI Catalyst 10.10c")
@StripPostfix("v")
void glVertexAttribL2dv(@GLuint int index, @Const @Check("2") DoubleBuffer v);
- @Optional(reason = "Not exposed in ATI Catalyst 10.10c")
@StripPostfix("v")
void glVertexAttribL3dv(@GLuint int index, @Const @Check("3") DoubleBuffer v);
- @Optional(reason = "Not exposed in ATI Catalyst 10.10c")
@StripPostfix("v")
void glVertexAttribL4dv(@GLuint int index, @Const @Check("4") DoubleBuffer v);
- @Optional(reason = "Not exposed in ATI Catalyst 10.10c")
void glVertexAttribLPointer(@GLuint int index, int size, @Constant("GL11.GL_DOUBLE") @GLenum int type, @GLsizei int stride,
@CachedReference(index = "index", name = "glVertexAttribPointer_buffer")
@BufferObject(BufferKind.ArrayVBO)
@Check @Const @GLdouble Buffer pointer);
- @Optional(reason = "Not exposed in ATI Catalyst 10.10c")
@StripPostfix("params")
void glGetVertexAttribLdv(@GLuint int index, @GLenum int pname, @OutParameter @Check("4") DoubleBuffer params);
Added: trunk/LWJGL/src/templates/org/lwjgl/opengl/GL42.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/GL42.java (rev 0)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/GL42.java 2011-08-08 10:48:14 UTC (rev 3605)
@@ -0,0 +1,321 @@
+/*
+ * Copyright (c) 2002-2011 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.opengl;
+
+import org.lwjgl.util.generator.*;
+import org.lwjgl.util.generator.opengl.*;
+
+import java.nio.Buffer;
+import java.nio.IntBuffer;
+
+public interface GL42 {
+
+ // ----------------------------------------------------------------------------
+ // ----------------------[ ARB_texture_compression_bptc ]----------------------
+ // ----------------------------------------------------------------------------
+
+ /**
+ * Accepted by the <internalformat> parameter of TexImage2D, TexImage3D,
+ * CopyTexImage2D, CopyTexImage3D, CompressedTexImage2DARB, and
+ * CompressedTexImage3DARB and the <format> parameter of
+ * CompressedTexSubImage2DARB and CompressedTexSubImage3DARB:
+ */
+ int GL_COMPRESSED_RGBA_BPTC_UNORM = 0x8E8C;
+ int GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM = 0x8E8D;
+ int GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT = 0x8E8E;
+ int GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT = 0x8E8F;
+
+ // ------------------------------------------------------------------------------------
+ // ----------------------[ ARB_compressed_texture_pixel_storage ]----------------------
+ // ------------------------------------------------------------------------------------
+
+ /**
+ * Accepted by the <pname> parameter of PixelStore[fi], GetBooleanv,
+ * GetIntegerv, GetInteger64v, GetFloatv, and GetDoublev:
+ */
+ int GL_UNPACK_COMPRESSED_BLOCK_WIDTH = 0x9127,
+ GL_UNPACK_COMPRESSED_BLOCK_HEIGHT = 0x9128,
+ GL_UNPACK_COMPRESSED_BLOCK_DEPTH = 0x9129,
+ GL_UNPACK_COMPRESSED_BLOCK_SIZE = 0x912A,
+ GL_PACK_COMPRESSED_BLOCK_WIDTH = 0x912B,
+ GL_PACK_COMPRESSED_BLOCK_HEIGHT = 0x912C,
+ GL_PACK_COMPRESSED_BLOCK_DEPTH = 0x912D,
+ GL_PACK_COMPRESSED_BLOCK_SIZE = 0x912E;
+
+ // --------------------------------------------------------------------------
+ // ----------------------[ ARB_shader_atomic_counters ]----------------------
+ // --------------------------------------------------------------------------
+
+ /** Accepted by the <target> parameter of BindBufferBase and BindBufferRange: */
+ int GL_ATOMIC_COUNTER_BUFFER = 0x92C0;
+
+ /**
+ * Accepted by the <pname> parameter of GetBooleani_v, GetIntegeri_v,
+ * GetFloati_v, GetDoublei_v, GetInteger64i_v, GetBooleanv, GetIntegerv,
+ * GetInteger64v, GetFloatv, GetDoublev, and GetActiveAtomicCounterBufferiv:
+ */
+ int GL_ATOMIC_COUNTER_BUFFER_BINDING = 0x92C1;
+
+ /** Accepted by the <pname> parameter of GetIntegeri_64v: */
+ int GL_ATOMIC_COUNTER_BUFFER_START = 0x92C2,
+ GL_ATOMIC_COUNTER_BUFFER_SIZE = 0x92C3;
+
+ /** Accepted by the <pname> parameter of GetActiveAtomicCounterBufferiv: */
+ int GL_ATOMIC_COUNTER_BUFFER_DATA_SIZE = 0x92C4,
+ GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTERS = 0x92C5,
+ GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTER_INDICES = 0x92C6,
+ GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_VERTEX_SHADER = 0x92C7,
+ GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_CONTROL_SHADER = 0x92C8,
+ GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_EVALUATION_SHADER = 0x92C9,
+ GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_GEOMETRY_SHADER = 0x92CA,
+ GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_FRAGMENT_SHADER = 0x92CB;
+
+ /**
+ * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv,
+ * GetInteger64v, GetFloatv, and GetDoublev:
+ */
+ int GL_MAX_VERTEX_ATOMIC_COUNTER_BUFFERS = 0x92CC,
+ GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS = 0x92CD,
+ GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS = 0x92CE,
+ GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS = 0x92CF,
+ GL_MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS = 0x92D0,
+ GL_MAX_COMBINED_ATOMIC_COUNTER_BUFFERS = 0x92D1,
+ GL_MAX_VERTEX_ATOMIC_COUNTERS = 0x92D2,
+ GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS = 0x92D3,
+ GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS = 0x92D4,
+ GL_MAX_GEOMETRY_ATOMIC_COUNTERS = 0x92D5,
+ GL_MAX_FRAGMENT_ATOMIC_COUNTERS = 0x92D6,
+ GL_MAX_COMBINED_ATOMIC_COUNTERS = 0x92D7,
+ GL_MAX_ATOMIC_COUNTER_BUFFER_SIZE = 0x92D8,
+ GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS = 0x92DC;
+
+ /** Accepted by the <pname> parameter of GetProgramiv: */
+ int GL_ACTIVE_ATOMIC_COUNTER_BUFFERS = 0x92D9;
+
+ /** Accepted by the <pname> parameter of GetActiveUniformsiv: */
+ int GL_UNIFORM_ATOMIC_COUNTER_BUFFER_INDEX = 0x92DA;
+
+ /** Returned in <params> by GetActiveUniform and GetActiveUniformsiv: */
+ int GL_UNSIGNED_INT_ATOMIC_COUNTER = 0x92DB;
+
+ @StripPostfix("params")
+ void glGetActiveAtomicCounterBufferiv(@GLuint int program, @GLuint int bufferIndex, @GLenum int pname, @Check("1") @OutParameter IntBuffer params);
+
+ @Alternate("glGetActiveAtomicCounterBufferiv")
+ @StripPostfix("params")
+ @GLreturn("params")
+ void glGetActiveAtomicCounterBufferiv2(@GLuint int program, @GLuint int bufferIndex, @GLenum int pname, @OutParameter IntBuffer params);
+
+ // -------------------------------------------------------------------
+ // ----------------------[ ARB_texture_storage ]----------------------
+ // -------------------------------------------------------------------
+
+ /** Accepted by the <value> parameter of GetTexParameter{if}v: */
+ int GL_TEXTURE_IMMUTABLE_FORMAT = 0x912F;
+
+ void glTexStorage1D(@GLenum int target, @GLsizei int levels,
+ @GLenum int internalformat,
+ @GLsizei int width);
+
+ void glTexStorage2D(@GLenum int target, @GLsizei int levels,
+ @GLenum int internalformat,
+ @GLsizei int width, @GLsizei int height);
+
+ void glTexStorage3D(@GLenum int target, @GLsizei int levels,
+ @GLenum int internalformat,
+ @GLsizei int width, @GLsizei int height, @GLsizei int depth);
+
+ // --------------------------------------------------------------------------------
+ // ----------------------[ ARB_transform_feedback_instanced ]----------------------
+ // --------------------------------------------------------------------------------
+
+ void glDrawTransformFeedbackInstanced(@GLenum int mode, @GLuint int id, @GLsizei int primcount);
+
+ void glDrawTransformFeedbackStreamInstanced(@GLenum int mode, @GLuint int id, @GLuint int stream, @GLsizei int primcount);
+
+ // -----------------------------------------------------------------
+ // ----------------------[ ARB_base_instance ]----------------------
+ // -----------------------------------------------------------------
+
+ void glDrawArraysInstancedBaseInstance(@GLenum int mode,
+ int first,
+ @GLsizei int count,
+ @GLsizei int primcount,
+ @GLuint int baseinstance);
+
+ void glDrawElementsInstancedBaseInstance(@GLenum int mode,
+ @AutoSize("indices") @GLsizei int count,
+ @AutoType("indices") @GLenum int type,
+ @Const
+ @BufferObject(BufferKind.ElementVBO)
+ @GLubyte
+ @GLushort
+ @GLuint Buffer indices,
+ @GLsizei int primcount,
+ @GLuint int baseinstance);
+
+ void glDrawElementsInstancedBaseVertexBaseInstance(@GLenum int mode,
+ @AutoSize("indices") @GLsizei int count,
+ @AutoType("indices") @GLenum int type,
+ @Const
+ @BufferObject(BufferKind.ElementVBO)
+ @GLubyte
+ @GLushort
+ @GLuint Buffer indices,
+ @GLsizei int primcount,
+ int basevertex,
+ @GLuint int baseinstance);
+
+ // ---------------------------------------------------------------------------
+ // ----------------------[ ARB_shader_image_load_store ]----------------------
+ // ---------------------------------------------------------------------------
+
+ /**
+ * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv,
+ * GetFloatv, GetDoublev, and GetInteger64v:
+ */
+ int GL_MAX_IMAGE_UNITS = 0x8F38,
+ GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS = 0x8F39,
+ GL_MAX_IMAGE_SAMPLES = 0x906D,
+ GL_MAX_VERTEX_IMAGE_UNIFORMS = 0x90CA,
+ GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS = 0x90CB,
+ GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS = 0x90CC,
+ GL_MAX_GEOMETRY_IMAGE_UNIFORMS = 0x90CD,
+ GL_MAX_FRAGMENT_IMAGE_UNIFORMS = 0x90CE,
+ GL_MAX_COMBINED_IMAGE_UNIFORMS = 0x90CF;
+
+ /** Accepted by the <target> parameter of GetIntegeri_v and GetBooleani_v: */
+ int GL_IMAGE_BINDING_NAME = 0x8F3A,
+ GL_IMAGE_BINDING_LEVEL = 0x8F3B,
+ GL_IMAGE_BINDING_LAYERED = 0x8F3C,
+ GL_IMAGE_BINDING_LAYER = 0x8F3D,
+ GL_IMAGE_BINDING_ACCESS = 0x8F3E,
+ GL_IMAGE_BINDING_FORMAT = 0x906E;
+
+ /** Accepted by the <barriers> parameter of MemoryBarrier: */
+ int GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT = 0x00000001,
+ GL_ELEMENT_ARRAY_BARRIER_BIT = 0x00000002,
+ GL_UNIFORM_BARRIER_BIT = 0x00000004,
+ GL_TEXTURE_FETCH_BARRIER_BIT = 0x00000008,
+ GL_SHADER_IMAGE_ACCESS_BARRIER_BIT = 0x00000020,
+ GL_COMMAND_BARRIER_BIT = 0x00000040,
+ GL_PIXEL_BUFFER_BARRIER_BIT = 0x00000080,
+ GL_TEXTURE_UPDATE_BARRIER_BIT = 0x00000100,
+ GL_BUFFER_UPDATE_BARRIER_BIT = 0x00000200,
+ GL_FRAMEBUFFER_BARRIER_BIT = 0x00000400,
+ GL_TRANSFORM_FEEDBACK_BARRIER_BIT = 0x00000800,
+ GL_ATOMIC_COUNTER_BARRIER_BIT = 0x00001000,
+ GL_ALL_BARRIER_BITS = 0xFFFFFFFF;
+
+ /** Returned by the <type> parameter of GetActiveUniform: */
+ int GL_IMAGE_1D = 0x904C,
+ GL_IMAGE_2D ...
[truncated message content] |
|
From: <ka...@us...> - 2011-08-06 13:18:55
|
Revision: 3604
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3604&view=rev
Author: kappa1
Date: 2011-08-06 13:18:49 +0000 (Sat, 06 Aug 2011)
Log Message:
-----------
Fix issue with Linux and Java 7 where libjawt.so was failing to load.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/LinuxSysImplementation.java
Modified: trunk/LWJGL/src/java/org/lwjgl/LinuxSysImplementation.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/LinuxSysImplementation.java 2011-08-02 23:45:19 UTC (rev 3603)
+++ trunk/LWJGL/src/java/org/lwjgl/LinuxSysImplementation.java 2011-08-06 13:18:49 UTC (rev 3604)
@@ -31,6 +31,10 @@
*/
package org.lwjgl;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.security.PrivilegedExceptionAction;
+import java.lang.UnsatisfiedLinkError;
/**
*
@@ -42,7 +46,21 @@
private static final int JNI_VERSION = 19;
static {
- java.awt.Toolkit.getDefaultToolkit(); // This will make sure libjawt.so is loaded
+ // Load libawt.so and libmawt.so, needed for libjawt.so
+ java.awt.Toolkit.getDefaultToolkit();
+
+ // manually load libjawt.so into vm, needed since Java 7
+ AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ public Object run() {
+ try {
+ System.loadLibrary("jawt");
+ } catch (UnsatisfiedLinkError e) {
+ // catch and ignore an already loaded in another classloader
+ // exception, as vm already has it loaded
+ }
+ return null;
+ }
+ });
}
public int getRequiredJNIVersion() {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2011-08-02 23:45:26
|
Revision: 3603
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3603&view=rev
Author: spasi
Date: 2011-08-02 23:45:19 +0000 (Tue, 02 Aug 2011)
Log Message:
-----------
CL: Cleaned-up callbacks and object registries.
Mapped: Added .capacity() and .foreach() with default elementCount.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/opencl/CLBuildProgramCallback.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/CLEvent.java
trunk/LWJGL/src/java/org/lwjgl/opencl/CLEventCallback.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/CLPlatform.java
trunk/LWJGL/src/java/org/lwjgl/test/mapped/MappedObjectTests1.java
trunk/LWJGL/src/java/org/lwjgl/test/mapped/MappedObjectTests3.java
trunk/LWJGL/src/java/org/lwjgl/test/opencl/HelloOpenCL.java
trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedObject.java
trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedObjectTransformer.java
trunk/LWJGL/src/templates/org/lwjgl/opencl/CL10.java
trunk/LWJGL/src/templates/org/lwjgl/opencl/CL11.java
Removed Paths:
-------------
trunk/LWJGL/src/java/org/lwjgl/opencl/CLCallback.java
trunk/LWJGL/src/java/org/lwjgl/opencl/CLObjectRegistryGlobal.java
Modified: trunk/LWJGL/src/java/org/lwjgl/opencl/CLBuildProgramCallback.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opencl/CLBuildProgramCallback.java 2011-07-29 11:30:14 UTC (rev 3602)
+++ trunk/LWJGL/src/java/org/lwjgl/opencl/CLBuildProgramCallback.java 2011-08-02 23:45:19 UTC (rev 3603)
@@ -31,24 +31,39 @@
*/
package org.lwjgl.opencl;
+import org.lwjgl.PointerWrapperAbstract;
+
/**
* Instances of this class can be used to receive OpenCL program build notifications.
+ * A single CLBuildProgramCallback instance should only be used with programs created
+ * in the same CLContext.
*
* @author Spasi
*/
-public abstract class CLBuildProgramCallback extends CLCallback {
+public abstract class CLBuildProgramCallback extends PointerWrapperAbstract {
+ private CLContext context;
+
protected CLBuildProgramCallback() {
super(CallbackUtil.getBuildProgramCallback());
}
/**
+ * Sets the context that contains the CLPrograms to which we're registered.
+ *
+ * @param context the CLContext object
+ */
+ void setContext(final CLContext context) {
+ this.context = context;
+ }
+
+ /**
* Called from native code.
*
* @param program_address the CLProgram object pointer
*/
private void handleMessage(long program_address) {
- handleMessage(CLContext.getCLProgramGlobal(program_address));
+ handleMessage(context.getCLProgram(program_address));
}
/**
Deleted: trunk/LWJGL/src/java/org/lwjgl/opencl/CLCallback.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opencl/CLCallback.java 2011-07-29 11:30:14 UTC (rev 3602)
+++ trunk/LWJGL/src/java/org/lwjgl/opencl/CLCallback.java 2011-08-02 23:45:19 UTC (rev 3603)
@@ -1,59 +0,0 @@
-/*
- * 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.PointerWrapperAbstract;
-
-/**
- * Base class for OpenCL callback objects.
- *
- * @author Spasi
- */
-abstract class CLCallback extends PointerWrapperAbstract {
-
- private final boolean custom;
-
- protected CLCallback(final long pointer) {
- this(pointer, false);
- }
-
- protected CLCallback(final long pointer, final boolean custom) {
- super(pointer);
-
- this.custom = custom;
- }
-
- final boolean isCustom() {
- return custom;
- }
-
-}
\ No newline at end of file
Modified: trunk/LWJGL/src/java/org/lwjgl/opencl/CLCommandQueue.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opencl/CLCommandQueue.java 2011-07-29 11:30:14 UTC (rev 3602)
+++ trunk/LWJGL/src/java/org/lwjgl/opencl/CLCommandQueue.java 2011-08-02 23:45:19 UTC (rev 3603)
@@ -50,7 +50,7 @@
super(pointer, context);
if ( isValid() ) {
this.device = device;
- this.clEvents = new CLObjectRegistryGlobal<CLEvent>(CLContext.clEventsGlobal);
+ this.clEvents = new CLObjectRegistry<CLEvent>();
context.getCLCommandQueueRegistry().registerObject(this);
} else {
this.device = null;
Modified: trunk/LWJGL/src/java/org/lwjgl/opencl/CLContext.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opencl/CLContext.java 2011-07-29 11:30:14 UTC (rev 3602)
+++ trunk/LWJGL/src/java/org/lwjgl/opencl/CLContext.java 2011-08-02 23:45:19 UTC (rev 3603)
@@ -54,12 +54,6 @@
private final CLObjectRegistry<CLProgram> clPrograms;
private final CLObjectRegistry<CLEvent> clEvents;
- /** Global registry for build callbacks. */
- static final FastLongMap<CLProgram> clProgramsGlobal = new FastLongMap<CLProgram>();
-
- /** Global registry for event callbacks. */
- static final FastLongMap<CLEvent> clEventsGlobal = new FastLongMap<CLEvent>();
-
CLContext(final long pointer, final CLPlatform platform) {
super(pointer, platform);
@@ -70,8 +64,8 @@
clCommandQueues = new CLObjectRegistry<CLCommandQueue>();
clMems = new CLObjectRegistry<CLMem>();
clSamplers = new CLObjectRegistry<CLSampler>();
- clPrograms = new CLObjectRegistryGlobal<CLProgram>(clProgramsGlobal);
- clEvents = new CLObjectRegistryGlobal<CLEvent>(clEventsGlobal);
+ clPrograms = new CLObjectRegistry<CLProgram>();
+ clEvents = new CLObjectRegistry<CLEvent>();
} else {
clCommandQueues = null;
clMems = null;
@@ -275,8 +269,4 @@
CLObjectRegistry<CLEvent> getCLEventRegistry() { return clEvents; }
- static CLProgram getCLProgramGlobal(final long id) { return clProgramsGlobal.get(id); }
-
- static CLEvent getCLEventGlobal(final long id) { return clEventsGlobal.get(id); }
-
}
\ No newline at end of file
Modified: trunk/LWJGL/src/java/org/lwjgl/opencl/CLEvent.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opencl/CLEvent.java 2011-07-29 11:30:14 UTC (rev 3602)
+++ trunk/LWJGL/src/java/org/lwjgl/opencl/CLEvent.java 2011-08-02 23:45:19 UTC (rev 3603)
@@ -108,6 +108,13 @@
// -------[ IMPLEMENTATION STUFF BELOW ]-------
+ CLObjectRegistry<CLEvent> getParentRegistry() {
+ if ( queue == null )
+ return getParent().getCLEventRegistry();
+ else
+ return queue.getCLEventRegistry();
+ }
+
int release() {
try {
return super.release();
Modified: trunk/LWJGL/src/java/org/lwjgl/opencl/CLEventCallback.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opencl/CLEventCallback.java 2011-07-29 11:30:14 UTC (rev 3602)
+++ trunk/LWJGL/src/java/org/lwjgl/opencl/CLEventCallback.java 2011-08-02 23:45:19 UTC (rev 3603)
@@ -31,30 +31,46 @@
*/
package org.lwjgl.opencl;
+import org.lwjgl.PointerWrapperAbstract;
+
/**
- * Instances of this class can be used to receive OpenCL memory object destruction notifications.
+ * Instances of this class can be used to handle OpenCL event callbacks. A single
+ * CLEventCallback instance should only be used on events generated from the same
+ * CLCommandQueue or on user events associated with the same CLContext.
*
* @author Spasi
*/
-public abstract class CLEventCallback extends CLCallback {
+public abstract class CLEventCallback extends PointerWrapperAbstract {
+ private CLObjectRegistry<CLEvent> eventRegistry;
+
protected CLEventCallback() {
super(CallbackUtil.getEventCallback());
}
/**
+ * Sets the eventRegistry that contains the CLEvents to which we're registered.
+ *
+ * @param eventRegistry the CLEvent object registry
+ */
+ void setRegistry(final CLObjectRegistry<CLEvent> eventRegistry) {
+ this.eventRegistry = eventRegistry;
+ }
+
+ /**
* Called from native code.
*
* @param event_address the CLEvent object pointer
*/
private void handleMessage(long event_address, int event_command_exec_status) {
- handleMessage(CLContext.getCLEventGlobal(event_address), event_command_exec_status);
+ handleMessage(eventRegistry.getObject(event_address), event_command_exec_status);
}
/**
* The callback method.
*
- * @param event the CLEvent object
+ * @param event the CLEvent object
+ * @param event_command_exec_status the execution status
*/
protected abstract void handleMessage(CLEvent event, int event_command_exec_status);
Modified: trunk/LWJGL/src/java/org/lwjgl/opencl/CLMemObjectDestructorCallback.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opencl/CLMemObjectDestructorCallback.java 2011-07-29 11:30:14 UTC (rev 3602)
+++ trunk/LWJGL/src/java/org/lwjgl/opencl/CLMemObjectDestructorCallback.java 2011-08-02 23:45:19 UTC (rev 3603)
@@ -31,12 +31,14 @@
*/
package org.lwjgl.opencl;
+import org.lwjgl.PointerWrapperAbstract;
+
/**
* Instances of this class can be used to receive OpenCL memory object destruction notifications.
*
* @author Spasi
*/
-public abstract class CLMemObjectDestructorCallback extends CLCallback {
+public abstract class CLMemObjectDestructorCallback extends PointerWrapperAbstract {
protected CLMemObjectDestructorCallback() {
super(CallbackUtil.getMemObjectDestructorCallback());
Modified: trunk/LWJGL/src/java/org/lwjgl/opencl/CLNativeKernel.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opencl/CLNativeKernel.java 2011-07-29 11:30:14 UTC (rev 3602)
+++ trunk/LWJGL/src/java/org/lwjgl/opencl/CLNativeKernel.java 2011-08-02 23:45:19 UTC (rev 3603)
@@ -31,6 +31,8 @@
*/
package org.lwjgl.opencl;
+import org.lwjgl.PointerWrapperAbstract;
+
import java.nio.ByteBuffer;
/**
@@ -43,7 +45,7 @@
* @see CL10#clEnqueueNativeKernel
* @see #execute(java.nio.ByteBuffer[])
*/
-public abstract class CLNativeKernel extends CLCallback {
+public abstract class CLNativeKernel extends PointerWrapperAbstract {
protected CLNativeKernel() {
super(CallbackUtil.getNativeKernelCallback());
Deleted: trunk/LWJGL/src/java/org/lwjgl/opencl/CLObjectRegistryGlobal.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opencl/CLObjectRegistryGlobal.java 2011-07-29 11:30:14 UTC (rev 3602)
+++ trunk/LWJGL/src/java/org/lwjgl/opencl/CLObjectRegistryGlobal.java 2011-08-02 23:45:19 UTC (rev 3603)
@@ -1,57 +0,0 @@
-/*
- * 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;
-
-/**
- * A CLObject registry that also registers/unregisters objects to/from a global registry.
- *
- * @author Spasi
- */
-final class CLObjectRegistryGlobal<T extends CLObjectChild> extends CLObjectRegistry<T> {
-
- private final FastLongMap<T> globalRegistry;
-
- CLObjectRegistryGlobal(final FastLongMap<T> globalRegistry) {
- this.globalRegistry = globalRegistry;
- }
-
- void registerObject(final T object) {
- super.registerObject(object);
- globalRegistry.put(object.getPointer(), object);
- }
-
- void unregisterObject(final T object) {
- super.unregisterObject(object);
- globalRegistry.remove(object.getPointerUnsafe());
- }
-
-}
\ No newline at end of file
Modified: trunk/LWJGL/src/java/org/lwjgl/opencl/CLPlatform.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opencl/CLPlatform.java 2011-07-29 11:30:14 UTC (rev 3602)
+++ trunk/LWJGL/src/java/org/lwjgl/opencl/CLPlatform.java 2011-08-02 23:45:19 UTC (rev 3603)
@@ -53,9 +53,6 @@
private final CLObjectRegistry<CLDevice> clDevices;
- /** Global registry for build callbacks. */
- static final FastLongMap<CLDevice> clDevicesGlobal = new FastLongMap<CLDevice>();
-
private Object caps;
CLPlatform(final long pointer) {
@@ -63,7 +60,7 @@
if ( isValid() ) {
clPlatforms.put(pointer, this);
- clDevices = new CLObjectRegistryGlobal<CLDevice>(clDevicesGlobal);
+ clDevices = new CLObjectRegistry<CLDevice>();
} else
clDevices = null;
}
@@ -195,8 +192,6 @@
CLObjectRegistry<CLDevice> getCLDeviceRegistry() { return clDevices; }
- static CLDevice getCLDeviceGlobal(final long id) { return clDevicesGlobal.get(id); }
-
/**
* Called from <code>clGetDeviceIDs</code> to register new devices.
*
Modified: trunk/LWJGL/src/java/org/lwjgl/test/mapped/MappedObjectTests1.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/test/mapped/MappedObjectTests1.java 2011-07-29 11:30:14 UTC (rev 3602)
+++ trunk/LWJGL/src/java/org/lwjgl/test/mapped/MappedObjectTests1.java 2011-08-02 23:45:19 UTC (rev 3603)
@@ -55,13 +55,20 @@
ByteBuffer bb = ByteBuffer.allocateDirect(200);
MappedFloat vecs = MappedFloat.map(bb);
- // verify 'malloc' and SIZEOF
+ // verify 'malloc', SIZEOF and capacity()
{
MappedFloat vecs1 = MappedFloat.malloc(1234);
assert (vecs1.getSizeof() == MappedFloat.SIZEOF);
assert (vecs1.getSizeof() * 1234 == vecs1.backingByteBuffer().capacity());
assert (MappedFloat.SIZEOF * 1234 == vecs1.backingByteBuffer().capacity());
+ assert(vecs1.capacity() == vecs1.backingByteBuffer().capacity() / MappedFloat.SIZEOF);
+
+ ByteBuffer buf = ByteBuffer.allocateDirect(200);
+ buf.position(10 * MappedFloat.SIZEOF);
+
+ MappedFloat vecs2 = MappedFloat.map(buf);
+ assert(vecs2.capacity() == (vecs2.backingByteBuffer().capacity() / MappedFloat.SIZEOF) - 10);
}
// manipulate 'mapped.value'
Modified: trunk/LWJGL/src/java/org/lwjgl/test/mapped/MappedObjectTests3.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/test/mapped/MappedObjectTests3.java 2011-07-29 11:30:14 UTC (rev 3602)
+++ trunk/LWJGL/src/java/org/lwjgl/test/mapped/MappedObjectTests3.java 2011-08-02 23:45:19 UTC (rev 3603)
@@ -70,15 +70,21 @@
}
static void testForeach() {
- int elementCount = 4;
+ int elementCount = 10;
MappedSomething some = MappedSomething.malloc(elementCount);
int i = 0;
- for ( MappedSomething item : foreach(some, elementCount) ) {
+ for ( MappedSomething item : foreach(some, elementCount / 2) ) {
assert (item.view == i++);
}
- assert (some.view != elementCount);
- System.out.println("current.view=" + some.view + ", not " + elementCount + ", as you might expect");
+ assert (some.view == (elementCount / 2) - 1);
+ System.out.println("current.view=" + some.view + ", not " + (elementCount / 2) + ", as you might expect");
+
+ i = 0;
+ for ( MappedSomething item : foreach(some) ) {
+ assert (item.view == i++);
+ }
+ assert (some.view == elementCount - 1);
}
public static class Xyz extends MappedObject {
Modified: trunk/LWJGL/src/java/org/lwjgl/test/opencl/HelloOpenCL.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/test/opencl/HelloOpenCL.java 2011-07-29 11:30:14 UTC (rev 3602)
+++ trunk/LWJGL/src/java/org/lwjgl/test/opencl/HelloOpenCL.java 2011-08-02 23:45:19 UTC (rev 3603)
@@ -143,23 +143,41 @@
System.out.println("-TRYING TO EXEC NATIVE KERNEL-");
final CLCommandQueue queue = clCreateCommandQueue(context, device, 0, null);
+ final PointerBuffer ev = BufferUtils.createPointerBuffer(1);
+
clEnqueueNativeKernel(queue, new CLNativeKernel() {
protected void execute(final ByteBuffer[] memobjs) {
- if ( memobjs == null )
- System.out.println("OK, it's null");
- else {
- System.out.println("memobjs = " + memobjs.length);
- for ( int k = 0; k < memobjs.length; k++ ) {
- System.out.println("memobjs[" + k + "].remaining() = " + memobjs[k].remaining());
- for ( int l = memobjs[k].position(); l < memobjs[k].limit(); l++ ) {
- memobjs[k].put(l, (byte)l);
- }
+ System.out.println("\tmemobjs.length = " + memobjs.length);
+ for ( int k = 0; k < memobjs.length; k++ ) {
+ System.out.println("\tmemobjs[" + k + "].remaining() = " + memobjs[k].remaining());
+ for ( int l = memobjs[k].position(); l < memobjs[k].limit(); l++ ) {
+ memobjs[k].put(l, (byte)l);
}
}
+ System.out.println("\tNative kernel done.");
}
- }, new CLMem[] { buffer }, new long[] { 128 }, null, null);
+ }, new CLMem[] { buffer }, new long[] { 128 }, null, ev);
- clFinish(queue);
+ final CLEvent e = queue.getCLEvent(ev.get(0));
+
+ clSetEventCallback(e, CL_COMPLETE, new CLEventCallback() {
+ protected void handleMessage(final CLEvent event, final int event_command_exec_status) {
+ System.out.println("\t\tEvent callback status: " + getEventStatusName(event_command_exec_status));
+ }
+ });
+
+ int status = e.getInfoInt(CL_EVENT_COMMAND_EXECUTION_STATUS);
+ System.out.println("NATIVE KERNEL STATUS: " + getEventStatusName(status));
+ clFlush(queue);
+ do {
+ int newStatus = e.getInfoInt(CL_EVENT_COMMAND_EXECUTION_STATUS);
+ if ( newStatus != status ) {
+ status = newStatus;
+ System.out.println("NATIVE KERNEL STATUS: " + getEventStatusName(status));
+ }
+ } while ( status != CL_SUCCESS ); // Busy-spin until we're done
+
+ clReleaseEvent(e);
}
}
@@ -182,6 +200,19 @@
System.out.println("\t" + param_name + " = " + device.getInfoString(param));
}
+ private static String getEventStatusName(final int status) {
+ switch ( status ) {
+ case CL_QUEUED:
+ return "CL_QUEUED";
+ case CL_SUBMITTED:
+ return "CL_SUBMITTED";
+ case CL_RUNNING:
+ return "CL_RUNNING";
+ default:
+ return "CL_COMPLETE";
+ }
+ }
+
private static void die(String kind, String description) {
System.out.println(kind + " error " + description + " occured");
}
Modified: trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedObject.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedObject.java 2011-07-29 11:30:14 UTC (rev 3602)
+++ trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedObject.java 2011-08-02 23:45:19 UTC (rev 3603)
@@ -133,6 +133,16 @@
}
/**
+ * Returns the number of mapped objects that fit in the mapped buffer.
+ *
+ * @return the mapped object capacity
+ */
+ public final int capacity() {
+ // No call-site modification for this, we override in every subclass instead.
+ throw new InternalError("type not registered");
+ }
+
+ /**
* Creates a MappedObject instance, mapping the memory region of the specified direct ByteBuffer.
* <p/>
* The behavior of this (transformed) method does not follow the normal Java behavior.<br>
@@ -200,7 +210,7 @@
/**
* Any code in the default constructor will not run automatically. This method
- * can be used to run execute that code on the current view.
+ * can be used to execute that code on the current view.
*/
public final void runViewConstructor() {
// any method that calls this method will have its call-site modified
@@ -237,6 +247,18 @@
/**
* Creates an {@link Iterable} <MappedObject> that will step through
+ * <code>capacity()</code> views, leaving the <code>view</code> at
+ * the last valid value.<br>
+ * <p/>
+ * For convenience you are encouraged to static-import this specific method:
+ * <code>import static org.lwjgl.util.mapped.MappedObject.foreach;</code>
+ */
+ public static <T extends MappedObject> Iterable<T> foreach(T mapped) {
+ return foreach(mapped, mapped.capacity());
+ }
+
+ /**
+ * Creates an {@link Iterable} <MappedObject> that will step through
* <code>elementCount</code> views, leaving the <code>view</code> at
* the last valid value.<br>
* <p/>
Modified: trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedObjectTransformer.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedObjectTransformer.java 2011-07-29 11:30:14 UTC (rev 3602)
+++ trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedObjectTransformer.java 2011-08-02 23:45:19 UTC (rev 3603)
@@ -32,6 +32,7 @@
package org.lwjgl.util.mapped;
import org.lwjgl.LWJGLUtil;
+import org.lwjgl.MemoryUtil;
import org.objectweb.asm.*;
import org.objectweb.asm.tree.*;
import org.objectweb.asm.tree.analysis.*;
@@ -42,6 +43,7 @@
import java.io.StringWriter;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
+import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.util.HashMap;
import java.util.Map;
@@ -82,9 +84,9 @@
static final String NEXT_METHOD_NAME = "next";
static final String ALIGN_METHOD_NAME = "getAlign";
static final String SIZEOF_METHOD_NAME = "getSizeof";
+ static final String CAPACITY_METHOD_NAME = "capacity"; // Used for .asArray().length
// Internal methods
- static final String LENGTH_METHOD_NAME = "length$LWJGL"; // Used for .asArray().length
static final String VIEW_CONSTRUCTOR_NAME = "constructView$LWJGL"; // Used by runViewConstructor
static final Map<Integer, String> OPCODE_TO_NAME = new HashMap<Integer, String>();
@@ -228,6 +230,7 @@
NEXT_METHOD_NAME,
ALIGN_METHOD_NAME,
SIZEOF_METHOD_NAME,
+ CAPACITY_METHOD_NAME,
};
public MethodVisitor visitMethod(int access, final String name, final String desc, final String signature, final String[] exceptions) {
@@ -285,7 +288,7 @@
final MappedSubtypeInfo mappedSubtype = className_to_subtype.get(className);
generateViewAddressGetter();
- generateLengthGetter();
+ generateCapacity();
generateAlignGetter(mappedSubtype);
generateSizeofGetter();
generateNext();
@@ -329,16 +332,25 @@
mv.visitEnd();
}
- private void generateLengthGetter() {
- MethodVisitor mv = super.visitMethod(ACC_PUBLIC | ACC_STATIC, LENGTH_METHOD_NAME, "(L" + className + ";)I", null, null);
+ private void generateCapacity() {
+ // return (backingByteBuffer().capacity() + (int)(MemoryUtil.getAddress0(backingByteBuffer()) - baseAddress)) / SIZEOF;
+ MethodVisitor mv = super.visitMethod(ACC_PUBLIC, CAPACITY_METHOD_NAME, "()I", null, null);
mv.visitCode();
mv.visitVarInsn(ALOAD, 0);
mv.visitMethodInsn(INVOKEVIRTUAL, MAPPED_OBJECT_JVM, "backingByteBuffer", "()L" + jvmClassName(ByteBuffer.class) + ";");
+ mv.visitInsn(DUP);
mv.visitMethodInsn(INVOKEVIRTUAL, jvmClassName(ByteBuffer.class), "capacity", "()I");
+ mv.visitInsn(SWAP);
+ mv.visitMethodInsn(INVOKESTATIC, jvmClassName(MemoryUtil.class), "getAddress0", "(L" + jvmClassName(Buffer.class) + ";)J");
+ mv.visitVarInsn(ALOAD, 0);
+ mv.visitFieldInsn(GETFIELD, MAPPED_OBJECT_JVM, "baseAddress", "J");
+ mv.visitInsn(LSUB);
+ mv.visitInsn(L2I);
+ mv.visitInsn(IADD);
mv.visitFieldInsn(GETSTATIC, className, "SIZEOF", "I");
mv.visitInsn(IDIV);
mv.visitInsn(IRETURN);
- mv.visitMaxs(2, 1);
+ mv.visitMaxs(3, 1);
mv.visitEnd();
}
@@ -1037,7 +1049,7 @@
instructions.remove(nextInsn);
loadInsn.var = var;
- instructions.insert(loadInsn, new MethodInsnNode(INVOKESTATIC, mappedSubtype.className, LENGTH_METHOD_NAME, "(L" + mappedSubtype.className + ";)I"));
+ instructions.insert(loadInsn, new MethodInsnNode(INVOKEVIRTUAL, mappedSubtype.className, CAPACITY_METHOD_NAME, "()I"));
return i + 1;
} else if ( stackSize < loadStackSize ) // Consumed by something other than AALOAD or ARRAYLENGTH
Modified: trunk/LWJGL/src/templates/org/lwjgl/opencl/CL10.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opencl/CL10.java 2011-07-29 11:30:14 UTC (rev 3602)
+++ trunk/LWJGL/src/templates/org/lwjgl/opencl/CL10.java 2011-08-02 23:45:19 UTC (rev 3603)
@@ -432,7 +432,7 @@
@Code(
tryBlock = true,
// Create a GlobalRef to the callback object.
- javaBeforeNative = "\t\tlong user_data = CallbackUtil.createGlobalRef(pfn_notify);",
+ javaBeforeNative = "\t\tlong user_data = pfn_notify == null || pfn_notify.isCustom() ? 0 : CallbackUtil.createGlobalRef(pfn_notify);",
// Associate context with the GlobalRef, so we can delete it later.
javaFinally = "\t\t\tCallbackUtil.registerCallback(__result, user_data);"
)
@@ -845,7 +845,8 @@
@Code(
tryBlock = true,
// Create a GlobalRef to the callback object.
- javaBeforeNative = "\t\tlong user_data = CallbackUtil.createGlobalRef(pfn_notify);",
+ javaBeforeNative = "\t\tlong user_data = CallbackUtil.createGlobalRef(pfn_notify);\n" +
+ "\t\tif ( pfn_notify != null ) pfn_notify.setContext(program.getParent());",
// Check if we need to delete the GlobalRef.
javaFinally = "\t\t\tCallbackUtil.checkCallback(__result, user_data);"
)
@@ -861,7 +862,8 @@
@Code(
tryBlock = true,
// Create a GlobalRef to the callback object.
- javaBeforeNative = "\t\tlong user_data = CallbackUtil.createGlobalRef(pfn_notify);",
+ javaBeforeNative = "\t\tlong user_data = CallbackUtil.createGlobalRef(pfn_notify);\n" +
+ "\t\tif ( pfn_notify != null ) pfn_notify.setContext(program.getParent());",
// Check if we need to delete the GlobalRef.
javaFinally = "\t\t\tCallbackUtil.checkCallback(__result, user_data);"
)
@@ -877,7 +879,8 @@
@Code(
tryBlock = true,
// Create a GlobalRef to the callback object.
- javaBeforeNative = "\t\tlong user_data = CallbackUtil.createGlobalRef(pfn_notify);",
+ javaBeforeNative = "\t\tlong user_data = CallbackUtil.createGlobalRef(pfn_notify);\n" +
+ "\t\tif ( pfn_notify != null ) pfn_notify.setContext(program.getParent());",
// Check if we need to delete the GlobalRef.
javaFinally = "\t\t\tCallbackUtil.checkCallback(__result, user_data);"
)
Modified: trunk/LWJGL/src/templates/org/lwjgl/opencl/CL11.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opencl/CL11.java 2011-07-29 11:30:14 UTC (rev 3602)
+++ trunk/LWJGL/src/templates/org/lwjgl/opencl/CL11.java 2011-08-02 23:45:19 UTC (rev 3603)
@@ -190,7 +190,8 @@
@Code(
tryBlock = true,
// Create a GlobalRef to the callback object.
- javaBeforeNative = "\t\tlong user_data = CallbackUtil.createGlobalRef(pfn_notify);",
+ javaBeforeNative = "\t\tlong user_data = CallbackUtil.createGlobalRef(pfn_notify);\n" +
+ "\t\tpfn_notify.setRegistry(event.getParentRegistry());",
// Check if we need to delete the GlobalRef.
javaFinally = "\t\t\tCallbackUtil.checkCallback(__result, user_data);"
)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|