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
|
7
|
8
(1) |
9
(2) |
|
10
(8) |
11
(3) |
12
(13) |
13
(4) |
14
(2) |
15
|
16
(6) |
|
17
(1) |
18
|
19
|
20
|
21
(1) |
22
(2) |
23
(2) |
|
24
(1) |
25
|
26
|
27
|
28
|
29
(1) |
30
|
|
31
|
|
|
|
|
|
|
|
From: <sp...@us...> - 2011-07-12 19:29:22
|
Revision: 3577
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3577&view=rev
Author: spasi
Date: 2011-07-12 19:29:15 +0000 (Tue, 12 Jul 2011)
Log Message:
-----------
Added friendly error message when a non-static inner class is registered with the transformer.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedForeach.java
trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedObjectTransformer.java
Modified: trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedForeach.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedForeach.java 2011-07-12 18:30:56 UTC (rev 3576)
+++ trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedForeach.java 2011-07-12 19:29:15 UTC (rev 3577)
@@ -40,8 +40,8 @@
*/
public class MappedForeach<T extends MappedObject> implements Iterable<T> {
- private final T mapped;
- private final int elementCount;
+ final T mapped;
+ final int elementCount;
MappedForeach(T mapped, int elementCount) {
this.mapped = mapped;
Modified: trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedObjectTransformer.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedObjectTransformer.java 2011-07-12 18:30:56 UTC (rev 3576)
+++ trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedObjectTransformer.java 2011-07-12 19:29:15 UTC (rev 3577)
@@ -36,7 +36,7 @@
static final boolean PRINT_ACTIVITY = false;//LWJGLUtil.DEBUG && LWJGLUtil.getPrivilegedBoolean("org.lwjgl.util.mapped.PrintActivity");
static final boolean PRINT_BYTECODE = false; //LWJGLUtil.DEBUG && LWJGLUtil.getPrivilegedBoolean("org.lwjgl.util.mapped.PrintBytecode");
- private static final Map<String, MappedSubtypeInfo> className_to_subtype;
+ static final Map<String, MappedSubtypeInfo> className_to_subtype;
static {
className_to_subtype = new HashMap<String, MappedSubtypeInfo>();
@@ -80,6 +80,9 @@
if ( mapped == null )
throw new InternalError("missing " + MappedType.class.getName() + " annotation");
+ if ( type.getEnclosingClass() != null && !Modifier.isStatic(type.getModifiers()) )
+ throw new InternalError("only top-level or static inner classes are allowed");
+
String className = jvmClassName(type);
MappedSubtypeInfo mappedType = new MappedSubtypeInfo(className, mapped.sizeof(), mapped.align());
@@ -88,7 +91,7 @@
for ( Field field : type.getDeclaredFields() ) {
// static fields are never mapped
- if ( (field.getModifiers() & Modifier.STATIC) != 0 )
+ if ( Modifier.isStatic(field.getModifiers()) )
continue;
// we only support primitives and ByteBuffers
@@ -135,7 +138,7 @@
}
}
- private static final String view_constructor_method = "_construct_view_";
+ static final String view_constructor_method = "_construct_view_";
static byte[] transformFieldAccess(final String className, byte[] bytecode) {
int flags = 0;//ClassWriter.COMPUTE_FRAMES;
@@ -525,7 +528,7 @@
}
}
- private static void pushInt(MethodVisitor mv, int value) {
+ static void pushInt(MethodVisitor mv, int value) {
if ( value == -1 )
mv.visitInsn(ICONST_M1);
else if ( value == 0 )
@@ -548,7 +551,7 @@
mv.visitLdcInsn(Integer.valueOf(value));
}
- private static String jvmClassName(Class<?> type) {
+ static String jvmClassName(Class<?> type) {
return type.getName().replace('.', '/');
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <riv...@us...> - 2011-07-12 18:31:02
|
Revision: 3576
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3576&view=rev
Author: riven-lwjgl
Date: 2011-07-12 18:30:56 +0000 (Tue, 12 Jul 2011)
Log Message:
-----------
First attempt at manual computation of stack frames
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedObjectTransformer.java
Modified: trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedObjectTransformer.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedObjectTransformer.java 2011-07-12 17:49:58 UTC (rev 3575)
+++ trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedObjectTransformer.java 2011-07-12 18:30:56 UTC (rev 3576)
@@ -138,7 +138,7 @@
private static final String view_constructor_method = "_construct_view_";
static byte[] transformFieldAccess(final String className, byte[] bytecode) {
- int flags = ClassWriter.COMPUTE_FRAMES;
+ int flags = 0;//ClassWriter.COMPUTE_FRAMES;
ClassWriter writer = new ClassWriter(flags);
@@ -224,6 +224,14 @@
super.visitTypeInsn(opcode, typeName);
}
+
+ private int requireExtraStack = 0;
+
+ @Override
+ public void visitMaxs(int maxStack, int maxLocals)
+ {
+ super.visitMaxs(maxStack+this.requireExtraStack, maxLocals);
+ }
@Override
public void visitMethodInsn(int opcode, String className, String methodName, String signature) {
@@ -241,7 +249,7 @@
if ( (isMapDirectMethod || isMapBufferMethod) || isMallocMethod ) {
if ( isMallocMethod ) {
- // stack: count
+ // stack: count
pushInt(super.mv, mappedType.sizeof);
// stack: sizeof, count
super.visitInsn(IMUL);
@@ -271,6 +279,7 @@
// stack: int, int, buffer, new, new
super.visitMethodInsn(INVOKESTATIC, jvmClassName(MappedHelper.class), "setup", "(L" + jvmClassName(MappedObject.class) + ";Ljava/nio/ByteBuffer;II)V");
// stack: new
+ this.requireExtraStack = 5;
return;
}
@@ -284,6 +293,7 @@
// stack: new, this
super.visitMethodInsn(INVOKESTATIC, jvmClassName(MappedHelper.class), "dup", "(L" + jvmClassName(MappedObject.class) + ";L" + jvmClassName(MappedObject.class) + ";)L" + jvmClassName(MappedObject.class) + ";");
// stack: new
+ this.requireExtraStack = 3;
return;
}
@@ -297,6 +307,7 @@
// stack: new, this
super.visitMethodInsn(INVOKESTATIC, jvmClassName(MappedHelper.class), "slice", "(L" + jvmClassName(MappedObject.class) + ";L" + jvmClassName(MappedObject.class) + ";)L" + jvmClassName(MappedObject.class) + ";");
// stack: new
+ this.requireExtraStack = 3;
return;
}
@@ -308,6 +319,7 @@
// stack: this, this
super.visitMethodInsn(INVOKEVIRTUAL, className, view_constructor_method, "()V");
// stack: this
+ this.requireExtraStack = 2;
return;
}
@@ -319,6 +331,7 @@
// stack: sizeof, target, this
super.visitMethodInsn(INVOKESTATIC, jvmClassName(MappedHelper.class), "copy", "(L" + jvmClassName(MappedObject.class) + ";L" + jvmClassName(MappedObject.class) + ";I)V");
// stack: -
+ this.requireExtraStack = 3;
return;
}
@@ -330,6 +343,7 @@
// stack: bytes, target, this
super.visitMethodInsn(INVOKESTATIC, jvmClassName(MappedHelper.class), "copy", "(L" + jvmClassName(MappedObject.class) + ";L" + jvmClassName(MappedObject.class) + ";I)V");
// stack: -
+ this.requireExtraStack = 4;
return;
}
}
@@ -458,30 +472,50 @@
if ( opcode == GETFIELD ) {
Long fieldLength = mappedSubtype.fieldToLength.get(fieldName);
+ // stack: ref
super.visitFieldInsn(GETFIELD, mappedSubtype.className, "viewAddress", "J");
+ // stack: long
super.visitLdcInsn(fieldOffset);
+ // stack: long, long
super.visitInsn(LADD);
+ // stack: long
super.visitLdcInsn(fieldLength);
+ // stack: long, long
super.visitInsn(L2I);
+ // stack: int, long
super.visitMethodInsn(INVOKESTATIC, jvmClassName(MappedHelper.class), "newBuffer", "(JI)L" + jvmClassName(ByteBuffer.class) + ";");
-
+ // stack: buffer
+ this.requireExtraStack = 4;
return;
}
}
if ( opcode == PUTFIELD ) {
+ // stack: value, ref
super.visitInsn(SWAP);
+ // stack: ref, value
super.visitFieldInsn(GETFIELD, mappedSubtype.className, "viewAddress", "J");
+ // stack: long, value
super.visitLdcInsn(fieldOffset);
+ // stack: long, long, value
super.visitInsn(LADD);
+ // stack: long, value
super.visitMethodInsn(INVOKESTATIC, jvmClassName(MappedHelper.class), typeName.toLowerCase() + "put", "(" + typeName + "J)V");
+ // stack -
+ this.requireExtraStack = 4+(int)(mappedSubtype.fieldToLength.get(fieldName).longValue()>>2);
return;
}
if ( opcode == GETFIELD ) {
+ // stack: ref
super.visitFieldInsn(GETFIELD, mappedSubtype.className, "viewAddress", "J");
+ // stack: long
super.visitLdcInsn(fieldOffset);
+ // stack: long, long
super.visitInsn(LADD);
+ // stack: long
super.visitMethodInsn(INVOKESTATIC, jvmClassName(MappedHelper.class), typeName.toLowerCase() + "get", "(J)" + typeName);
+ // stack: value
+ this.requireExtraStack = 4;
return;
}
@@ -511,7 +545,7 @@
else if ( value >= Short.MIN_VALUE && value <= Short.MAX_VALUE )
mv.visitIntInsn(SIPUSH, value);
else
- mv.visitLdcInsn(value);
+ mv.visitLdcInsn(Integer.valueOf(value));
}
private static String jvmClassName(Class<?> type) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <riv...@us...> - 2011-07-12 17:50:04
|
Revision: 3575
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3575&view=rev
Author: riven-lwjgl
Date: 2011-07-12 17:49:58 +0000 (Tue, 12 Jul 2011)
Log Message:
-----------
Test case showing problems on loading library (64 vs 32 bit)
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/test/mapped/TestMappedObject.java
trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedObject.java
trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedObjectTransformer.java
Added Paths:
-----------
trunk/LWJGL/src/java/org/lwjgl/test/mapped/MappedObjectWithLibrary.java
Added: trunk/LWJGL/src/java/org/lwjgl/test/mapped/MappedObjectWithLibrary.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/test/mapped/MappedObjectWithLibrary.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/test/mapped/MappedObjectWithLibrary.java 2011-07-12 17:49:58 UTC (rev 3575)
@@ -0,0 +1,18 @@
+/*
+ * Created on Jul 12, 2011
+ */
+
+package org.lwjgl.test.mapped;
+
+import java.io.File;
+
+import org.lwjgl.opengl.Display;
+
+public class MappedObjectWithLibrary
+{
+ public static void testLWJGL() throws Exception
+ {
+ System.out.println(new File(System.getProperty("java.library.path")).getCanonicalPath());
+ Display.create();
+ }
+}
Modified: trunk/LWJGL/src/java/org/lwjgl/test/mapped/TestMappedObject.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/test/mapped/TestMappedObject.java 2011-07-12 15:36:16 UTC (rev 3574)
+++ trunk/LWJGL/src/java/org/lwjgl/test/mapped/TestMappedObject.java 2011-07-12 17:49:58 UTC (rev 3575)
@@ -44,7 +44,7 @@
throw new RuntimeException("Asserts must be enabled for this test.");
}
- public static void main(String[] args) {
+ public static void main(String[] args) throws Exception {
MappedObjectTransformer.register(MappedFloat.class);
MappedObjectTransformer.register(MappedVec2.class);
MappedObjectTransformer.register(MappedVec3.class);
@@ -70,6 +70,8 @@
MappedObjectTests3.testForeach();
MappedObjectTests3.testConstructor();
MappedObjectTests3.testMappedSet();
+
+ MappedObjectWithLibrary.testLWJGL();
}
}
\ No newline at end of file
Modified: trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedObject.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedObject.java 2011-07-12 15:36:16 UTC (rev 3574)
+++ trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedObject.java 2011-07-12 17:49:58 UTC (rev 3575)
@@ -50,7 +50,7 @@
*/
public class MappedObject {
- static final boolean CHECKS = LWJGLUtil.getPrivilegedBoolean("org.lwjgl.util.mapped.Checks");
+ static final boolean CHECKS = false;//LWJGLUtil.getPrivilegedBoolean("org.lwjgl.util.mapped.Checks");
public MappedObject() {
//
Modified: trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedObjectTransformer.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedObjectTransformer.java 2011-07-12 15:36:16 UTC (rev 3574)
+++ trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedObjectTransformer.java 2011-07-12 17:49:58 UTC (rev 3575)
@@ -32,8 +32,8 @@
*/
public class MappedObjectTransformer {
- static final boolean PRINT_TIMING = LWJGLUtil.DEBUG && LWJGLUtil.getPrivilegedBoolean("org.lwjgl.util.mapped.PrintTiming");
- static final boolean PRINT_ACTIVITY = LWJGLUtil.DEBUG && LWJGLUtil.getPrivilegedBoolean("org.lwjgl.util.mapped.PrintActivity");
+ static final boolean PRINT_TIMING = false;//LWJGLUtil.DEBUG && LWJGLUtil.getPrivilegedBoolean("org.lwjgl.util.mapped.PrintTiming");
+ static final boolean PRINT_ACTIVITY = false;//LWJGLUtil.DEBUG && LWJGLUtil.getPrivilegedBoolean("org.lwjgl.util.mapped.PrintActivity");
static final boolean PRINT_BYTECODE = false; //LWJGLUtil.DEBUG && LWJGLUtil.getPrivilegedBoolean("org.lwjgl.util.mapped.PrintBytecode");
private static final Map<String, MappedSubtypeInfo> className_to_subtype;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2011-07-12 15:36:22
|
Revision: 3574
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3574&view=rev
Author: spasi
Date: 2011-07-12 15:36:16 +0000 (Tue, 12 Jul 2011)
Log Message:
-----------
Added GLES classes on which Display depends to the main jar.
Modified Paths:
--------------
trunk/LWJGL/build.xml
trunk/LWJGL/src/java/org/lwjgl/opengl/DrawableGL.java
trunk/LWJGL/src/java/org/lwjgl/opengl/DrawableGLES.java
trunk/LWJGL/src/java/org/lwjgl/opengl/DrawableLWJGL.java
trunk/LWJGL/src/java/org/lwjgl/opengl/PixelFormatLWJGL.java
Modified: trunk/LWJGL/build.xml
===================================================================
--- trunk/LWJGL/build.xml 2011-07-12 14:21:29 UTC (rev 3573)
+++ trunk/LWJGL/build.xml 2011-07-12 15:36:16 UTC (rev 3574)
@@ -143,6 +143,12 @@
<!-- Create lwjgl.jar -->
<jar destfile="${lwjgl.temp}/jar/lwjgl.jar" taskname="lwjgl.jar">
<fileset refid="lwjgl.fileset" />
+ <fileset dir="${lwjgl.bin}"> <!-- Display has a dependency on these -->
+ <patternset>
+ <include name="org/lwjgl/opengles/ContextAttribs.*"/>
+ <include name="org/lwjgl/opengles/PixelFormat.*"/>
+ </patternset>
+ </fileset>
<manifest>
<attribute name="Sealed" value="true"/>
</manifest>
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/DrawableGL.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/DrawableGL.java 2011-07-12 14:21:29 UTC (rev 3573)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/DrawableGL.java 2011-07-12 15:36:16 UTC (rev 3574)
@@ -1,3 +1,34 @@
+/*
+ * 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.LWJGLException;
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/DrawableGLES.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/DrawableGLES.java 2011-07-12 14:21:29 UTC (rev 3573)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/DrawableGLES.java 2011-07-12 15:36:16 UTC (rev 3574)
@@ -1,3 +1,34 @@
+/*
+ * 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.LWJGLException;
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/DrawableLWJGL.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/DrawableLWJGL.java 2011-07-12 14:21:29 UTC (rev 3573)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/DrawableLWJGL.java 2011-07-12 15:36:16 UTC (rev 3574)
@@ -1,3 +1,34 @@
+/*
+ * 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.LWJGLException;
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/PixelFormatLWJGL.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/PixelFormatLWJGL.java 2011-07-12 14:21:29 UTC (rev 3573)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/PixelFormatLWJGL.java 2011-07-12 15:36:16 UTC (rev 3574)
@@ -1,3 +1,34 @@
+/*
+ * 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;
/**
@@ -4,7 +35,6 @@
* [INTERNAL USE ONLY]
*
* @author Spasi
- * @since 15/5/2011
*/
public interface PixelFormatLWJGL {
// Marker interface
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2011-07-12 14:21:36
|
Revision: 3573
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3573&view=rev
Author: spasi
Date: 2011-07-12 14:21:29 +0000 (Tue, 12 Jul 2011)
Log Message:
-----------
Changed mapping behavior to be consistent with the LWJGL API; it now starts at the buffer's current .position().
Reverted client JVM warning to use serr instead of LWJGLUtil.log, for extra visibility when Debug is disabled.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/test/mapped/MappedObjectTests1.java
trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedHelper.java
trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedObjectTransformer.java
Modified: trunk/LWJGL/src/java/org/lwjgl/test/mapped/MappedObjectTests1.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/test/mapped/MappedObjectTests1.java 2011-07-12 13:44:13 UTC (rev 3572)
+++ trunk/LWJGL/src/java/org/lwjgl/test/mapped/MappedObjectTests1.java 2011-07-12 14:21:29 UTC (rev 3573)
@@ -117,6 +117,19 @@
} catch (IndexOutOfBoundsException e) {
// expected, ignore
}
+
+ try {
+ ByteBuffer posTest = ByteBuffer.allocateDirect(200);
+ posTest.position(10 * MappedFloat.SIZEOF); // position > 0
+
+ MappedFloat vecs2 = MappedFloat.map(posTest);
+ vecs2.view = 39;
+ assert vecs2.view == 39;
+ vecs2.view = 40;
+ System.out.println("org.lwjgl.util.mapped.Checks is false or there is a bug in bounds checking.");
+ } catch (IndexOutOfBoundsException e) {
+ // expected, ignore
+ }
}
// test dup
Modified: trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedHelper.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedHelper.java 2011-07-12 13:44:13 UTC (rev 3572)
+++ trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedHelper.java 2011-07-12 14:21:29 UTC (rev 3573)
@@ -60,7 +60,7 @@
throw new IllegalStateException("sizeof not a multiple of alignment");
mo.stride = sizeof;
- long addr = MappedObjectUnsafe.getBufferBaseAddress(buffer);
+ long addr = MappedObjectUnsafe.getBufferBaseAddress(buffer) + buffer.position();
if ( addr % align != 0 )
throw new IllegalStateException("buffer address not aligned on " + align + " bytes");
Modified: trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedObjectTransformer.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedObjectTransformer.java 2011-07-12 13:44:13 UTC (rev 3572)
+++ trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedObjectTransformer.java 2011-07-12 14:21:29 UTC (rev 3573)
@@ -62,7 +62,7 @@
String vmName = System.getProperty("java.vm.name");
if ( vmName != null && !vmName.contains("Server") ) {
- LWJGLUtil.log("Warning: " + MappedObject.class.getSimpleName() + "s have inferiour performance on Client VMs, please consider switching to a Server VM.");
+ System.err.println("Warning: " + MappedObject.class.getSimpleName() + "s have inferiour performance on Client VMs, please consider switching to a Server VM.");
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2011-07-12 13:44:19
|
Revision: 3572
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3572&view=rev
Author: spasi
Date: 2011-07-12 13:44:13 +0000 (Tue, 12 Jul 2011)
Log Message:
-----------
Fixed bounds checking to work with .sliced mapped objects.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/test/mapped/MappedObjectTests1.java
trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedObject.java
Modified: trunk/LWJGL/src/java/org/lwjgl/test/mapped/MappedObjectTests1.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/test/mapped/MappedObjectTests1.java 2011-07-12 13:29:04 UTC (rev 3571)
+++ trunk/LWJGL/src/java/org/lwjgl/test/mapped/MappedObjectTests1.java 2011-07-12 13:44:13 UTC (rev 3572)
@@ -89,17 +89,34 @@
vecs.view = 0;
}
- // test bound check
+ // test bounds checking
{
assert (vecs.view == 0);
try {
+ vecs.view = 49;
+ assert vecs.view == 49;
+ vecs.view = 0;
vecs.view = 50;
System.out.println("org.lwjgl.util.mapped.Checks is false or there is a bug in bounds checking.");
vecs.view = 0;
} catch (IndexOutOfBoundsException e) {
// expected, ignore
}
+
assert (vecs.view == 0);
+
+ try {
+ vecs.view = 10;
+ MappedFloat vecs2 = vecs.slice();
+ vecs.view = 0;
+
+ vecs2.view = 39;
+ assert vecs2.view == 39;
+ vecs2.view = 40;
+ System.out.println("org.lwjgl.util.mapped.Checks is false or there is a bug in bounds checking.");
+ } catch (IndexOutOfBoundsException e) {
+ // expected, ignore
+ }
}
// test dup
Modified: trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedObject.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedObject.java 2011-07-12 13:29:04 UTC (rev 3571)
+++ trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedObject.java 2011-07-12 13:44:13 UTC (rev 3572)
@@ -97,7 +97,7 @@
}
final void checkAddress(final long address) {
- if ( preventGC.capacity() < (address + stride - baseAddress) )
+ if ( preventGC.capacity() < (address - MappedObjectUnsafe.getBufferBaseAddress(preventGC) + stride) )
throw new IndexOutOfBoundsException();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2011-07-12 13:29:14
|
Revision: 3571
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3571&view=rev
Author: spasi
Date: 2011-07-12 13:29:04 +0000 (Tue, 12 Jul 2011)
Log Message:
-----------
Mapped object code improvements: added license, additional documentation, reformatted code, now using LWJGLUtil.log instead of System.err.
Added system properties for bytecode transformer debug output. (org.lwjgl.util.mapped.PrintTiming & org.lwjgl.util.mapped.PrintActivity)
Added support for bounds checking the view of mapped objects. Enabled with org.lwjgl.util.mapped.Checks
Added tests for mapped objects. (org.lwjgl.test.mapped package)
Added "[LWJGL] " prefix to all LWJGL generated debug messages.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/LWJGLUtil.java
trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedField.java
trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedForeach.java
trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedHelper.java
trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedObject.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/MappedSet.java
trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedSet2.java
trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedSet3.java
trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedSet4.java
trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedType.java
Added Paths:
-----------
trunk/LWJGL/src/java/org/lwjgl/test/mapped/
trunk/LWJGL/src/java/org/lwjgl/test/mapped/MappedFloat.java
trunk/LWJGL/src/java/org/lwjgl/test/mapped/MappedObjectBench.java
trunk/LWJGL/src/java/org/lwjgl/test/mapped/MappedObjectTests1.java
trunk/LWJGL/src/java/org/lwjgl/test/mapped/MappedObjectTests2.java
trunk/LWJGL/src/java/org/lwjgl/test/mapped/MappedObjectTests3.java
trunk/LWJGL/src/java/org/lwjgl/test/mapped/MappedSomething.java
trunk/LWJGL/src/java/org/lwjgl/test/mapped/MappedVec2.java
trunk/LWJGL/src/java/org/lwjgl/test/mapped/MappedVec3.java
trunk/LWJGL/src/java/org/lwjgl/test/mapped/TestMappedObject.java
Modified: trunk/LWJGL/src/java/org/lwjgl/LWJGLUtil.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/LWJGLUtil.java 2011-07-12 07:27:00 UTC (rev 3570)
+++ trunk/LWJGL/src/java/org/lwjgl/LWJGLUtil.java 2011-07-12 13:29:04 UTC (rev 3571)
@@ -448,7 +448,7 @@
/**
* Gets a boolean property as a privileged action.
*/
- private static boolean getPrivilegedBoolean(final String property_name) {
+ public static boolean getPrivilegedBoolean(final String property_name) {
Boolean value = AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
public Boolean run() {
return Boolean.getBoolean(property_name);
@@ -464,7 +464,7 @@
*/
public static void log(String msg) {
if (DEBUG) {
- System.err.println(msg);
+ System.err.println("[LWJGL] " + msg);
}
}
Added: trunk/LWJGL/src/java/org/lwjgl/test/mapped/MappedFloat.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/test/mapped/MappedFloat.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/test/mapped/MappedFloat.java 2011-07-12 13:29:04 UTC (rev 3571)
@@ -0,0 +1,56 @@
+/*
+ * 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.test.mapped;
+
+import org.lwjgl.util.mapped.MappedObject;
+import org.lwjgl.util.mapped.MappedType;
+
+/** @author Riven */
+@MappedType(sizeof = 4)
+public class MappedFloat extends MappedObject {
+
+ public MappedFloat() {
+ this.test();
+ }
+
+ public float value;
+
+ public void test() {
+ this.value = 4;
+ }
+
+ @Override
+ public String toString() {
+ return "MappedFloat[" + value + "]";
+ }
+
+}
\ No newline at end of file
Added: trunk/LWJGL/src/java/org/lwjgl/test/mapped/MappedObjectBench.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/test/mapped/MappedObjectBench.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/test/mapped/MappedObjectBench.java 2011-07-12 13:29:04 UTC (rev 3571)
@@ -0,0 +1,237 @@
+/*
+ * 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.test.mapped;
+
+import org.lwjgl.util.mapped.MappedObjectUnsafe;
+
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+
+import static org.lwjgl.util.mapped.MappedHelper.*;
+
+/** @author Riven */
+@SuppressWarnings("static-access")
+public class MappedObjectBench {
+
+ static class InstanceVec3 {
+
+ float x, y, z;
+
+ @Override
+ public String toString() {
+ return "InstanceVec3[" + x + ", " + y + ", " + z + "]";
+ }
+ }
+
+ static class ArrayVec3 {
+
+ float[] a;
+ int i;
+
+ @Override
+ public String toString() {
+ return "ArrayVec3[" + a[i * 3 + 0] + ", " + a[i * 3 + 1] + ", " + a[i * 3 + 2] + "]";
+ }
+ }
+
+ static void benchmarkInstances() {
+ final int runs = 64;
+ final int iterations = 64 * 1024;
+
+ InstanceVec3 vec1 = new InstanceVec3();
+ InstanceVec3 vec2 = new InstanceVec3();
+ InstanceVec3 vec3 = new InstanceVec3();
+
+ long[] took = new long[runs];
+ for ( int run = 0; run < runs; run++ ) {
+ long t0 = System.nanoTime();
+ for ( int iteration = 0; iteration < iterations; iteration++ ) {
+ vec1.x = 13;
+ vec1.y += vec1.y * vec1.x + 0.3f;
+ vec1.z += vec2.y + vec1.x + 0.3f;
+ vec2.z += vec2.y + vec1.x;
+ vec3.z += vec2.z + vec1.y;
+ }
+ long t1 = System.nanoTime();
+ took[run] = t1 - t0;
+ }
+
+ Arrays.sort(took);
+ System.out.println("instance took: " + took[took.length / 2] / 1024 + "us");
+
+ System.out.println(vec1);
+ System.out.println(vec2);
+ System.out.println(vec3);
+ }
+
+ static void benchmarkMapped() {
+ final int runs = 64;
+ final int iterations = 64 * 1024;
+
+ ByteBuffer bb = ByteBuffer.allocateDirect(200);
+
+ MappedVec3 vecs = MappedVec3.map(bb);
+
+ MappedVec3 vec1 = vecs.dup();
+ MappedVec3 vec2 = vecs.dup();
+ MappedVec3 vec3 = vecs.dup();
+
+ vec1.view = 0;
+ vec2.view = 1;
+ vec3.view = 2;
+
+ long[] took = new long[runs];
+ for ( int run = 0; run < runs; run++ ) {
+ long t0 = System.nanoTime();
+ for ( int iteration = 0; iteration < iterations; iteration += 2 ) {
+ vec1.x = 13;
+ vec1.y += vec1.y * vec1.x + 0.3f;
+ vec1.z += vec2.y + vec1.x + 0.3f;
+ vec2.z += vec2.y + vec1.x;
+ vec3.z += vec2.z + vec1.y;
+
+ vec1.x = 13;
+ vec1.y += vec1.y * vec1.x + 0.3f;
+ vec1.z += vec2.y + vec1.x + 0.3f;
+ vec2.z += vec2.y + vec1.x;
+ vec3.z += vec2.z + vec1.y;
+ }
+ long t1 = System.nanoTime();
+ took[run] = t1 - t0;
+ }
+
+ Arrays.sort(took);
+ System.out.println("mapped took: " + took[took.length / 2] / 1024 + "us");
+
+ System.out.println(vec1);
+ System.out.println(vec2);
+ System.out.println(vec3);
+
+ System.out.println(bb);
+ }
+
+ static void benchmarkIndirectArray() {
+ final int runs = 64;
+ final int iterations = 64 * 1024;
+
+ float[] bb = new float[200];
+
+ ArrayVec3 vec1 = new ArrayVec3();
+ ArrayVec3 vec2 = new ArrayVec3();
+ ArrayVec3 vec3 = new ArrayVec3();
+
+ vec1.a = bb;
+ vec2.a = bb;
+ vec3.a = bb;
+
+ vec1.i = 0;
+ vec2.i = 1;
+ vec3.i = 2;
+
+ long[] took = new long[runs];
+ for ( int run = 0; run < runs; run++ ) {
+ long t0 = System.nanoTime();
+ for ( int iteration = 0; iteration < iterations; iteration++ ) {
+ vec1.a[vec1.i * 3 + 0] = 13;
+ vec1.a[vec1.i * 3 + 1] += vec1.a[vec1.i * 3 + 1] * vec1.a[vec1.i * 3 + 0] + 0.3f;
+ vec1.a[vec1.i * 3 + 2] += vec2.a[vec2.i * 3 + 1] + vec1.a[vec1.i * 3 + 0] + 0.3f;
+ vec2.a[vec2.i * 3 + 2] += vec2.a[vec2.i * 3 + 1] + vec1.a[vec1.i * 3 + 0];
+ vec3.a[vec3.i * 3 + 2] += vec2.a[vec2.i * 3 + 2] + vec2.a[vec2.i * 3 + 1];
+ }
+ long t1 = System.nanoTime();
+ took[run] = t1 - t0;
+ }
+
+ Arrays.sort(took);
+ System.out.println("array took: " + took[took.length / 2] / 1024 + "us");
+
+ System.out.println(vec1);
+ System.out.println(vec2);
+ System.out.println(vec3);
+
+ System.out.println(bb);
+ }
+
+ static void benchmarkDirectArray() {
+ final int runs = 64;
+ final int iterations = 64 * 1024;
+
+ float[] bb = new float[200];
+
+ long[] took = new long[runs];
+ for ( int run = 0; run < runs; run++ ) {
+ long t0 = System.nanoTime();
+ for ( int iteration = 0; iteration < iterations; iteration++ ) {
+ bb[1 * 3 + 0] = 13;
+ bb[1 * 3 + 1] += bb[1 * 3 + 1] * bb[1 * 3 + 0] + 0.3f;
+ bb[1 * 3 + 2] += bb[2 * 3 + 1] + bb[1 * 3 + 0] + 0.3f;
+ bb[2 * 3 + 2] += bb[2 * 3 + 1] + bb[1 * 3 + 0];
+ bb[3 * 3 + 2] += bb[2 * 3 + 2] + bb[2 * 3 + 1];
+ }
+ long t1 = System.nanoTime();
+ took[run] = t1 - t0;
+ }
+
+ Arrays.sort(took);
+ System.out.println("array2 took: " + took[took.length / 2] / 1024 + "us");
+
+ System.out.println(bb);
+ }
+
+ static void benchmarkUnsafe() {
+ final int runs = 64;
+ final int iterations = 64 * 1024;
+
+ ByteBuffer bb = ByteBuffer.allocateDirect(200);
+ long addr = MappedObjectUnsafe.getBufferBaseAddress(bb);
+
+ long[] took = new long[runs];
+ for ( int run = 0; run < runs; run++ ) {
+ long t0 = System.nanoTime();
+ for ( int iteration = 0; iteration < iterations; iteration++ ) {
+ fput(13, addr + (1 * 3 + 0) * 4);
+ fput(fget(addr + (1 * 3 + 1) * 4) + fget(addr + (1 * 3 + 1) * 4) * fget(addr + (1 * 3 + 0) * 4) + 0.3f, addr + (1 * 3 + 1) * 4);
+ fput(fget(addr + (1 * 3 + 2) * 4) + fget(addr + (2 * 3 + 1) * 4) + fget(addr + (1 * 3 + 0) * 4) + 0.3f, addr + (1 * 3 + 2) * 4);
+ fput(fget(addr + (2 * 3 + 2) * 4) + fget(addr + (2 * 3 + 1) * 4) + fget(addr + (1 * 3 + 0) * 4), addr + (2 * 3 + 2) * 4);
+ fput(fget(addr + (3 * 3 + 2) * 4) + fget(addr + (2 * 3 + 2) * 4) + fget(addr + (2 * 3 + 1) * 4), addr + (3 * 3 + 2) * 4);
+ }
+ long t1 = System.nanoTime();
+ took[run] = t1 - t0;
+ }
+
+ Arrays.sort(took);
+ System.out.println("unsafe took: " + took[took.length / 2] / 1024 + "us");
+
+ System.out.println(bb);
+ }
+
+}
\ No newline at end of file
Added: trunk/LWJGL/src/java/org/lwjgl/test/mapped/MappedObjectTests1.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/test/mapped/MappedObjectTests1.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/test/mapped/MappedObjectTests1.java 2011-07-12 13:29:04 UTC (rev 3571)
@@ -0,0 +1,159 @@
+/*
+ * 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.test.mapped;
+
+import org.lwjgl.util.mapped.MappedHelper;
+import org.lwjgl.util.mapped.MappedObjectUnsafe;
+
+import java.nio.ByteBuffer;
+
+/** @author Riven */
+@SuppressWarnings("static-access")
+public class MappedObjectTests1 {
+
+ static class Test {
+
+ int value;
+ }
+
+ static void testViewField() {
+ Test test = new Test();
+ test.value = 13;
+ test.value += 1;
+ test.value++;
+ System.out.println(test);
+
+ ByteBuffer bb = ByteBuffer.allocateDirect(200);
+ MappedFloat vecs = MappedFloat.map(bb);
+
+ // verify 'malloc' and SIZEOF
+ {
+ MappedFloat vecs1 = MappedFloat.malloc(1234);
+
+ assert (vecs1.stride == MappedFloat.SIZEOF);
+ assert (vecs1.stride * 1234 == vecs1.backingByteBuffer().capacity());
+ assert (MappedFloat.SIZEOF * 1234 == vecs1.backingByteBuffer().capacity());
+ }
+
+ // manipulate 'mapped.value'
+ {
+ assert (vecs.value == 0.0f); // 4.0 is set in constructor, but runViewConstructor is not called
+ vecs.value = 1.1f;
+ assert (vecs.value == 1.1f);
+ }
+
+ // manipulate 'view' with assignment
+ {
+ assert (vecs.view == 0);
+ vecs.view = 1;
+ assert (vecs.view == 1);
+ assert (vecs.value != 1.1f); // old view
+ vecs.view = 0;
+ }
+
+ // manipulate 'view' with iinc
+ {
+ assert (vecs.view == 0);
+ vecs.view++;
+ assert (vecs.view == 1);
+ assert (vecs.value != 1.1f); // old view
+ vecs.view = 0;
+ }
+
+ // test bound check
+ {
+ assert (vecs.view == 0);
+ try {
+ vecs.view = 50;
+ System.out.println("org.lwjgl.util.mapped.Checks is false or there is a bug in bounds checking.");
+ vecs.view = 0;
+ } catch (IndexOutOfBoundsException e) {
+ // expected, ignore
+ }
+ assert (vecs.view == 0);
+ }
+
+ // test dup
+ {
+ int newStride = 16;
+ int doOffset = 0;
+
+ vecs.view = 0;
+ MappedFloat.configure(vecs, newStride, doOffset);
+ MappedFloat dec2 = vecs.dup();
+ MappedFloat.configure(dec2, newStride, doOffset);
+
+ String s1 = vecs.baseAddress + "," + vecs.viewAddress + "," + vecs.stride + "," + vecs.SIZEOF;
+ String s2 = dec2.baseAddress + "," + dec2.viewAddress + "," + dec2.stride + "," + dec2.SIZEOF;
+ // System.out.println(s1);
+ // System.out.println(s2);
+ assert (s1.equals(s2));
+
+ dec2.view++;
+
+ String s3 = vecs.baseAddress + "," + vecs.viewAddress + "," + vecs.stride + "," + vecs.SIZEOF;
+ String s4 = dec2.baseAddress + "," + dec2.viewAddress + "," + dec2.stride + "," + dec2.SIZEOF;
+ // System.out.println(s3);
+ // System.out.println(s4);
+ assert (!s3.equals(s4));
+ }
+
+ // test newBuffer
+ {
+ long addr1 = MappedObjectUnsafe.getBufferBaseAddress(bb);
+ ByteBuffer bb2 = MappedHelper.newBuffer(addr1, bb.capacity());
+ long addr2 = MappedObjectUnsafe.getBufferBaseAddress(bb);
+
+ System.out.println(bb);
+ System.out.println(bb2);
+ System.out.println(addr1);
+ System.out.println(addr2);
+ }
+
+ // test 'copy'
+ {
+ vecs.value = 13.37f;
+ MappedFloat dec2 = vecs.dup();
+ dec2.view = 1;
+ System.out.println(vecs);
+ System.out.println(dec2);
+ vecs.copyTo(dec2);
+ System.out.println(vecs);
+ System.out.println(dec2);
+ assert (dec2.value == 13.37f);
+
+ vecs.value = 73.31f;
+ vecs.copyRange(dec2, 1);
+ assert (dec2.value == 73.31f);
+ }
+ }
+}
Added: trunk/LWJGL/src/java/org/lwjgl/test/mapped/MappedObjectTests2.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/test/mapped/MappedObjectTests2.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/test/mapped/MappedObjectTests2.java 2011-07-12 13:29:04 UTC (rev 3571)
@@ -0,0 +1,130 @@
+/*
+ * 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.test.mapped;
+
+import java.nio.ByteBuffer;
+
+/** @author Riven */
+@SuppressWarnings("static-access")
+public class MappedObjectTests2 {
+
+ static void testWriteFieldAccess(MappedVec3 vecs) {
+ // write access results into a transform-time IllegalAccessException
+
+ System.out.println(vecs.baseAddress); // test read-access
+
+ System.out.println(vecs.viewAddress); // test read-access
+
+ System.out.println(vecs.align); // test read-access
+
+ System.out.println(MappedVec3.SIZEOF); // test read-access
+ }
+
+ static void testFields() {
+ ByteBuffer bb = ByteBuffer.allocateDirect(200);
+ MappedVec3 vecs = MappedVec3.map(bb);
+
+ testWriteFieldAccess(vecs);
+
+ vecs.x = 13.13f;
+ vecs.y = 14.14f;
+ vecs.z = 15.15f;
+
+ System.out.println(vecs.viewAddress);
+
+ assert (vecs.x == 13.13f);
+ assert (vecs.y == 14.14f);
+ assert (vecs.z == 15.15f);
+
+ vecs.view = 0;
+
+ assert (vecs.x == 13.13f);
+ assert (vecs.y == 14.14f);
+ assert (vecs.z == 15.15f);
+
+ System.out.println(vecs);
+ vecs.view = 1;
+ System.out.println(vecs);
+
+ assert (vecs.x == 0.0f);
+ assert (vecs.y == 0.0f);
+ assert (vecs.z == 0.0f);
+
+ // now it becomes weird: offsets and strides
+
+ vecs.view = 1;
+ vecs.x = 0.1234f;
+ vecs.view = 0;
+
+ // test stride & sizeof
+ {
+ long a1 = vecs.viewAddress;
+ vecs.view = 1;
+ long a2 = vecs.viewAddress;
+ assert (a2 - a1 == MappedVec3.SIZEOF);
+ assert (a2 - a1 == vecs.stride);
+ vecs.view = 0;
+ }
+
+ int newStride = 16;
+
+ MappedVec3.configure(vecs, newStride, +4);
+ assert (vecs.z == 0.1234f); // vecs[1].x ended up in vecs[0].z due to 1float offset
+
+ MappedVec3.configure(vecs, newStride, +8);
+ assert (vecs.z == 0.0000f); // vecs[1].z ended up in vecs[0].z due to 2float offset
+
+ // test new stride
+ {
+ long a1 = vecs.viewAddress;
+ vecs.view = 1;
+ long a2 = vecs.viewAddress;
+ assert (a2 - a1 == newStride);
+ vecs.view = 0;
+ }
+
+ // example: GPU => VBO => VTN
+ {
+ MappedVec3 v = MappedVec3.map(bb);
+ MappedVec2 t = MappedVec2.map(bb);
+ MappedVec3 n = MappedVec3.map(bb);
+
+ int stride = MappedVec3.SIZEOF + MappedVec2.SIZEOF + MappedVec3.SIZEOF;
+ assert (stride == 32);
+
+ MappedVec3.configure(v, stride, 0);
+ MappedVec2.configure(t, stride, MappedVec3.SIZEOF);
+ MappedVec3.configure(n, stride, MappedVec3.SIZEOF + MappedVec2.SIZEOF);
+ }
+ }
+
+}
\ No newline at end of file
Added: trunk/LWJGL/src/java/org/lwjgl/test/mapped/MappedObjectTests3.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/test/mapped/MappedObjectTests3.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/test/mapped/MappedObjectTests3.java 2011-07-12 13:29:04 UTC (rev 3571)
@@ -0,0 +1,123 @@
+/*
+ * 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.test.mapped;
+
+import org.lwjgl.util.mapped.*;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+
+import static org.lwjgl.util.mapped.MappedObject.*;
+
+/** @author Riven */
+@SuppressWarnings("static-access")
+public class MappedObjectTests3 {
+
+ static void testMappedBuffer() {
+ int elementCount = 4;
+
+ MappedSomething some = MappedSomething.malloc(elementCount);
+
+ assert (some.data != some.data);
+
+ long addr1 = MappedObjectUnsafe.getBufferBaseAddress(some.backingByteBuffer());
+
+ ByteBuffer mapped = some.data; // creates new ByteBuffer instance
+ long addr2 = MappedObjectUnsafe.getBufferBaseAddress(mapped);
+
+ assert (addr2 - addr1 == 4);
+ assert (mapped.capacity() == MappedSomething.SIZEOF - 4);
+
+ some.view++;
+ mapped = some.data; // creates new ByteBuffer instance
+
+ long addr3 = MappedObjectUnsafe.getBufferBaseAddress(mapped);
+ assert (addr3 - addr1 == 4 + MappedSomething.SIZEOF);
+ assert (addr3 - addr2 == 0 + MappedSomething.SIZEOF);
+ assert (mapped.capacity() == MappedSomething.SIZEOF - 4);
+ }
+
+ static void testForeach() {
+ int elementCount = 4;
+ MappedSomething some = MappedSomething.malloc(elementCount);
+
+ int i = 0;
+ for ( MappedSomething item : foreach(some, elementCount) ) {
+ assert (item.view == i++);
+ }
+ assert (some.view != elementCount);
+ System.out.println("current.view=" + some.view + ", not " + elementCount + ", as you might expect");
+ }
+
+ @MappedType(sizeof = 12)
+ public static class Xyz extends MappedObject {
+
+ int x, y, z;
+ }
+
+ static void testConstructor() {
+ int capacity = 1024;
+ ByteBuffer bb = ByteBuffer.allocateDirect(capacity).order(ByteOrder.nativeOrder());
+ long address = MappedObjectUnsafe.getBufferBaseAddress(bb);
+
+ MappedFloat mf = MappedFloat.map(address, capacity);
+
+ assert (address == mf.baseAddress);
+
+ assert (mf.value == 0.0f);
+ mf.view = 1;
+ assert (mf.value == 0.0f);
+ mf.runViewConstructor();
+ assert (mf.value == 4.0f);
+
+ Xyz.malloc(3);
+ }
+
+ static void testMappedSet() {
+ MappedVec2 vec2 = MappedVec2.malloc(3);
+ MappedVec3 vec3 = MappedVec3.malloc(3);
+
+ MappedSet2 set = MappedSet.create(vec2, vec3);
+
+ assert (vec2.view == 0);
+ assert (vec3.view == 0);
+
+ set.view = 2;
+ assert (vec2.view == 2);
+ assert (vec3.view == 2);
+
+ set.view = 0;
+ assert (vec2.view == 0);
+ assert (vec3.view == 0);
+ }
+
+}
\ No newline at end of file
Added: trunk/LWJGL/src/java/org/lwjgl/test/mapped/MappedSomething.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/test/mapped/MappedSomething.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/test/mapped/MappedSomething.java 2011-07-12 13:29:04 UTC (rev 3571)
@@ -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.test.mapped;
+
+import org.lwjgl.util.mapped.MappedField;
+import org.lwjgl.util.mapped.MappedObject;
+import org.lwjgl.util.mapped.MappedType;
+
+import java.nio.ByteBuffer;
+
+/** @author Riven */
+@MappedType(sizeof = 64)
+public class MappedSomething extends MappedObject {
+
+ @MappedField(byteOffset = 0)
+ public int used;
+
+ @MappedField(byteOffset = 4, byteLength = 64 - 4)
+ public ByteBuffer data;
+
+ @Override
+ public String toString() {
+ return "MappedSomething[" + used + "]";
+ }
+
+}
\ No newline at end of file
Added: trunk/LWJGL/src/java/org/lwjgl/test/mapped/MappedVec2.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/test/mapped/MappedVec2.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/test/mapped/MappedVec2.java 2011-07-12 13:29:04 UTC (rev 3571)
@@ -0,0 +1,50 @@
+/*
+ * 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.test.mapped;
+
+import org.lwjgl.util.mapped.MappedObject;
+import org.lwjgl.util.mapped.MappedType;
+
+/** @author Riven */
+@MappedType(sizeof = 8)
+public class MappedVec2 extends MappedObject {
+
+ public float x;
+
+ public float y;
+
+ @Override
+ public String toString() {
+ return "MappedVec2[" + x + "," + y + "]";
+ }
+
+}
\ No newline at end of file
Added: trunk/LWJGL/src/java/org/lwjgl/test/mapped/MappedVec3.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/test/mapped/MappedVec3.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/test/mapped/MappedVec3.java 2011-07-12 13:29:04 UTC (rev 3571)
@@ -0,0 +1,52 @@
+/*
+ * 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.test.mapped;
+
+import org.lwjgl.util.mapped.MappedObject;
+import org.lwjgl.util.mapped.MappedType;
+
+/** @author Riven */
+@MappedType(sizeof = 12)
+public class MappedVec3 extends MappedObject {
+
+ public float x;
+
+ public float y;
+
+ public float z;
+
+ @Override
+ public String toString() {
+ return "[" + x + "," + y + "," + z + "]";
+ }
+
+}
\ No newline at end of file
Added: trunk/LWJGL/src/java/org/lwjgl/test/mapped/TestMappedObject.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/test/mapped/TestMappedObject.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/test/mapped/TestMappedObject.java 2011-07-12 13:29:04 UTC (rev 3571)
@@ -0,0 +1,75 @@
+/*
+ * 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.test.mapped;
+
+import org.lwjgl.util.mapped.MappedObjectClassLoader;
+import org.lwjgl.util.mapped.MappedObjectTransformer;
+
+/** @author Riven */
+public class TestMappedObject {
+
+ static {
+ boolean assertsEnabled = false;
+ assert assertsEnabled = true; // Intentional side effect!!!
+ if ( !assertsEnabled )
+ throw new RuntimeException("Asserts must be enabled for this test.");
+ }
+
+ public static void main(String[] args) {
+ MappedObjectTransformer.register(MappedFloat.class);
+ MappedObjectTransformer.register(MappedVec2.class);
+ MappedObjectTransformer.register(MappedVec3.class);
+ MappedObjectTransformer.register(MappedSomething.class);
+
+ MappedObjectTransformer.register(MappedObjectTests3.Xyz.class);
+
+ if ( MappedObjectClassLoader.fork(TestMappedObject.class, args) ) {
+ return;
+ }
+
+ MappedObjectTests1.testViewField();
+
+ MappedObjectTests2.testFields();
+
+ // MappedObjectBench.benchmarkMapped();
+ // MappedObjectBench.benchmarkInstances();
+ // MappedObjectBench.benchmarkIndirectArray();
+ // MappedObjectBench.benchmarkDirectArray();
+ // MappedObjectBench.benchmarkUnsafe();
+
+ MappedObjectTests3.testMappedBuffer();
+ MappedObjectTests3.testForeach();
+ MappedObjectTests3.testConstructor();
+ MappedObjectTests3.testMappedSet();
+ }
+
+}
\ 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-07-12 07:27:00 UTC (rev 3570)
+++ trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedField.java 2011-07-12 13:29:04 UTC (rev 3571)
@@ -1,19 +1,65 @@
/*
- * Created on Jun 24, 2011
+ * 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;
/**
+ * This annotation can be used on fields of {@link MappedType} classes,
+ * to manually specify byte offsets and lengths. This is useful when the
+ * mapped fields require custom alignment. {@link java.nio.ByteBuffer}
+ * fields are required to have this annotation with a hardcoded byte length.
+ *
* @author Riven
*/
-
@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.FIELD)
public @interface MappedField {
- long byteOffset();
- long byteLength() default -1;
-}
+ /**
+ * Specifies the field byte offset within the mapped object.
+ *
+ * @return the field byte offset
+ */
+ long byteOffset();
+
+ /**
+ * Specifies the field byte length. Required for {@link java.nio.ByteBuffer} fields.
+ *
+ * @return the field byte length
+ */
+ long byteLength() default -1;
+
+}
\ No newline at end of file
Modified: trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedForeach.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedForeach.java 2011-07-12 07:27:00 UTC (rev 3570)
+++ trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedForeach.java 2011-07-12 13:29:04 UTC (rev 3571)
@@ -1,52 +1,72 @@
/*
- * Created on Jul 4, 2011
+ * 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.util.Iterator;
/**
+ * Iterable implementation for {@link MappedObject}.
+ *
* @author Riven
*/
+public class MappedForeach<T extends MappedObject> implements Iterable<T> {
-public class MappedForeach<T extends MappedObject> implements Iterable<T>
-{
- final T mapped;
- final int elementCount;
+ private final T mapped;
+ private final int elementCount;
- MappedForeach(T mapped, int elementCount)
- {
- this.mapped = mapped;
- this.elementCount = elementCount;
- }
+ MappedForeach(T mapped, int elementCount) {
+ this.mapped = mapped;
+ this.elementCount = elementCount;
+ }
- @Override
- public Iterator<T> iterator()
- {
- return new Iterator<T>()
- {
- private int index = 0;
+ public Iterator<T> iterator() {
+ return new Iterator<T>() {
- @Override
- public boolean hasNext()
- {
- return this.index < (MappedForeach.this.elementCount);
- }
+ private int index;
- @Override
- public T next()
- {
- mapped.viewAddress = mapped.baseAddress + (this.index++) * mapped.stride;
+ public boolean hasNext() {
+ return this.index < (MappedForeach.this.elementCount);
+ }
- return mapped;
- }
+ public T next() {
+ mapped.viewAddress = mapped.baseAddress + (this.index++) * mapped.stride;
- @Override
- public void remove()
- {
- throw new UnsupportedOperationException();
- }
- };
- }
-}
+ return mapped;
+ }
+
+ public void remove() {
+ throw new UnsupportedOperationException();
+ }
+ };
+ }
+
+}
\ No newline at end of file
Modified: trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedHelper.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedHelper.java 2011-07-12 07:27:00 UTC (rev 3570)
+++ trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedHelper.java 2011-07-12 13:29:04 UTC (rev 3571)
@@ -1,181 +1,188 @@
/*
- * Created on Jun 28, 2011
+ * 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.nio.ByteBuffer;
/**
+ * [INTERNAL USE ONLY]
+ * <p/>
+ * Helper class used by the bytecode transformer.
+ *
* @author Riven
*/
+public class MappedHelper {
-public class MappedHelper
-{
- public static void setup(MappedObject mo, ByteBuffer buffer, int align, int sizeof)
- {
- if (mo.baseAddress != 0L)
- throw new IllegalStateException("this method should not be called by user-code");
+ public static void setup(MappedObject mo, ByteBuffer buffer, int align, int sizeof) {
+ if ( mo.baseAddress != 0L )
+ throw new IllegalStateException("this method should not be called by user-code");
- if (buffer == null)
- throw new NullPointerException("buffer");
- if (!buffer.isDirect())
- throw new IllegalArgumentException("bytebuffer must be direct");
- mo.preventGC = buffer;
+ if ( buffer == null )
+ throw new NullPointerException("buffer");
+ if ( !buffer.isDirect() )
+ throw new IllegalArgumentException("bytebuffer must be direct");
+ mo.preventGC = buffer;
- if (align <= 0)
- throw new IllegalArgumentException("invalid alignment");
- mo.align = align;
+ if ( align <= 0 )
+ throw new IllegalArgumentException("invalid alignment");
+ mo.align = align;
- if (sizeof % align != 0)
- throw new IllegalStateException("sizeof not a multiple of alignment");
- mo.stride = sizeof;
+ if ( sizeof % align != 0 )
+ throw new IllegalStateException("sizeof not a multiple of alignment");
+ mo.stride = sizeof;
- long addr = MappedObjectUnsafe.getBufferBaseAddress(buffer);
- if (addr % align != 0)
- throw new IllegalStateException("buffer address not aligned on " + align + " bytes");
+ long addr = MappedObjectUnsafe.getBufferBaseAddress(buffer);
+ if ( addr % align != 0 )
+ throw new IllegalStateException("buffer address not aligned on " + align + " bytes");
- mo.baseAddress = mo.viewAddress = addr;
- }
+ mo.baseAddress = mo.viewAddress = addr;
+ }
- public static void put_views(MappedSet2 set, int view)
- {
- set.view(view);
- }
+ public static void put_views(MappedSet2 set, int view) {
+ set.view(view);
+ }
- public static void put_views(MappedSet3 set, int view)
- {
- set.view(view);
- }
+ public static void put_views(MappedSet3 set, int view) {
+ set.view(view);
+ }
- public static void put_views(MappedSet4 set, int view)
- {
- set.view(view);
- }
+ public static void put_views(MappedSet4 set, int view) {
+ set.view(view);
+ }
- public static void put_view(MappedObject mapped, int view)
- {
- mapped.viewAddress = mapped.baseAddress + view * mapped.stride;
- }
+ public static void put_view(MappedObject mapped, int view) {
+ mapped.setViewAddress(mapped.baseAddress + view * mapped.stride);
+ }
- public static int get_view(MappedObject mapped)
- {
- return (int) (mapped.viewAddress - mapped.baseAddress) / mapped.stride;
- }
+ public static int get_view(MappedObject mapped) {
+ return (int)(mapped.viewAddress - mapped.baseAddress) / mapped.stride;
+ }
- public static MappedObject dup(MappedObject src, MappedObject dst)
- {
- dst.baseAddress = src.baseAddress;
- dst.viewAddress = src.viewAddress;
- dst.stride = src.stride;
- dst.align = src.align;
- dst.preventGC = src.preventGC;
- return dst;
- }
+ public static MappedObject dup(MappedObject src, MappedObject dst) {
+ dst.baseAddress = src.baseAddress;
+ dst.viewAddress = src.viewAddress;
+ dst.stride = src.stride;
+ dst.align = src.align;
+ dst.preventGC = src.preventGC;
+ return dst;
+ }
- public static MappedObject slice(MappedObject src, MappedObject dst)
- {
- dst.baseAddress = src.viewAddress; // !
- dst.viewAddress = src.viewAddress;
- dst.stride = src.stride;
- dst.align = src.align;
- dst.preventGC = src.preventGC;
- return dst;
- }
+ public static MappedObject slice(MappedObject src, MappedObject dst) {
+ dst.baseAddress = src.viewAddress; // !
+ dst.viewAddress = src.viewAddress;
+ dst.stride = src.stride;
+ dst.align = src.align;
+ dst.preventGC = src.preventGC;
+ return dst;
+ }
- public static void copy(MappedObject src, MappedObject dst, int bytes)
- {
- MappedObjectUnsafe.INSTANCE.copyMemory(src.viewAddress, dst.viewAddress, bytes);
- }
+ public static void copy(MappedObject src, MappedObject dst, int bytes) {
+ MappedObjectUnsafe.INSTANCE.copyMemory(src.viewAddress, dst.viewAddress, bytes);
+ }
- public static ByteBuffer newBuffer(long address, int capacity)
- {
- return MappedObjectUnsafe.newBuffer(address, capacity);
- }
+ public static ByteBuffer newBuffer(long address, int capacity) {
+ return MappedObjectUnsafe.newBuffer(address, capacity);
+ }
- // ---- primitive fields read/write
+ // ---- primitive fields read/write
- // byte
+ // byte
- public static void bput(byte value, long addr)
- {
- MappedObjectUnsafe.INSTANCE.putByte(addr, value);
- }
+ public static void bput(byte value, long addr) {
+ MappedObjectUnsafe.INSTANCE.putByte(addr, value);
+ }
- public static byte bget(long addr)
- {
- return MappedObjectUnsafe.INSTANCE.getByte(addr);
- }
+ public static byte bget(long addr) {
+ return MappedObjectUnsafe.INSTANCE.getByte(addr);
+ }
- // short
+ // short
- public static void sput(short value, long addr)
- {
- MappedObjectUnsafe.INSTANCE.putShort(addr, value);
- }
+ public static void sput(short value, long addr) {
+ MappedObjectUnsafe.INSTANCE.putShort(addr, value);
+ }
- public static short sget(long addr)
- {
- return MappedObjectUnsafe.INSTANCE.getShort(addr);
- }
+ public static short sget(long addr) {
+ return MappedObjectUnsafe.INSTANCE.getShort(addr);
+ }
- // char
+ // char
- public static void cput(char value, long addr)
- {
- MappedObjectUnsafe.INSTANCE.putChar(addr, value);
- }
+ public static void cput(char value, long addr) {
+ MappedObjectUnsafe.INSTANCE.putChar(addr, value);
+ }
- public static char cget(long addr)
- {
- return MappedObjectUnsafe.INSTANCE.getChar(addr);
- }
+ public static char cget(long addr) {
+ return MappedObjectUnsafe.INSTANCE.getChar(addr);
+ }
- // int
+ // int
- public static void iput(int value, long addr)
- {
- MappedObjectUnsafe.INSTANCE.putInt(addr, value);
- }
+ public static void iput(int value, long addr) {
+ MappedObjectUnsafe.INSTANCE.putInt(addr, value);
+ }
- public static int iget(long addr)
- {
- return MappedObjectUnsafe.INSTANCE.getInt(addr);
- }
+ public static int iget(long addr) {
+ return MappedObjectUnsafe.INSTANCE.getInt(addr);
+ }
- // float
+ // float
- public static void fput(float value, long addr)
- {
- MappedObjectUnsafe.INSTANCE.putFloat(addr, value);
- }
+ public static void fput(float value, long addr) {
+ MappedObjectUnsafe.INSTANCE.putFloat(addr, value);
+ }
- public static float fget(long addr)
- {
- return MappedObjectUnsafe.INSTANCE.getFloat(addr);
- }
+ public static float fget(long addr) {
+ return MappedObjectUnsafe.INSTANCE.getFloat(addr);
+ }
- // long
+ // long
- public static void jput(long value, long addr)
- {
- MappedObjectUnsafe.INSTANCE.putLong(addr, value);
- }
+ public static void jput(long value, long addr) {
+ MappedObjectUnsafe.INSTANCE.putLong(addr, value);
+ }
- public static long jget(long addr)
- {
- return MappedObjectUnsafe.INSTANCE.getLong(addr);
- }
+ public static long jget(long addr) {
+ return MappedObjectUnsafe.INSTANCE.getLong(addr);
+ }
- // double
+ // double
- public static void dput(double value, long addr)
- {
- MappedObjectUnsafe.INSTANCE.putDouble(addr, value);
- }
+ public static void dput(double value, long addr) {
+ MappedObjectUnsafe.INSTANCE.putDouble(addr, value);
+ }
- public static double dget(long addr)
- {
- return MappedObjectUnsafe.INSTANCE.getDouble(addr);
- }
+ public static double dget(long addr) {
+ return MappedObjectUnsafe.INSTANCE.getDouble(addr);
+ }
+
}
\ No newline at end of file
Modified: trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedObject.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedObject.java 2011-07-12 07:27:00 UTC (rev 3570)
+++ trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedObject.java 2011-07-12 13:29:04 UTC (rev 3571)
@@ -1,185 +1,248 @@
/*
- * Created on Jun 25, 2011
+ * 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 java.nio.ByteBuffer;
/**
+ * Base superclass of all mapped objects. Classes that require
+ * data mapping should extend this class and also be annotated
+ * with {@link MappedType}.
+ * <p/>
+ * Subclasses may only specify the default constructor. Any code
+ * inside that constructor is optional, but will not run when the
+ * view is instantiated, see {@link #runViewConstructor()}.
+ * <p/>
+ * Bounds checking may be enabled through a JVM system property: org.lwjgl.util.mapped.Checks=true
+ *
* @author Riven
*/
+public class MappedObject {
-public class MappedObject
-{
- public MappedObject()
- {
- //
- }
+ static final boolean CHECKS = LWJGLUtil.getPrivilegedBoolean("org.lwjgl.util.mapped.Checks");
- // these fields are not assignable/writable by user-code
- public long baseAddress;
- public long viewAddress;
- public int stride;
- public int align;
+ public MappedObject() {
+ //
+ }
- /**
- * Holds the value of sizeof of the sub-type of this MappedObject<br>
- * <br>
- * The behavior of this (transformed) method does not follow the normal Java behavior.<br>
- * <code>Vec2.SIZEOF</code> will yield 8 (2 floats)<br>
- * <code>Vec3.SIZEOF</code> will yield 12 (3 floats)<br>
- * This (required) notation might cause compiler warnings, which can be suppressed with @SuppressWarnings("static-access").<br>
- * Using Java 5.0's static-import on this method will break functionality.
- */
+ /** The mapped object base memory address, in bytes. Read-only. */
+ public long baseAddress;
- // any method that calls these field will have its call-site modified
- public static int SIZEOF = -1; // 'final' per subtype
- public int view; // read/write
+ /** The mapped object view memory address, in bytes. Read-only. */
+ public long viewAddress;
- public final void next()
- {
- this.viewAddress += this.stride;
- }
+ /** The mapped object stride, in bytes. Read-only. */
+ public int stride;
- /**
- * Creates a MappedObject instance, mapping the memory region of the specified direct ByteBuffer.<br>
- * <br>
- * The behavior of this (transformed) method does not follow the normal Java behavior.<br>
- * <code>Vec2.map(buffer)</code> will return a mapped Vec2 instance.<br>
- * <code>Vec3.map(buffer)</code> will return a mapped Vec3 instance.<br>
- * This (required) notation might cause compiler warnings, which can be suppressed with @SuppressWarnings("static-access").<br>
- * Using Java 5.0's static-import on this method will break functionality.
- */
+ /** The mapped object memory alignment, in bytes. Read-only. */
+ public int align;
- @SuppressWarnings("unused")
- public static <T extends MappedObject> T map(ByteBuffer bb)
- {
- // any method that calls this method will have its call-site modified
- throw new InternalError("type not registered");
- }
+ /**
+ * Holds the value of sizeof of the sub-type of this MappedObject<br>
+ * <br>
+ * The behavior of this (transformed) method does not follow the normal Java behavior.<br>
+ * <code>Vec2.SIZEOF</code> will yield 8 (2 floats)<br>
+ * <code>Vec3.SIZEOF</code> will yield 12 (3 floats)<br>
+ * This (required) notation might cause compiler warnings, which can be suppressed with @SuppressWarnings("static-access").<br>
+ * Using Java 5.0's static-import on this method will break functionality.
+ */
+ public static int SIZEOF = -1; // any method that calls these field will have its call-site modified ('final' per subtype)
- @SuppressWarnings("unused")
- public static <T extends MappedObject> T map(long address, int capacity)
- {
- // any method that calls this method will have its call-site modified
- throw new InternalError("ty...
[truncated message content] |
|
From: <ma...@us...> - 2011-07-12 07:27:06
|
Revision: 3570
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3570&view=rev
Author: matzon
Date: 2011-07-12 07:27:00 +0000 (Tue, 12 Jul 2011)
Log Message:
-----------
reverse merging r3567
Removed Paths:
-------------
LWJGL/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2011-07-11 22:21:46
|
Revision: 3569
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3569&view=rev
Author: spasi
Date: 2011-07-11 22:21:40 +0000 (Mon, 11 Jul 2011)
Log Message:
-----------
Added ASM to compilation classpath.
Modified Paths:
--------------
trunk/LWJGL/build.xml
Modified: trunk/LWJGL/build.xml
===================================================================
--- trunk/LWJGL/build.xml 2011-07-11 21:46:00 UTC (rev 3568)
+++ trunk/LWJGL/build.xml 2011-07-11 22:21:40 UTC (rev 3569)
@@ -404,7 +404,7 @@
<!-- Compiles the Java source code -->
<target name="compile" description="Compiles the java source code" depends="-initialize">
- <javac debug="yes" destdir="${lwjgl.bin}" source="1.5" target="1.5" classpath="${lwjgl.lib}/jinput.jar:${lwjgl.lib}/AppleJavaExtensions.jar" taskname="core">
+ <javac debug="yes" destdir="${lwjgl.bin}" source="1.5" target="1.5" classpath="${lwjgl.lib}/jinput.jar:${lwjgl.lib}/AppleJavaExtensions.jar;${lwjgl.lib}/asm.jar;${lwjgl.lib}/asm-util.jar" taskname="core">
<!--<compilerarg value="-Xlint:unchecked"/>-->
<src path="${lwjgl.src}/java/"/>
<src path="${lwjgl.src}/generated/"/>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <riv...@us...> - 2011-07-11 21:46:08
|
Revision: 3568
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3568&view=rev
Author: riven-lwjgl
Date: 2011-07-11 21:46:00 +0000 (Mon, 11 Jul 2011)
Log Message:
-----------
Initial release of mapped objects library (v0.10) in LWJGL.
Added Paths:
-----------
trunk/LWJGL/libs/asm-util.jar
trunk/LWJGL/libs/asm.jar
trunk/LWJGL/src/java/org/lwjgl/util/mapped/
trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedField.java
trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedForeach.java
trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedHelper.java
trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedObject.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/MappedSet.java
trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedSet2.java
trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedSet3.java
trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedSet4.java
trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedType.java
Added: trunk/LWJGL/libs/asm-util.jar
===================================================================
(Binary files differ)
Property changes on: trunk/LWJGL/libs/asm-util.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/LWJGL/libs/asm.jar
===================================================================
(Binary files differ)
Property changes on: trunk/LWJGL/libs/asm.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Property changes on: trunk/LWJGL/src/java/org/lwjgl/util/mapped
___________________________________________________________________
Added: bugtraq:number
+ true
Added: trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedField.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedField.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedField.java 2011-07-11 21:46:00 UTC (rev 3568)
@@ -0,0 +1,19 @@
+/*
+ * Created on Jun 24, 2011
+ */
+
+package org.lwjgl.util.mapped;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * @author Riven
+ */
+
+@Retention(RetentionPolicy.RUNTIME)
+public @interface MappedField {
+ long byteOffset();
+
+ long byteLength() default -1;
+}
Added: trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedForeach.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedForeach.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedForeach.java 2011-07-11 21:46:00 UTC (rev 3568)
@@ -0,0 +1,52 @@
+/*
+ * Created on Jul 4, 2011
+ */
+
+package org.lwjgl.util.mapped;
+
+import java.util.Iterator;
+
+/**
+ * @author Riven
+ */
+
+public class MappedForeach<T extends MappedObject> implements Iterable<T>
+{
+ final T mapped;
+ final int elementCount;
+
+ MappedForeach(T mapped, int elementCount)
+ {
+ this.mapped = mapped;
+ this.elementCount = elementCount;
+ }
+
+ @Override
+ public Iterator<T> iterator()
+ {
+ return new Iterator<T>()
+ {
+ private int index = 0;
+
+ @Override
+ public boolean hasNext()
+ {
+ return this.index < (MappedForeach.this.elementCount);
+ }
+
+ @Override
+ public T next()
+ {
+ mapped.viewAddress = mapped.baseAddress + (this.index++) * mapped.stride;
+
+ return mapped;
+ }
+
+ @Override
+ public void remove()
+ {
+ throw new UnsupportedOperationException();
+ }
+ };
+ }
+}
Added: trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedHelper.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedHelper.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedHelper.java 2011-07-11 21:46:00 UTC (rev 3568)
@@ -0,0 +1,181 @@
+/*
+ * Created on Jun 28, 2011
+ */
+
+package org.lwjgl.util.mapped;
+
+import java.nio.ByteBuffer;
+
+/**
+ * @author Riven
+ */
+
+public class MappedHelper
+{
+ public static void setup(MappedObject mo, ByteBuffer buffer, int align, int sizeof)
+ {
+ if (mo.baseAddress != 0L)
+ throw new IllegalStateException("this method should not be called by user-code");
+
+ if (buffer == null)
+ throw new NullPointerException("buffer");
+ if (!buffer.isDirect())
+ throw new IllegalArgumentException("bytebuffer must be direct");
+ mo.preventGC = buffer;
+
+ if (align <= 0)
+ throw new IllegalArgumentException("invalid alignment");
+ mo.align = align;
+
+ if (sizeof % align != 0)
+ throw new IllegalStateException("sizeof not a multiple of alignment");
+ mo.stride = sizeof;
+
+ long addr = MappedObjectUnsafe.getBufferBaseAddress(buffer);
+ if (addr % align != 0)
+ throw new IllegalStateException("buffer address not aligned on " + align + " bytes");
+
+ mo.baseAddress = mo.viewAddress = addr;
+ }
+
+ public static void put_views(MappedSet2 set, int view)
+ {
+ set.view(view);
+ }
+
+ public static void put_views(MappedSet3 set, int view)
+ {
+ set.view(view);
+ }
+
+ public static void put_views(MappedSet4 set, int view)
+ {
+ set.view(view);
+ }
+
+ public static void put_view(MappedObject mapped, int view)
+ {
+ mapped.viewAddress = mapped.baseAddress + view * mapped.stride;
+ }
+
+ public static int get_view(MappedObject mapped)
+ {
+ return (int) (mapped.viewAddress - mapped.baseAddress) / mapped.stride;
+ }
+
+ public static MappedObject dup(MappedObject src, MappedObject dst)
+ {
+ dst.baseAddress = src.baseAddress;
+ dst.viewAddress = src.viewAddress;
+ dst.stride = src.stride;
+ dst.align = src.align;
+ dst.preventGC = src.preventGC;
+ return dst;
+ }
+
+ public static MappedObject slice(MappedObject src, MappedObject dst)
+ {
+ dst.baseAddress = src.viewAddress; // !
+ dst.viewAddress = src.viewAddress;
+ dst.stride = src.stride;
+ dst.align = src.align;
+ dst.preventGC = src.preventGC;
+ return dst;
+ }
+
+ public static void copy(MappedObject src, MappedObject dst, int bytes)
+ {
+ MappedObjectUnsafe.INSTANCE.copyMemory(src.viewAddress, dst.viewAddress, bytes);
+ }
+
+ public static ByteBuffer newBuffer(long address, int capacity)
+ {
+ return MappedObjectUnsafe.newBuffer(address, capacity);
+ }
+
+ // ---- primitive fields read/write
+
+ // byte
+
+ public static void bput(byte value, long addr)
+ {
+ MappedObjectUnsafe.INSTANCE.putByte(addr, value);
+ }
+
+ public static byte bget(long addr)
+ {
+ return MappedObjectUnsafe.INSTANCE.getByte(addr);
+ }
+
+ // short
+
+ public static void sput(short value, long addr)
+ {
+ MappedObjectUnsafe.INSTANCE.putShort(addr, value);
+ }
+
+ public static short sget(long addr)
+ {
+ return MappedObjectUnsafe.INSTANCE.getShort(addr);
+ }
+
+ // char
+
+ public static void cput(char value, long addr)
+ {
+ MappedObjectUnsafe.INSTANCE.putChar(addr, value);
+ }
+
+ public static char cget(long addr)
+ {
+ return MappedObjectUnsafe.INSTANCE.getChar(addr);
+ }
+
+ // int
+
+ public static void iput(int value, long addr)
+ {
+ MappedObjectUnsafe.INSTANCE.putInt(addr, value);
+ }
+
+ public static int iget(long addr)
+ {
+ return MappedObjectUnsafe.INSTANCE.getInt(addr);
+ }
+
+ // float
+
+ public static void fput(float value, long addr)
+ {
+ MappedObjectUnsafe.INSTANCE.putFloat(addr, value);
+ }
+
+ public static float fget(long addr)
+ {
+ return MappedObjectUnsafe.INSTANCE.getFloat(addr);
+ }
+
+ // long
+
+ public static void jput(long value, long addr)
+ {
+ MappedObjectUnsafe.INSTANCE.putLong(addr, value);
+ }
+
+ public static long jget(long addr)
+ {
+ return MappedObjectUnsafe.INSTANCE.getLong(addr);
+ }
+
+ // double
+
+ public static void dput(double value, long addr)
+ {
+ MappedObjectUnsafe.INSTANCE.putDouble(addr, value);
+ }
+
+ public static double dget(long addr)
+ {
+ return MappedObjectUnsafe.INSTANCE.getDouble(addr);
+ }
+}
\ No newline at end of file
Added: trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedObject.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedObject.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedObject.java 2011-07-11 21:46:00 UTC (rev 3568)
@@ -0,0 +1,185 @@
+/*
+ * Created on Jun 25, 2011
+ */
+
+package org.lwjgl.util.mapped;
+
+import java.nio.ByteBuffer;
+
+/**
+ * @author Riven
+ */
+
+public class MappedObject
+{
+ public MappedObject()
+ {
+ //
+ }
+
+ // these fields are not assignable/writable by user-code
+ public long baseAddress;
+ public long viewAddress;
+ public int stride;
+ public int align;
+
+ /**
+ * Holds the value of sizeof of the sub-type of this MappedObject<br>
+ * <br>
+ * The behavior of this (transformed) method does not follow the normal Java behavior.<br>
+ * <code>Vec2.SIZEOF</code> will yield 8 (2 floats)<br>
+ * <code>Vec3.SIZEOF</code> will yield 12 (3 floats)<br>
+ * This (required) notation might cause compiler warnings, which can be suppressed with @SuppressWarnings("static-access").<br>
+ * Using Java 5.0's static-import on this method will break functionality.
+ */
+
+ // any method that calls these field will have its call-site modified
+ public static int SIZEOF = -1; // 'final' per subtype
+ public int view; // read/write
+
+ public final void next()
+ {
+ this.viewAddress += this.stride;
+ }
+
+ /**
+ * Creates a MappedObject instance, mapping the memory region of the specified direct ByteBuffer.<br>
+ * <br>
+ * The behavior of this (transformed) method does not follow the normal Java behavior.<br>
+ * <code>Vec2.map(buffer)</code> will return a mapped Vec2 instance.<br>
+ * <code>Vec3.map(buffer)</code> will return a mapped Vec3 instance.<br>
+ * This (required) notation might cause compiler warnings, which can be suppressed with @SuppressWarnings("static-access").<br>
+ * Using Java 5.0's static-import on this method will break functionality.
+ */
+
+ @SuppressWarnings("unused")
+ public static <T extends MappedObject> T map(ByteBuffer bb)
+ {
+ // any method that calls this method will have its call-site modified
+ throw new InternalError("type not registered");
+ }
+
+ @SuppressWarnings("unused")
+ public static <T extends MappedObject> T map(long address, int capacity)
+ {
+ // any method that calls this method will have its call-site modified
+ throw new InternalError("type not registered");
+ }
+
+ /**
+ * Creates a MappedObject instance, mapping the memory region of an allocated direct ByteBuffer with a capacity of <code>elementCount*SIZEOF</code>
+ * <br>
+ * The behavior of this (transformed) method does not follow the normal Java behavior.<br>
+ * <code>Vec2.malloc(int)</code> will return a mapped Vec2 instance.<br>
+ * <code>Vec3.malloc(int)</code> will return a mapped Vec3 instance.<br>
+ * This (required) notation might cause compiler warnings, which can be suppressed with @SuppressWarnings("static-access").<br>
+ * Using Java 5.0's static-import on this method will break functionality.
+ */
+
+ @SuppressWarnings("unused")
+ public static <T extends MappedObject> T malloc(int elementCount)
+ {
+ // any method that calls this method will have its call-site modified
+ throw new InternalError("type not registered");
+ }
+
+ /**
+ * Creates an identical new MappedObject instance, comparable to the
+ * contract of ByteBuffer.duplicate()
+ */
+
+ public final <T extends MappedObject> T dup()
+ {
+ // any method that calls this method will have its call-site modified
+ throw new InternalError("type not registered");
+ }
+
+ /**
+ * Creates a new MappedObject instance, with a base offset equal to
+ * the offset of the current view, comparable to the contract of ByteBuffer.slice()
+ */
+
+ public final <T extends MappedObject> T slice()
+ {
+ // any method that calls this method will have its call-site modified
+ throw new InternalError("type not registered");
+ }
+
+ public final <T extends MappedObject> void runViewConstructor()
+ {
+ // any method that calls this method will have its call-site modified
+ throw new InternalError("type not registered");
+ }
+
+ /**
+ * Copies and amount of <code>SIZEOF</code> bytes, from the current
+ * mapped object, to the specified mapped object.
+ */
+
+ @SuppressWarnings("unused")
+ public final <T extends MappedObject> void copyTo(T target)
+ {
+ // any method that calls this method will have its call-site modified
+ throw new InternalError("type not registered");
+ }
+
+ /**
+ * Copies and amount of <code>SIZEOF*instances<c/ode> bytes, from the
+ * current mapped object, to the specified mapped object.
+ */
+
+ @SuppressWarnings("unused")
+ public final <T extends MappedObject> void copyRange(T target, int instances)
+ {
+ // any method that calls this method will have its call-site modified
+ throw new InternalError("type not registered");
+ }
+
+ /**
+ * Creates an Iterable<MappedObject> that will step through
+ * <code>elementCount</code> views, leaving the <code>view</code> at
+ * the last valid value.<br>
+ * <br>
+ * 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> MappedForeach<T> foreach(T mapped, int elementCount)
+ {
+ return new MappedForeach<T>(mapped, elementCount);
+ }
+
+ /**
+ * Configures a newly initiated mapped object with the specified stride and offset.
+ * @throws IllegalStateException if view is not at index 0
+ */
+
+ public static final <T extends MappedObject> T configure(T mapped, int stride, int offset)
+ {
+ if (mapped.baseAddress != mapped.viewAddress)
+ throw new IllegalStateException("view must be zero");
+
+ if (offset < 0)
+ throw new IllegalStateException("offset must not be negative: " + offset);
+ if (offset % mapped.align != 0)
+ throw new IllegalStateException("offset not a multiple of alignment: " + offset);
+
+ if (stride < mapped.stride)
+ throw new IllegalStateException("new stride must not be smaller than current stride: " + stride);
+ if (stride % mapped.align != 0)
+ throw new IllegalStateException("stride not a multiple of alignment: " + stride);
+
+ mapped.baseAddress += offset;
+ mapped.viewAddress += offset;
+ mapped.stride = stride;
+
+ return mapped;
+ }
+
+ ByteBuffer preventGC;
+
+ public ByteBuffer backingByteBuffer()
+ {
+ return this.preventGC;
+ }
+}
Added: trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedObjectClassLoader.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedObjectClassLoader.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedObjectClassLoader.java 2011-07-11 21:46:00 UTC (rev 3568)
@@ -0,0 +1,136 @@
+/*
+ * Created on Jun 24, 2011
+ */
+
+package org.lwjgl.util.mapped;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.net.URLClassLoader;
+import java.util.Arrays;
+
+/**
+ * @author Riven
+ */
+
+public class MappedObjectClassLoader extends URLClassLoader
+{
+ static final String MAPPEDOBJECT_PACKAGE_PREFIX;
+
+ static
+ {
+ MAPPEDOBJECT_PACKAGE_PREFIX = MappedObjectClassLoader.class.getPackage().getName() + ".";
+ }
+
+ static boolean FORKED = false;
+
+ public static boolean fork(Class< ? > mainClass, String[] args)
+ {
+ if (FORKED)
+ {
+ return false;
+ }
+
+ FORKED = true;
+
+ try
+ {
+ URLClassLoader loader = new MappedObjectClassLoader(mainClass);
+ Class< ? > replacedMainClass = loader.loadClass(mainClass.getName());
+ Method mainMethod = replacedMainClass.getMethod("main", String[].class);
+ mainMethod.invoke(null, new Object[] { args });
+ }
+ catch (InvocationTargetException exc)
+ {
+ Thread.currentThread().getUncaughtExceptionHandler().uncaughtException(Thread.currentThread(), exc.getCause());
+ }
+ catch (Throwable cause)
+ {
+ throw new Error("failed to fork", cause);
+ }
+
+ return true;
+ }
+
+ private MappedObjectClassLoader(Class< ? > mainClass)
+ {
+ super(((URLClassLoader) mainClass.getClassLoader()).getURLs());
+ }
+
+ private static long total_time_transforming;
+
+ @Override
+ protected synchronized Class< ? > loadClass(String name, boolean resolve) throws ClassNotFoundException
+ {
+ if (name.startsWith("java."))
+ 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);
+
+ // never transform classes in this very package, sub-packages should be transformed
+ if (name.startsWith(MAPPEDOBJECT_PACKAGE_PREFIX))
+ if (name.substring(MAPPEDOBJECT_PACKAGE_PREFIX.length()).indexOf('.') == -1)
+ return super.loadClass(name, resolve);
+
+ String className = name.replace('.', '/');
+
+ if (MappedObjectTransformer.PRINT_ACTIVITY)
+ System.out.println(MappedObjectClassLoader.class.getSimpleName() + ": " + className);
+
+ byte[] bytecode = readStream(this.getResourceAsStream(className.concat(".class")));
+
+ long t0 = System.nanoTime();
+ bytecode = MappedObjectTransformer.transformFieldAccess(className, bytecode);
+ long t1 = System.nanoTime();
+ total_time_transforming += (t1 - t0);
+
+ if (MappedObjectTransformer.PRINT_TIMING)
+ System.out.println("transforming " + className + " took " + (t1 - t0) / 1000 + " micros (total: " + (total_time_transforming / 1000 / 1000) + "ms)");
+
+ Class< ? > clazz = super.defineClass(name, bytecode, 0, bytecode.length);
+ if (resolve)
+ resolveClass(clazz);
+ return clazz;
+ }
+
+ static byte[] readStream(InputStream in)
+ {
+ byte[] bytecode = new byte[256];
+ int len = 0;
+ try
+ {
+ while (true)
+ {
+ if (bytecode.length == len)
+ bytecode = Arrays.copyOf(bytecode, len * 2);
+ int got = in.read(bytecode, len, bytecode.length - len);
+ if (got == -1)
+ break;
+ len += got;
+ }
+ }
+ catch (IOException exc)
+ {
+ // stop!
+ }
+ finally
+ {
+ try
+ {
+ in.close();
+ }
+ catch (IOException exc)
+ {
+ // ignore...
+ }
+ }
+ return Arrays.copyOf(bytecode, len);
+ }
+}
Added: trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedObjectTransformer.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedObjectTransformer.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedObjectTransformer.java 2011-07-11 21:46:00 UTC (rev 3568)
@@ -0,0 +1,588 @@
+/*
+ * Created on Jun 23, 2011
+ */
+
+package org.lwjgl.util.mapped;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.nio.ByteBuffer;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.objectweb.asm.*;
+import org.objectweb.asm.util.TraceClassVisitor;
+import static org.objectweb.asm.Opcodes.*;
+
+/**
+ * @author Riven
+ */
+
+public class MappedObjectTransformer
+{
+ static final boolean PRINT_TIMING = true;
+ static final boolean PRINT_ACTIVITY = false;
+ static final boolean PRINT_BYTECODE = false;
+ static final Map<String, MappedSubtypeInfo> className_to_subtype;
+
+ static
+ {
+ className_to_subtype = new HashMap<String, MappedSubtypeInfo>();
+
+ {
+ // HACK: required for mapped.view++
+ //
+ // because the compiler generates:
+ // => GETFIELD MappedObject.view
+ // => ICONST_1
+ // => IADD
+ // => PUTFIELD MyMappedType.view
+ //
+ // instead of:
+ // => GETFIELD MyMappedType.view
+ // => ICONST_1
+ // => IADD
+ // => PUTFIELD MyMappedType.view
+ //
+ MappedSubtypeInfo info = new MappedSubtypeInfo(jvmClassName(MappedObject.class), -1, -1);
+ className_to_subtype.put(info.className, info);
+ }
+
+ String vmName = System.getProperty("java.vm.name");
+ if (vmName != null && !vmName.contains("Server"))
+ {
+ System.err.println("Warning: " + MappedObject.class.getSimpleName() + "s have inferiour performance on Client VMs, please consider switching to a Server VM.");
+ }
+ }
+
+ public static void register(Class< ? > type)
+ {
+ if (MappedObjectClassLoader.FORKED)
+ return;
+
+ MappedType mapped = type.getAnnotation(MappedType.class);
+ if (mapped == null)
+ throw new InternalError("missing " + MappedType.class.getName() + " annotation");
+
+ String className = jvmClassName(type);
+
+ MappedSubtypeInfo mappedType = new MappedSubtypeInfo(className, mapped.sizeof(), mapped.align());
+
+ int advancingOffset = 0;
+
+ for (Field field : type.getDeclaredFields())
+ {
+ // static fields are never mapped
+ if ((field.getModifiers() & Modifier.STATIC) != 0)
+ continue;
+
+ // we only support primitives and ByteBuffers
+ if (!field.getType().isPrimitive() && field.getType() != ByteBuffer.class)
+ throw new InternalError("field '" + className + "." + field.getName() + "' not supported: " + field.getType());
+
+ MappedField meta = field.getAnnotation(MappedField.class);
+ if (meta == null && !mapped.autoGenerateOffsets())
+ throw new InternalError("field '" + className + "." + field.getName() + "' missing annotation " + MappedField.class.getName() + ": " + className);
+
+ // quick hack
+ long byteOffset = meta == null ? advancingOffset : meta.byteOffset();
+ long byteLength;
+ if (field.getType() == long.class || field.getType() == double.class)
+ byteLength = 8;
+ else if (field.getType() == int.class || field.getType() == float.class)
+ byteLength = 4;
+ else if (field.getType() == char.class || field.getType() == short.class)
+ byteLength = 2;
+ else if (field.getType() == byte.class)
+ byteLength = 1;
+ else if (field.getType() == ByteBuffer.class)
+ byteLength = meta.byteLength();
+ else
+ throw new IllegalStateException(field.getType().getName());
+
+ if (field.getType() != ByteBuffer.class)
+ if ((advancingOffset % byteLength) != 0)
+ throw new IllegalStateException("misaligned mapped type: " + className + "." + field.getName());
+
+ if (PRINT_ACTIVITY)
+ System.out.println(MappedObjectTransformer.class.getSimpleName() + ": " + className + "." + field.getName() + " [type=" + field.getType().getSimpleName() + ", offset=" + byteOffset + "]");
+
+ mappedType.fieldToOffset.put(field.getName(), Long.valueOf(byteOffset));
+ mappedType.fieldToLength.put(field.getName(), Long.valueOf(byteLength));
+
+ advancingOffset += byteLength;
+ }
+
+ if (className_to_subtype.put(className, mappedType) != null)
+ {
+ throw new InternalError("duplicate mapped type: " + className);
+ }
+ }
+
+ public static final String view_constructor_method = "_construct_view_";
+
+ public static byte[] transformFieldAccess(final String className, byte[] bytecode)
+ {
+ int flags = ClassWriter.COMPUTE_FRAMES;
+
+ ClassWriter writer = new ClassWriter(flags);
+
+ ClassAdapter adapter = new ClassAdapter(writer)
+ {
+ @Override
+ public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions)
+ {
+ {
+ MappedSubtypeInfo mappedSubtype = className_to_subtype.get(className);
+
+ if (mappedSubtype != null && !mappedSubtype.className.equals(jvmClassName(MappedObject.class)))
+ {
+ if (name.equals("<init>"))
+ {
+ if (!desc.equals("()V"))
+ throw new IllegalStateException(className + " can only have a default constructor, found: " + desc);
+
+ MethodVisitor mv = super.visitMethod(access, name, desc, signature, exceptions);
+ mv.visitCode();
+ mv.visitVarInsn(ALOAD, 0);
+ mv.visitMethodInsn(INVOKESPECIAL, jvmClassName(MappedObject.class), "<init>", "()V");
+ mv.visitInsn(RETURN);
+ mv.visitMaxs(1, 1);
+ mv.visitEnd();
+
+ // put the method body in another method
+ name = view_constructor_method;
+ }
+ }
+ }
+
+ return new MappedInstanceMethodAdapter(className, name, desc, super.visitMethod(access, name, desc, signature, exceptions));
+ }
+
+ @Override
+ public FieldVisitor visitField(int access, String fieldName, String typeName, String dunno, Object value)
+ {
+ // remove redirected fields
+ MappedSubtypeInfo mappedSubtype = className_to_subtype.get(className);
+
+ if (mappedSubtype != null && mappedSubtype.fieldToOffset.containsKey(fieldName))
+ {
+ if (PRINT_ACTIVITY)
+ System.out.println(MappedObjectTransformer.class.getSimpleName() + ": discarding field: " + className + "." + fieldName + ":" + typeName);
+ return null;
+ }
+
+ return super.visitField(access, fieldName, typeName, dunno, value);
+ }
+ };
+
+ new ClassReader(bytecode).accept(adapter, 0);
+ bytecode = writer.toByteArray();
+
+ if (PRINT_BYTECODE)
+ printBytecode(bytecode, adapter);
+
+ return bytecode;
+ }
+
+ static void printBytecode(byte[] bytecode, ClassAdapter adapter)
+ {
+ StringWriter sw = new StringWriter();
+ ClassVisitor tracer = new TraceClassVisitor(adapter, new PrintWriter(sw));
+ new ClassReader(bytecode).accept(tracer, 0);
+ String dump = sw.toString();
+
+ System.out.println(dump);
+ }
+
+ static void throwException0(MethodVisitor visitor, Class< ? > type, String msg)
+ {
+ String errorType = jvmClassName(type);
+
+ visitor.visitTypeInsn(NEW, errorType);
+ visitor.visitInsn(DUP);
+ visitor.visitLdcInsn(msg);
+ visitor.visitMethodInsn(INVOKESPECIAL, errorType, "<init>", "(Ljava/lang/String;)V");
+ visitor.visitInsn(ATHROW);
+ }
+
+ static class MappedInstanceMethodAdapter extends MethodAdapter
+ {
+ private final String className;
+ private final String methodName;
+ private final String descr;
+
+ public MappedInstanceMethodAdapter(String className, String methodName, String descr, MethodVisitor backing)
+ {
+ super(backing);
+ this.className = className;
+ this.methodName = methodName;
+ this.descr = descr;
+ }
+
+ @Override
+ public void visitTypeInsn(int opcode, String typeName)
+ {
+ if (opcode == NEW && className_to_subtype.containsKey(typeName))
+ {
+ throw new IllegalAccessError("must not manually create instances of " + typeName + " in method " + this.className + "." + this.methodName + this.descr);
+ }
+
+ super.visitTypeInsn(opcode, typeName);
+ }
+
+ @Override
+ public void visitMethodInsn(int opcode, String className, String methodName, String signature)
+ {
+ if (opcode == INVOKESPECIAL && className.equals(jvmClassName(MappedObject.class)) && methodName.equals("<init>") && signature.equals("()V"))
+ {
+ // stack: instance
+ visitInsn(POP);
+ // stack: -
+ return;
+ }
+
+ for (MappedSubtypeInfo mappedType : className_to_subtype.values())
+ {
+ boolean isMapDirectMethod = (opcode == INVOKESTATIC && methodName.equals("map") && className.equals(mappedType.className) && signature.equals("(JI)L" + jvmClassName(MappedObject.class) + ";"));
+ boolean isMapBufferMethod = (opcode == INVOKESTATIC && methodName.equals("map") && className.equals(mappedType.className) && signature.equals("(Ljava/nio/ByteBuffer;)L" + jvmClassName(MappedObject.class) + ";"));
+ boolean isMallocMethod = (opcode == INVOKESTATIC && methodName.equals("malloc") && className.equals(mappedType.className) && signature.equals("(I)L" + jvmClassName(MappedObject.class) + ";"));
+
+ if ((isMapDirectMethod || isMapBufferMethod) || isMallocMethod)
+ {
+ if (isMallocMethod)
+ {
+ // stack: count
+ pushInt(super.mv, mappedType.sizeof);
+ // stack: sizeof, count
+ super.visitInsn(IMUL);
+ // stack: bytes
+ super.visitMethodInsn(INVOKESTATIC, jvmClassName(ByteBuffer.class), "allocateDirect", "(I)L" + jvmClassName(ByteBuffer.class) + ";");
+ // stack: buffer
+ }
+ else if (isMapDirectMethod)
+ {
+ // stack: capacity, address
+ super.visitMethodInsn(INVOKESTATIC, jvmClassName(MappedHelper.class), "newBuffer", "(JI)L" + jvmClassName(ByteBuffer.class) + ";");
+ // stack: buffer
+ }
+
+ // stack: buffer
+ super.visitTypeInsn(NEW, className);
+ // stack: new, buffer
+ super.visitInsn(DUP);
+ // stack: new, new, buffer
+ super.visitMethodInsn(INVOKESPECIAL, className, "<init>", "()V");
+ // stack: new, buffer
+ super.visitInsn(DUP_X1);
+ // stack: new, buffer, new
+ super.visitInsn(SWAP);
+ // stack: buffer, new, new
+ pushInt(super.mv, mappedType.align);
+ // stack: int, buffer, new, new
+ pushInt(super.mv, mappedType.sizeof);
+ // stack: int, int, buffer, new, new
+ super.visitMethodInsn(INVOKESTATIC, jvmClassName(MappedHelper.class), "setup", "(L" + jvmClassName(MappedObject.class) + ";Ljava/nio/ByteBuffer;II)V");
+ // stack: new
+ return;
+ }
+
+ if (opcode == INVOKEVIRTUAL && methodName.equals("dup") && className.equals(mappedType.className) && signature.equals("()L" + jvmClassName(MappedObject.class) + ";"))
+ {
+ // stack: this
+ super.visitTypeInsn(NEW, className);
+ // stack: new, this
+ super.visitInsn(DUP);
+ // stack: new, new, this
+ super.visitMethodInsn(INVOKESPECIAL, className, "<init>", "()V");
+ // stack: new, this
+ super.visitMethodInsn(INVOKESTATIC, jvmClassName(MappedHelper.class), "dup", "(L" + jvmClassName(MappedObject.class) + ";L" + jvmClassName(MappedObject.class) + ";)L" + jvmClassName(MappedObject.class) + ";");
+ // stack: new
+ return;
+ }
+
+ if (opcode == INVOKEVIRTUAL && methodName.equals("slice") && className.equals(mappedType.className) && signature.equals("()L" + jvmClassName(MappedObject.class) + ";"))
+ {
+ // stack: this
+ super.visitTypeInsn(NEW, className);
+ // stack: new, this
+ super.visitInsn(DUP);
+ // stack: new, new, this
+ super.visitMethodInsn(INVOKESPECIAL, className, "<init>", "()V");
+ // stack: new, this
+ super.visitMethodInsn(INVOKESTATIC, jvmClassName(MappedHelper.class), "slice", "(L" + jvmClassName(MappedObject.class) + ";L" + jvmClassName(MappedObject.class) + ";)L" + jvmClassName(MappedObject.class) + ";");
+ // stack: new
+ return;
+ }
+
+ //
+
+ if (opcode == INVOKEVIRTUAL && methodName.equals("runViewConstructor") && className.equals(mappedType.className) && signature.equals("()V"))
+ {
+ // stack: this
+ super.visitInsn(DUP);
+ // stack: this, this
+ super.visitMethodInsn(INVOKEVIRTUAL, className, view_constructor_method, "()V");
+ // stack: this
+ return;
+ }
+
+ //
+
+ if (opcode == INVOKEVIRTUAL && methodName.equals("copyTo") && className.equals(mappedType.className) && signature.equals("(L" + jvmClassName(MappedObject.class) + ";)V"))
+ {
+ // stack: target, this
+ pushInt(super.mv, mappedType.sizeof);
+ // stack: sizeof, target, this
+ super.visitMethodInsn(INVOKESTATIC, jvmClassName(MappedHelper.class), "copy", "(L" + jvmClassName(MappedObject.class) + ";L" + jvmClassName(MappedObject.class) + ";I)V");
+ // stack: -
+ return;
+ }
+
+ if (opcode == INVOKEVIRTUAL && methodName.equals("copyRange") && className.equals(mappedType.className) && signature.equals("(L" + jvmClassName(MappedObject.class) + ";I)V"))
+ {
+ // stack: instances, target, this
+ pushInt(super.mv, mappedType.sizeof);
+ // stack: sizeof, instances, target, this
+ super.visitInsn(IMUL);
+ // stack: bytes, target, this
+ super.visitMethodInsn(INVOKESTATIC, jvmClassName(MappedHelper.class), "copy", "(L" + jvmClassName(MappedObject.class) + ";L" + jvmClassName(MappedObject.class) + ";I)V");
+ // stack: -
+ return;
+ }
+ }
+
+ super.visitMethodInsn(opcode, className, methodName, signature);
+ }
+
+ static void throwAccessErrorOnReadOnlyField(String className, String fieldName)
+ {
+ throw new IllegalAccessError("field '" + className + "." + fieldName + "' is final");
+ }
+
+ @Override
+ public void visitFieldInsn(int opcode, String className, String fieldName, String typeName)
+ {
+ MappedSubtypeInfo mappedSubtype = className_to_subtype.get(className);
+ if (mappedSubtype == null)
+ {
+ String mappedSetPrefix = jvmClassName(MappedSet.class);
+
+ outer: if (fieldName.equals("view") && className.startsWith(mappedSetPrefix))
+ {
+ if (opcode == GETFIELD)
+ throwAccessErrorOnReadOnlyField(className, fieldName);
+ if (opcode != PUTFIELD)
+ break outer;
+
+ // stack: index, this
+ if (false)
+ break outer;
+ else if (className.equals(jvmClassName(MappedSet2.class)))
+ super.visitMethodInsn(INVOKESTATIC, jvmClassName(MappedHelper.class), "put_views", "(L" + jvmClassName(MappedSet2.class) + ";I)V");
+ else if (className.equals(jvmClassName(MappedSet3.class)))
+ super.visitMethodInsn(INVOKESTATIC, jvmClassName(MappedHelper.class), "put_views", "(L" + jvmClassName(MappedSet3.class) + ";I)V");
+ else if (className.equals(jvmClassName(MappedSet4.class)))
+ super.visitMethodInsn(INVOKESTATIC, jvmClassName(MappedHelper.class), "put_views", "(L" + jvmClassName(MappedSet4.class) + ";I)V");
+ else
+ break outer;
+ // stack: -
+ return;
+ }
+
+ // early out
+ super.visitFieldInsn(opcode, className, fieldName, typeName);
+ return;
+ }
+
+ if (fieldName.equals("SIZEOF"))
+ {
+ if (!typeName.equals("I"))
+ throw new IllegalStateException();
+
+ if (opcode == GETSTATIC)
+ {
+ pushInt(super.mv, mappedSubtype.sizeof);
+ return;
+ }
+ if (opcode == PUTSTATIC)
+ {
+ throwAccessErrorOnReadOnlyField(className, fieldName);
+ }
+ }
+
+ if (fieldName.equals("view"))
+ {
+ if (!typeName.equals("I"))
+ throw new IllegalStateException();
+
+ if (opcode == GETFIELD)
+ {
+ // stack: instance
+ super.visitMethodInsn(INVOKESTATIC, jvmClassName(MappedHelper.class), "get_view", "(L" + jvmClassName(MappedObject.class) + ";)I");
+ return;
+ }
+ if (opcode == PUTFIELD)
+ {
+ // stack: int, instance
+ super.visitMethodInsn(INVOKESTATIC, jvmClassName(MappedHelper.class), "put_view", "(L" + jvmClassName(MappedObject.class) + ";I)V");
+ return;
+ }
+ }
+
+ if (fieldName.equals("align"))
+ {
+ if (!typeName.equals("I"))
+ throw new IllegalStateException();
+
+ if (opcode == GETFIELD)
+ {
+ // stack: instance
+ super.visitInsn(POP);
+ // stack: -
+ pushInt(super.mv, mappedSubtype.align);
+ // stack: int
+ return;
+ }
+ if (opcode == PUTFIELD)
+ {
+ throwAccessErrorOnReadOnlyField(className, fieldName);
+ }
+ }
+
+ if (fieldName.equals("stride"))
+ {
+ if (!typeName.equals("I"))
+ throw new IllegalStateException();
+
+ if (opcode == GETFIELD)
+ {
+ // do not change a thing
+ }
+ if (opcode == PUTFIELD)
+ {
+ throwAccessErrorOnReadOnlyField(className, fieldName);
+ }
+ }
+
+ if (fieldName.equals("baseAddress") || fieldName.equals("viewAddress"))
+ {
+ if (!typeName.equals("J"))
+ throw new IllegalStateException();
+
+ if (opcode == GETFIELD)
+ {
+ // do not change a thing
+ }
+ if (opcode == PUTFIELD)
+ {
+ throwAccessErrorOnReadOnlyField(className, fieldName);
+ }
+ }
+
+ Long fieldOffset = mappedSubtype.fieldToOffset.get(fieldName);
+ if (fieldOffset == null)
+ {
+ // early out
+ super.visitFieldInsn(opcode, className, fieldName, typeName);
+ return;
+ }
+
+ if (typeName.equals("L" + jvmClassName(ByteBuffer.class) + ";"))
+ {
+ if (opcode == PUTFIELD)
+ {
+ throwAccessErrorOnReadOnlyField(className, fieldName);
+ }
+ if (opcode == GETFIELD)
+ {
+ Long fieldLength = mappedSubtype.fieldToLength.get(fieldName);
+
+ super.visitFieldInsn(GETFIELD, mappedSubtype.className, "viewAddress", "J");
+ super.visitLdcInsn(fieldOffset);
+ super.visitInsn(LADD);
+ super.visitLdcInsn(fieldLength);
+ super.visitInsn(L2I);
+ super.visitMethodInsn(INVOKESTATIC, jvmClassName(MappedHelper.class), "newBuffer", "(JI)L" + jvmClassName(ByteBuffer.class) + ";");
+
+ return;
+ }
+ }
+
+ if (opcode == PUTFIELD)
+ {
+ super.visitInsn(SWAP);
+ super.visitFieldInsn(GETFIELD, mappedSubtype.className, "viewAddress", "J");
+ super.visitLdcInsn(fieldOffset);
+ super.visitInsn(LADD);
+ super.visitMethodInsn(INVOKESTATIC, jvmClassName(MappedHelper.class), typeName.toLowerCase() + "put", "(" + typeName + "J)V");
+ return;
+ }
+ if (opcode == GETFIELD)
+ {
+ super.visitFieldInsn(GETFIELD, mappedSubtype.className, "viewAddress", "J");
+ super.visitLdcInsn(fieldOffset);
+ super.visitInsn(LADD);
+ super.visitMethodInsn(INVOKESTATIC, jvmClassName(MappedHelper.class), typeName.toLowerCase() + "get", "(J)" + typeName);
+ return;
+ }
+
+ // original field access
+ super.visitFieldInsn(opcode, className, fieldName, typeName);
+ return;
+ }
+ }
+
+ static void pushInt(MethodVisitor mv, int value)
+ {
+ if (value == -1)
+ mv.visitInsn(ICONST_M1);
+ else if (value == 0)
+ mv.visitInsn(ICONST_0);
+ else if (value == 1)
+ mv.visitInsn(ICONST_1);
+ else if (value == 2)
+ mv.visitInsn(ICONST_2);
+ else if (value == 3)
+ mv.visitInsn(ICONST_3);
+ else if (value == 4)
+ mv.visitInsn(ICONST_4);
+ else if (value == 5)
+ mv.visitInsn(ICONST_5);
+ else if (value >= Byte.MIN_VALUE && value <= Byte.MAX_VALUE)
+ mv.visitIntInsn(BIPUSH, value);
+ else if (value >= Short.MIN_VALUE && value <= Short.MAX_VALUE)
+ mv.visitIntInsn(SIPUSH, value);
+ else
+ mv.visitLdcInsn(Integer.valueOf(value));
+ }
+
+ static String jvmClassName(Class< ? > type)
+ {
+ return type.getName().replace('.', '/');
+ }
+
+ static class MappedSubtypeInfo
+ {
+ public final String className;
+
+ public int sizeof;
+ public int align;
+
+ public Map<String, Long> fieldToOffset;
+ public Map<String, Long> fieldToLength;
+
+ public MappedSubtypeInfo(String className, int sizeof, int align)
+ {
+ this.className = className;
+
+ this.sizeof = sizeof;
+ this.align = align;
+
+ this.fieldToOffset = new HashMap<String, Long>();
+ this.fieldToLength = new HashMap<String, Long>();
+ }
+ }
+}
\ No newline at end of file
Added: trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedObjectUnsafe.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedObjectUnsafe.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedObjectUnsafe.java 2011-07-11 21:46:00 UTC (rev 3568)
@@ -0,0 +1,83 @@
+/*
+ * Created on Jun 24, 2011
+ */
+
+package org.lwjgl.util.mapped;
+
+import java.lang.reflect.Field;
+import java.nio.Buffer;
+import java.nio.ByteBuffer;
+
+import sun.misc.Unsafe;
+
+/**
+ * @author Riven
+ */
+
+public class MappedObjectUnsafe
+{
+ public static final Unsafe INSTANCE = getUnsafeInstance();
+ public static final int ADDRESS_SIZE = INSTANCE.addressSize();
+ private static final Object[] ARRAY = new Object[1];
+ private static final long ARRAY_ELEMENT_OFFSET = INSTANCE.arrayBaseOffset(ARRAY.getClass());
+
+ private static final long BUFFER_ADDRESS_OFFSET = getObjectFieldOffset(ByteBuffer.class, "address");
+ private static final long BUFFER_CAPACITY_OFFSET = getObjectFieldOffset(ByteBuffer.class, "capacity");
+
+ //
+
+ public static long getBufferBaseAddress(Buffer buffer)
+ {
+ return INSTANCE.getLong(buffer, BUFFER_ADDRESS_OFFSET);
+ }
+
+ private static final ByteBuffer global = ByteBuffer.allocateDirect(4 * 1024);
+
+ public static ByteBuffer newBuffer(long address, int capacity)
+ {
+ if (address <= 0L || capacity < 0)
+ throw new IllegalStateException("you almost crashed the jvm");
+
+ ByteBuffer buffer = global.duplicate();
+ INSTANCE.putLong(buffer, BUFFER_ADDRESS_OFFSET, address);
+ INSTANCE.putInt(buffer, BUFFER_CAPACITY_OFFSET, capacity);
+ buffer.position(0);
+ buffer.limit(capacity);
+ return buffer;
+ }
+
+
+
+ private static long getObjectFieldOffset(Class< ? > type, String fieldName)
+ {
+ while (type != null)
+ {
+ try
+ {
+ return INSTANCE.objectFieldOffset(type.getDeclaredField(fieldName));
+ }
+ catch (Throwable t)
+ {
+ type = type.getSuperclass();
+ }
+ }
+ throw new InternalError();
+ }
+
+ private static Unsafe getUnsafeInstance()
+ {
+ try
+ {
+ ByteBuffer buffer = ByteBuffer.allocateDirect(1);
+ Field unsafeField = buffer.getClass().getDeclaredField("unsafe");
+ unsafeField.setAccessible(true);
+ Unsafe instance = (Unsafe) unsafeField.get(buffer);
+ buffer.flip(); // prevented 'buffer' from being gc'ed
+ return instance;
+ }
+ catch (Exception exc)
+ {
+ throw new InternalError();
+ }
+ }
+}
Added: trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedSet.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedSet.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedSet.java 2011-07-11 21:46:00 UTC (rev 3568)
@@ -0,0 +1,23 @@
+/*
+ * Created on Jul 11, 2011
+ */
+
+package org.lwjgl.util.mapped;
+
+public class MappedSet
+{
+ public static MappedSet2 create(MappedObject a, MappedObject b)
+ {
+ return new MappedSet2(a, b);
+ }
+
+ public static MappedSet3 create(MappedObject a, MappedObject b, MappedObject c)
+ {
+ return new MappedSet3(a, b, c);
+ }
+
+ public static MappedSet4 create(MappedObject a, MappedObject b, MappedObject c, MappedObject d)
+ {
+ return new MappedSet4(a, b, c, d);
+ }
+}
Added: trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedSet2.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedSet2.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedSet2.java 2011-07-11 21:46:00 UTC (rev 3568)
@@ -0,0 +1,30 @@
+/*
+ * Created on Jul 11, 2011
+ */
+
+package org.lwjgl.util.mapped;
+
+public class MappedSet2
+{
+ private final MappedObject a, b;
+
+ MappedSet2(MappedObject a, MappedObject b)
+ {
+ this.a = a;
+ this.b = b;
+ }
+
+ public int view;
+
+ void view(int view)
+ {
+ this.a.viewAddress = this.a.baseAddress + this.a.stride * view;
+ this.b.viewAddress = this.b.baseAddress + this.b.stride * view;
+ }
+
+ public void next()
+ {
+ this.a.viewAddress += this.a.stride;
+ this.b.viewAddress += this.b.stride;
+ }
+}
Added: trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedSet3.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedSet3.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedSet3.java 2011-07-11 21:46:00 UTC (rev 3568)
@@ -0,0 +1,33 @@
+/*
+ * Created on Jul 11, 2011
+ */
+
+package org.lwjgl.util.mapped;
+
+public class MappedSet3
+{
+ private final MappedObject a, b, c;
+
+ MappedSet3(MappedObject a, MappedObject b, MappedObject c)
+ {
+ this.a = a;
+ this.b = b;
+ this.c = c;
+ }
+
+ public int view;
+
+ void view(int view)
+ {
+ this.a.viewAddress = this.a.baseAddress + this.a.stride * view;
+ this.b.viewAddress = this.b.baseAddress + this.b.stride * view;
+ this.c.viewAddress = this.c.baseAddress + this.c.stride * view;
+ }
+
+ public void next()
+ {
+ this.a.viewAddress += this.a.stride;
+ this.b.viewAddress += this.b.stride;
+ this.c.viewAddress += this.c.stride;
+ }
+}
Added: trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedSet4.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedSet4.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedSet4.java 2011-07-11 21:46:00 UTC (rev 3568)
@@ -0,0 +1,36 @@
+/*
+ * Created on Jul 11, 2011
+ */
+
+package org.lwjgl.util.mapped;
+
+public class MappedSet4
+{
+ private final MappedObject a, b, c, d;
+
+ MappedSet4(MappedObject a, MappedObject b, MappedObject c, MappedObject d)
+ {
+ this.a = a;
+ this.b = b;
+ this.c = c;
+ this.d = d;
+ }
+
+ public int view;
+
+ void view(int view)
+ {
+ this.a.viewAddress = this.a.baseAddress + this.a.stride * view;
+ this.b.viewAddress = this.b.baseAddress + this.b.stride * view;
+ this.c.viewAddress = this.c.baseAddress + this.c.stride * view;
+ this.d.viewAddress = this.d.baseAddress + this.d.stride * view;
+ }
+
+ public void next()
+ {
+ this.a.viewAddress += this.a.stride;
+ this.b.viewAddress += this.b.stride;
+ this.c.viewAddress += this.c.stride;
+ this.d.viewAddress += this.d.stride;
+ }
+}
Added: trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedType.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedType.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedType.java 2011-07-11 21:46:00 UTC (rev 3568)
@@ -0,0 +1,21 @@
+/*
+ * Created on Jun 24, 2011
+ */
+
+package org.lwjgl.util.mapped;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * @author Riven
+ */
+
+@Retention(RetentionPolicy.RUNTIME)
+public @interface MappedType {
+ int sizeof();
+
+ int align() default 4;
+
+ boolean autoGenerateOffsets() default true;
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <riv...@us...> - 2011-07-11 20:43:44
|
Revision: 3567
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3567&view=rev
Author: riven-lwjgl
Date: 2011-07-11 20:43:38 +0000 (Mon, 11 Jul 2011)
Log Message:
-----------
Initial import.
Added Paths:
-----------
LWJGL/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2011-07-10 22:38:28
|
Revision: 3566
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3566&view=rev
Author: spasi
Date: 2011-07-10 22:38:21 +0000 (Sun, 10 Jul 2011)
Log Message:
-----------
Attempt to fix ant release.
Modified Paths:
--------------
trunk/LWJGL/platform_build/build-generator.xml
Modified: trunk/LWJGL/platform_build/build-generator.xml
===================================================================
--- trunk/LWJGL/platform_build/build-generator.xml 2011-07-10 19:16:46 UTC (rev 3565)
+++ trunk/LWJGL/platform_build/build-generator.xml 2011-07-10 22:38:21 UTC (rev 3566)
@@ -50,7 +50,7 @@
<!-- Proxy target to generate it all -->
<target name="generate-all" depends="generate-openal, generate-opengl, generate-opengl-capabilities, generate-opengl-references, generate-opengles, generate-opengles-capabilities, generate-opencl, generate-opencl-capabilities" description="Generates java and native source"/>
- <target name="generate-debug" depends="generate-openal-debug, generate-opengl-debug, generate-opengl-capabilities-debug, generate-opengl-references, generate-opencl-debug, generate-opencl-capabilities-debug" description="Generates java and native source with debug functionality"/>
+ <target name="generate-debug" depends="generate-openal-debug, generate-opengl-debug, generate-opengl-capabilities-debug, generate-opengl-references, generate-opengles-debug, generate-opengles-capabilities-debug, generate-opencl-debug, generate-opencl-capabilities-debug" description="Generates java and native source with debug functionality"/>
<!-- ********************************************************************************
*********************************************************************************
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2011-07-10 19:16:52
|
Revision: 3565
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3565&view=rev
Author: spasi
Date: 2011-07-10 19:16:46 +0000 (Sun, 10 Jul 2011)
Log Message:
-----------
Attempt (2) to fix MacOS build.
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-07-10 18:48:23 UTC (rev 3564)
+++ trunk/LWJGL/platform_build/macosx_ant/build.xml 2011-07-10 19:16:46 UTC (rev 3565)
@@ -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}/macosx"/>
+ <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"/>
<!-- Map from *.m and *.c to .o -->
<mapper type="regexp" from="^(.*)\.(c|m)" to="\1.o"/>
<fileset dir="${native}/macosx" includes="*.m"/>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2011-07-10 18:48:29
|
Revision: 3564
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3564&view=rev
Author: spasi
Date: 2011-07-10 18:48:23 +0000 (Sun, 10 Jul 2011)
Log Message:
-----------
Attempt to fix MacOS build.
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-07-10 18:18:51 UTC (rev 3563)
+++ trunk/LWJGL/platform_build/macosx_ant/build.xml 2011-07-10 18:48:23 UTC (rev 3564)
@@ -26,6 +26,7 @@
<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"/>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2011-07-10 18:18:57
|
Revision: 3563
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3563&view=rev
Author: spasi
Date: 2011-07-10 18:18:51 +0000 (Sun, 10 Jul 2011)
Log Message:
-----------
Fixed display creation.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/test/opengles/MappedIndexedVBOTest.java
Modified: trunk/LWJGL/src/java/org/lwjgl/test/opengles/MappedIndexedVBOTest.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/test/opengles/MappedIndexedVBOTest.java 2011-07-10 17:45:43 UTC (rev 3562)
+++ trunk/LWJGL/src/java/org/lwjgl/test/opengles/MappedIndexedVBOTest.java 2011-07-10 18:18:51 UTC (rev 3563)
@@ -45,6 +45,7 @@
import org.lwjgl.Sys;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
+import org.lwjgl.opengl.ContextType;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.DisplayMode;
import org.lwjgl.opengles.GLContext;
@@ -85,7 +86,7 @@
static {
try {
- Display.createES();
+ Display.create(ContextType.GLES);
System.out.println("Created OpenGL.");
if ( !GLContext.getCapabilities().GL_OES_mapbuffer ) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2011-07-10 17:45:50
|
Revision: 3562
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3562&view=rev
Author: spasi
Date: 2011-07-10 17:45:43 +0000 (Sun, 10 Jul 2011)
Log Message:
-----------
Replaced Display.createES() with Display.create(ContextType.GLES).
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java
Added Paths:
-----------
trunk/LWJGL/src/java/org/lwjgl/opengl/ContextType.java
Added: trunk/LWJGL/src/java/org/lwjgl/opengl/ContextType.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/ContextType.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/ContextType.java 2011-07-10 17:45:43 UTC (rev 3562)
@@ -0,0 +1,45 @@
+/*
+ * 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;
+
+/**
+ * This enum can be used in the default Display.create method to specify
+ * the context type that will be created.
+ *
+ * @author Spasi
+ */
+public enum ContextType {
+
+ GL,
+ GLES,
+
+}
\ No newline at end of file
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java 2011-07-10 16:58:16 UTC (rev 3561)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java 2011-07-10 17:45:43 UTC (rev 3562)
@@ -730,7 +730,7 @@
}
/**
- * Create the OpenGL context. If isFullscreen() is true or if windowed
+ * Create the Display with the specified context type. If isFullscreen() is true or if windowed
* context are not supported on the platform, the display mode will be switched to the mode returned by
* getDisplayMode(), and a fullscreen context will be created. If isFullscreen() is false, a windowed context
* will be created with the dimensions given in the mode returned by getDisplayMode(). If a context can't be
@@ -738,15 +738,39 @@
* <p/>
* <p>The window created will be set up in orthographic 2D projection, with 1:1 pixel ratio with GL coordinates.
*
+ * @param type the context type to create
+ *
* @throws LWJGLException
*/
- public static void create() throws LWJGLException {
+ public static void create(ContextType type) throws LWJGLException {
synchronized ( GlobalLock.lock ) {
- create(new PixelFormat());
+ switch ( type ) {
+ case GL:
+ create(new PixelFormat());
+ break;
+ case GLES:
+ create(new org.lwjgl.opengles.PixelFormat());
+ break;
+ }
}
}
/**
+ * Create the OpenGL context. If isFullscreen() is true or if windowed
+ * context are not supported on the platform, the display mode will be switched to the mode returned by
+ * getDisplayMode(), and a fullscreen context will be created. If isFullscreen() is false, a windowed context
+ * will be created with the dimensions given in the mode returned by getDisplayMode(). If a context can't be
+ * created with the given parameters, a LWJGLException will be thrown.
+ * <p/>
+ * <p>The window created will be set up in orthographic 2D projection, with 1:1 pixel ratio with GL coordinates.
+ *
+ * @throws LWJGLException
+ */
+ public static void create() throws LWJGLException {
+ create(ContextType.GL);
+ }
+
+ /**
* Create the OpenGL context with the given minimum parameters. If isFullscreen() is true or if windowed
* context are not supported on the platform, the display mode will be switched to the mode returned by
* getDisplayMode(), and a fullscreen context will be created. If isFullscreen() is false, a windowed context
@@ -878,23 +902,6 @@
}
/**
- * Create the OpenGL ES context. If isFullscreen() is true or if windowed
- * context are not supported on the platform, the display mode will be switched to the mode returned by
- * getDisplayMode(), and a fullscreen context will be created. If isFullscreen() is false, a windowed context
- * will be created with the dimensions given in the mode returned by getDisplayMode(). If a context can't be
- * created with the given parameters, a LWJGLException will be thrown.
- * <p/>
- * <p>The window created will be set up in orthographic 2D projection, with 1:1 pixel ratio with GL coordinates.
- *
- * @throws LWJGLException
- */
- public static void createES() throws LWJGLException {
- synchronized ( GlobalLock.lock ) {
- create(new org.lwjgl.opengles.PixelFormat());
- }
- }
-
- /**
* Create the OpenGL ES context with the given minimum parameters. If isFullscreen() is true or if windowed
* context are not supported on the platform, the display mode will be switched to the mode returned by
* getDisplayMode(), and a fullscreen context will be created. If isFullscreen() is false, a windowed context
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2011-07-10 16:58:31
|
Revision: 3561
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3561&view=rev
Author: spasi
Date: 2011-07-10 16:58:16 +0000 (Sun, 10 Jul 2011)
Log Message:
-----------
Merged OpenGL ES branch.
Modified Paths:
--------------
trunk/LWJGL/build.xml
trunk/LWJGL/platform_build/build-definitions.xml
trunk/LWJGL/platform_build/build-generator.xml
trunk/LWJGL/platform_build/linux_ant/build.xml
trunk/LWJGL/platform_build/macosx_ant/build.xml
trunk/LWJGL/platform_build/mingw_ant/build.xml
trunk/LWJGL/platform_build/windows_ant/build.xml
trunk/LWJGL/src/java/org/lwjgl/opencl/APIUtil.java
trunk/LWJGL/src/java/org/lwjgl/opencl/CallbackUtil.java
trunk/LWJGL/src/java/org/lwjgl/opencl/InfoUtilFactory.java
trunk/LWJGL/src/java/org/lwjgl/opengl/AWTGLCanvas.java
trunk/LWJGL/src/java/org/lwjgl/opengl/CallbackUtil.java
trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java
trunk/LWJGL/src/java/org/lwjgl/opengl/DisplayImplementation.java
trunk/LWJGL/src/java/org/lwjgl/opengl/DrawableLWJGL.java
trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxContextImplementation.java
trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java
trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplayPeerInfo.java
trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXContextImplementation.java
trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXDisplay.java
trunk/LWJGL/src/java/org/lwjgl/opengl/Pbuffer.java
trunk/LWJGL/src/java/org/lwjgl/opengl/PixelFormat.java
trunk/LWJGL/src/java/org/lwjgl/opengl/SharedDrawable.java
trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsContextImplementation.java
trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java
trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplayPeerInfo.java
trunk/LWJGL/src/java/org/lwjgl/test/opengl/sprites/SpriteShootoutCL.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/FieldsGenerator.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/NativeMethodStubsGenerator.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/RegisterStubsGenerator.java
trunk/LWJGL/src/java/org/lwjgl/util/vector/Matrix4f.java
trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Display.c
trunk/LWJGL/src/templates/org/lwjgl/opencl/CL10.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_texture_lod_bias.java
Added Paths:
-----------
trunk/LWJGL/libs/linux/libEGL.so
trunk/LWJGL/libs/linux/libGLESv2.so
trunk/LWJGL/libs/linux/x64/
trunk/LWJGL/libs/linux/x64/libEGL.so
trunk/LWJGL/libs/linux/x64/libGLESv2.so
trunk/LWJGL/libs/windows/libEGL.dll
trunk/LWJGL/libs/windows/libEGL.lib
trunk/LWJGL/libs/windows/libGLESv2.dll
trunk/LWJGL/platform_build/linux_ant/build_es.xml
trunk/LWJGL/platform_build/windows_ant/build_es.xml
trunk/LWJGL/src/java/org/lwjgl/opengl/Context.java
trunk/LWJGL/src/java/org/lwjgl/opengl/ContextGL.java
trunk/LWJGL/src/java/org/lwjgl/opengl/ContextGLES.java
trunk/LWJGL/src/java/org/lwjgl/opengl/DrawableGL.java
trunk/LWJGL/src/java/org/lwjgl/opengl/DrawableGLES.java
trunk/LWJGL/src/java/org/lwjgl/opengl/NVPresentVideoUtil.java
trunk/LWJGL/src/java/org/lwjgl/opengl/NVVideoCaptureUtil.java
trunk/LWJGL/src/java/org/lwjgl/opengl/PixelFormatLWJGL.java
trunk/LWJGL/src/java/org/lwjgl/opengles/
trunk/LWJGL/src/java/org/lwjgl/opengles/APIUtil.java
trunk/LWJGL/src/java/org/lwjgl/opengles/ContextAttribs.java
trunk/LWJGL/src/java/org/lwjgl/opengles/EGL.java
trunk/LWJGL/src/java/org/lwjgl/opengles/EGLConfig.java
trunk/LWJGL/src/java/org/lwjgl/opengles/EGLContext.java
trunk/LWJGL/src/java/org/lwjgl/opengles/EGLDisplay.java
trunk/LWJGL/src/java/org/lwjgl/opengles/EGLImageOES.java
trunk/LWJGL/src/java/org/lwjgl/opengles/EGLKHRFenceSync.java
trunk/LWJGL/src/java/org/lwjgl/opengles/EGLKHRReusableSync.java
trunk/LWJGL/src/java/org/lwjgl/opengles/EGLNVSync.java
trunk/LWJGL/src/java/org/lwjgl/opengles/EGLSurface.java
trunk/LWJGL/src/java/org/lwjgl/opengles/EGLSyncKHR.java
trunk/LWJGL/src/java/org/lwjgl/opengles/EGLSyncNV.java
trunk/LWJGL/src/java/org/lwjgl/opengles/GLChecks.java
trunk/LWJGL/src/java/org/lwjgl/opengles/GLContext.java
trunk/LWJGL/src/java/org/lwjgl/opengles/PeerInfo.java
trunk/LWJGL/src/java/org/lwjgl/opengles/PixelFormat.java
trunk/LWJGL/src/java/org/lwjgl/opengles/PowerManagementEventException.java
trunk/LWJGL/src/java/org/lwjgl/opengles/StateTracker.java
trunk/LWJGL/src/java/org/lwjgl/opengles/Util.java
trunk/LWJGL/src/java/org/lwjgl/test/opengles/
trunk/LWJGL/src/java/org/lwjgl/test/opengles/FullScreenWindowedTest.java
trunk/LWJGL/src/java/org/lwjgl/test/opengles/Gears.java
trunk/LWJGL/src/java/org/lwjgl/test/opengles/MappedIndexedVBOTest.java
trunk/LWJGL/src/java/org/lwjgl/test/opengles/QuadRenderer.java
trunk/LWJGL/src/java/org/lwjgl/test/opengles/util/
trunk/LWJGL/src/java/org/lwjgl/test/opengles/util/BufferObject.java
trunk/LWJGL/src/java/org/lwjgl/test/opengles/util/BufferObjectArray.java
trunk/LWJGL/src/java/org/lwjgl/test/opengles/util/BufferObjectElement.java
trunk/LWJGL/src/java/org/lwjgl/test/opengles/util/GLLight.java
trunk/LWJGL/src/java/org/lwjgl/test/opengles/util/GLMatrix.java
trunk/LWJGL/src/java/org/lwjgl/test/opengles/util/GLObject.java
trunk/LWJGL/src/java/org/lwjgl/test/opengles/util/Geometry.java
trunk/LWJGL/src/java/org/lwjgl/test/opengles/util/ImmediateModeBuffer.java
trunk/LWJGL/src/java/org/lwjgl/test/opengles/util/Shader.java
trunk/LWJGL/src/java/org/lwjgl/test/opengles/util/ShaderProgram.java
trunk/LWJGL/src/java/org/lwjgl/test/opengles/util/Sphere.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/opengl/EGLint64NV.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/opengl/EGLuint64NV.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/opengl/GLESCapabilitiesGenerator.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/opengl/GLESGeneratorProcessorFactory.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/opengl/GLESTypeMap.java
trunk/LWJGL/src/native/common/EGL/
trunk/LWJGL/src/native/common/EGL/egl.h
trunk/LWJGL/src/native/common/EGL/eglext.h
trunk/LWJGL/src/native/common/EGL/eglplatform.h
trunk/LWJGL/src/native/common/GLES2/
trunk/LWJGL/src/native/common/GLES2/gl2.h
trunk/LWJGL/src/native/common/GLES2/gl2ext.h
trunk/LWJGL/src/native/common/GLES2/gl2extimg.h
trunk/LWJGL/src/native/common/GLES2/gl2platform.h
trunk/LWJGL/src/native/common/KHR/
trunk/LWJGL/src/native/common/KHR/khrplatform.h
trunk/LWJGL/src/native/common/opengl/
trunk/LWJGL/src/native/common/opengl/extgl.c
trunk/LWJGL/src/native/common/opengl/extgl.h
trunk/LWJGL/src/native/common/opengl/extgl_types.h
trunk/LWJGL/src/native/common/opengl/org_lwjgl_opengl_CallbackUtil.c
trunk/LWJGL/src/native/common/opengl/org_lwjgl_opengl_GLContext.c
trunk/LWJGL/src/native/common/opengl/org_lwjgl_opengl_NVPresentVideoUtil.c
trunk/LWJGL/src/native/common/opengl/org_lwjgl_opengl_NVVideoCaptureUtil.c
trunk/LWJGL/src/native/common/opengles/
trunk/LWJGL/src/native/common/opengles/extgl.c
trunk/LWJGL/src/native/common/opengles/extgl.h
trunk/LWJGL/src/native/common/opengles/extgl_egl.c
trunk/LWJGL/src/native/common/opengles/extgl_egl.h
trunk/LWJGL/src/native/common/opengles/extgl_types.h
trunk/LWJGL/src/native/common/opengles/org_lwjgl_opengles_EGL.c
trunk/LWJGL/src/native/common/opengles/org_lwjgl_opengles_EGLKHRFenceSync.c
trunk/LWJGL/src/native/common/opengles/org_lwjgl_opengles_EGLKHRReusableSync.c
trunk/LWJGL/src/native/common/opengles/org_lwjgl_opengles_EGLNVSync.c
trunk/LWJGL/src/native/common/opengles/org_lwjgl_opengles_GLContext.c
trunk/LWJGL/src/native/linux/opengl/
trunk/LWJGL/src/native/linux/opengl/GLX.c
trunk/LWJGL/src/native/linux/opengl/GLX.h
trunk/LWJGL/src/native/linux/opengl/context.c
trunk/LWJGL/src/native/linux/opengl/context.h
trunk/LWJGL/src/native/linux/opengl/display.c
trunk/LWJGL/src/native/linux/opengl/extgl_glx.c
trunk/LWJGL/src/native/linux/opengl/extgl_glx.h
trunk/LWJGL/src/native/linux/opengl/org_lwjgl_opengl_Display.c
trunk/LWJGL/src/native/linux/opengl/org_lwjgl_opengl_LinuxAWTGLCanvasPeerInfo.c
trunk/LWJGL/src/native/linux/opengl/org_lwjgl_opengl_LinuxCanvasImplementation.c
trunk/LWJGL/src/native/linux/opengl/org_lwjgl_opengl_LinuxContextImplementation.c
trunk/LWJGL/src/native/linux/opengl/org_lwjgl_opengl_Pbuffer.c
trunk/LWJGL/src/native/linux/opengles/
trunk/LWJGL/src/native/linux/opengles/context.c
trunk/LWJGL/src/native/linux/opengles/context.h
trunk/LWJGL/src/native/linux/opengles/display.c
trunk/LWJGL/src/native/linux/opengles/extgl_glx.c
trunk/LWJGL/src/native/linux/opengles/org_lwjgl_opengl_Display.c
trunk/LWJGL/src/native/windows/opengl/
trunk/LWJGL/src/native/windows/opengl/WGL.c
trunk/LWJGL/src/native/windows/opengl/WGL.h
trunk/LWJGL/src/native/windows/opengl/context.c
trunk/LWJGL/src/native/windows/opengl/context.h
trunk/LWJGL/src/native/windows/opengl/extgl_wgl.c
trunk/LWJGL/src/native/windows/opengl/extgl_wgl.h
trunk/LWJGL/src/native/windows/opengl/org_lwjgl_opengl_Pbuffer.c
trunk/LWJGL/src/native/windows/opengl/org_lwjgl_opengl_WindowsContextImplementation.c
trunk/LWJGL/src/native/windows/opengl/org_lwjgl_opengl_WindowsPeerInfo.c
trunk/LWJGL/src/native/windows/opengles/
trunk/LWJGL/src/native/windows/opengles/context.c
trunk/LWJGL/src/native/windows/opengles/context.h
trunk/LWJGL/src/native/windows/opengles/extgl_wgl.c
trunk/LWJGL/src/native/windows/opengles/org_lwjgl_opengl_WindowsPeerInfo.c
trunk/LWJGL/src/templates/org/lwjgl/opencl/AMD_device_memory_flags.java
trunk/LWJGL/src/templates/org/lwjgl/opencl/AMD_offline_devices.java
trunk/LWJGL/src/templates/org/lwjgl/opencl/AMD_popcnt.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/AMD_multi_draw_indirect.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_present_video.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_video_capture.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/
trunk/LWJGL/src/templates/org/lwjgl/opengles/AMD_compressed_3DC_texture.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/AMD_compressed_ATC_texture.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/AMD_performance_monitor.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/AMD_program_binary_Z400.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/ANGLE_framebuffer_blit.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/ANGLE_framebuffer_multisample.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/APPLE_framebuffer_multisample.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/APPLE_rgb_422.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/APPLE_texture_format_BGRA8888.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/APPLE_texture_max_level.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/ARB_draw_buffers.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/ARB_half_float_pixel.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/ARB_texture_rectangle.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/ARM_mali_shader_binary.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/ARM_rgba8.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/DMP_shader_binary.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/EXT_Cg_shader.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/EXT_bgra.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/EXT_blend_minmax.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/EXT_discard_framebuffer.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/EXT_frag_depth.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/EXT_multi_draw_arrays.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/EXT_packed_float.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/EXT_read_format_bgra.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/EXT_shader_texture_lod.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/EXT_texture_array.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/EXT_texture_compression_dxt1.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/EXT_texture_compression_latc.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/EXT_texture_compression_s3tc.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/EXT_texture_filter_anisotropic.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/EXT_texture_format_BGRA8888.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/EXT_texture_lod_bias.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/EXT_texture_type_2_10_10_10_REV.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/GLES20.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/IMG_multisamples_render_to_texture.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/IMG_program_binary.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/IMG_shader_binary.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/IMG_texture_compression_pvrtc.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/NV_coverage_sample.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/NV_depth_nonlinear.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/NV_draw_path.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/NV_fbo_color_attachments.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/NV_fence.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/NV_framebuffer_vertex_attrib_array.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/NV_get_tex_image.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/NV_read_buffer.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/NV_shader_framebuffer_fetch.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/NV_system_time.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/OES_EGL_image.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/OES_EGL_image_external.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/OES_EGL_sync.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/OES_blend_equation_separate.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/OES_blend_func_separate.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/OES_blend_subtract.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/OES_compressed_ETC1_RGB8_texture.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/OES_compressed_paletted_texture.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/OES_depth24.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/OES_depth32.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/OES_depth_texture.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/OES_element_index_uint.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/OES_fbo_render_mipmap.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/OES_framebuffer_object.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/OES_get_program_binary.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/OES_mapbuffer.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/OES_packed_depth_stencil.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/OES_rgb8_rgba8.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/OES_standard_derivatives.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/OES_stencil1.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/OES_stencil4.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/OES_stencil8.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/OES_texture_3D.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/OES_texture_float.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/OES_texture_float_linear.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/OES_texture_half_float.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/OES_texture_half_float_linear.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/OES_texture_npot.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/OES_vertex_array_object.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/OES_vertex_half_float.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/OES_vertex_type_10_10_10_2.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/QCOM_driver_control.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/QCOM_extended_get.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/QCOM_extended_get2.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/QCOM_performance_monitor_global_mode.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/QCOM_tiled_rendering.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/QCOM_writeonly_rendering.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/VIV_shader_binary.java
Removed Paths:
-------------
trunk/LWJGL/libs/linux/x64/libEGL.so
trunk/LWJGL/libs/linux/x64/libGLESv2.so
trunk/LWJGL/src/java/org/lwjgl/opengl/AbstractDrawable.java
trunk/LWJGL/src/java/org/lwjgl/opengl/Context.java
trunk/LWJGL/src/java/org/lwjgl/opengles/APIUtil.java
trunk/LWJGL/src/java/org/lwjgl/opengles/ContextAttribs.java
trunk/LWJGL/src/java/org/lwjgl/opengles/EGL.java
trunk/LWJGL/src/java/org/lwjgl/opengles/EGLConfig.java
trunk/LWJGL/src/java/org/lwjgl/opengles/EGLContext.java
trunk/LWJGL/src/java/org/lwjgl/opengles/EGLDisplay.java
trunk/LWJGL/src/java/org/lwjgl/opengles/EGLImageOES.java
trunk/LWJGL/src/java/org/lwjgl/opengles/EGLKHRFenceSync.java
trunk/LWJGL/src/java/org/lwjgl/opengles/EGLKHRReusableSync.java
trunk/LWJGL/src/java/org/lwjgl/opengles/EGLNVSync.java
trunk/LWJGL/src/java/org/lwjgl/opengles/EGLSurface.java
trunk/LWJGL/src/java/org/lwjgl/opengles/EGLSyncKHR.java
trunk/LWJGL/src/java/org/lwjgl/opengles/EGLSyncNV.java
trunk/LWJGL/src/java/org/lwjgl/opengles/GLChecks.java
trunk/LWJGL/src/java/org/lwjgl/opengles/GLContext.java
trunk/LWJGL/src/java/org/lwjgl/opengles/PeerInfo.java
trunk/LWJGL/src/java/org/lwjgl/opengles/PixelFormat.java
trunk/LWJGL/src/java/org/lwjgl/opengles/PowerManagementEventException.java
trunk/LWJGL/src/java/org/lwjgl/opengles/StateTracker.java
trunk/LWJGL/src/java/org/lwjgl/opengles/Util.java
trunk/LWJGL/src/java/org/lwjgl/test/opengles/FullScreenWindowedTest.java
trunk/LWJGL/src/java/org/lwjgl/test/opengles/Gears.java
trunk/LWJGL/src/java/org/lwjgl/test/opengles/MappedIndexedVBOTest.java
trunk/LWJGL/src/java/org/lwjgl/test/opengles/QuadRenderer.java
trunk/LWJGL/src/java/org/lwjgl/test/opengles/util/
trunk/LWJGL/src/java/org/lwjgl/test/opengles/util/BufferObject.java
trunk/LWJGL/src/java/org/lwjgl/test/opengles/util/BufferObjectArray.java
trunk/LWJGL/src/java/org/lwjgl/test/opengles/util/BufferObjectElement.java
trunk/LWJGL/src/java/org/lwjgl/test/opengles/util/GLLight.java
trunk/LWJGL/src/java/org/lwjgl/test/opengles/util/GLMatrix.java
trunk/LWJGL/src/java/org/lwjgl/test/opengles/util/GLObject.java
trunk/LWJGL/src/java/org/lwjgl/test/opengles/util/Geometry.java
trunk/LWJGL/src/java/org/lwjgl/test/opengles/util/ImmediateModeBuffer.java
trunk/LWJGL/src/java/org/lwjgl/test/opengles/util/Shader.java
trunk/LWJGL/src/java/org/lwjgl/test/opengles/util/ShaderProgram.java
trunk/LWJGL/src/java/org/lwjgl/test/opengles/util/Sphere.java
trunk/LWJGL/src/native/common/EGL/egl.h
trunk/LWJGL/src/native/common/EGL/eglext.h
trunk/LWJGL/src/native/common/EGL/eglplatform.h
trunk/LWJGL/src/native/common/GLES2/gl2.h
trunk/LWJGL/src/native/common/GLES2/gl2ext.h
trunk/LWJGL/src/native/common/GLES2/gl2extimg.h
trunk/LWJGL/src/native/common/GLES2/gl2platform.h
trunk/LWJGL/src/native/common/KHR/khrplatform.h
trunk/LWJGL/src/native/common/extgl.c
trunk/LWJGL/src/native/common/extgl.h
trunk/LWJGL/src/native/common/extgl_types.h
trunk/LWJGL/src/native/common/opengl/extgl.c
trunk/LWJGL/src/native/common/opengl/extgl.h
trunk/LWJGL/src/native/common/opengl/extgl_types.h
trunk/LWJGL/src/native/common/opengl/org_lwjgl_opengl_CallbackUtil.c
trunk/LWJGL/src/native/common/opengl/org_lwjgl_opengl_GLContext.c
trunk/LWJGL/src/native/common/opengl/org_lwjgl_opengl_NVPresentVideoUtil.c
trunk/LWJGL/src/native/common/opengl/org_lwjgl_opengl_NVVideoCaptureUtil.c
trunk/LWJGL/src/native/common/opengles/extgl.c
trunk/LWJGL/src/native/common/opengles/extgl.h
trunk/LWJGL/src/native/common/opengles/extgl_egl.c
trunk/LWJGL/src/native/common/opengles/extgl_egl.h
trunk/LWJGL/src/native/common/opengles/extgl_types.h
trunk/LWJGL/src/native/common/opengles/org_lwjgl_opengles_EGL.c
trunk/LWJGL/src/native/common/opengles/org_lwjgl_opengles_EGLKHRFenceSync.c
trunk/LWJGL/src/native/common/opengles/org_lwjgl_opengles_EGLKHRReusableSync.c
trunk/LWJGL/src/native/common/opengles/org_lwjgl_opengles_EGLNVSync.c
trunk/LWJGL/src/native/common/opengles/org_lwjgl_opengles_GLContext.c
trunk/LWJGL/src/native/common/org_lwjgl_opengl_CallbackUtil.c
trunk/LWJGL/src/native/common/org_lwjgl_opengl_GLContext.c
trunk/LWJGL/src/native/linux/context.c
trunk/LWJGL/src/native/linux/context.h
trunk/LWJGL/src/native/linux/display.c
trunk/LWJGL/src/native/linux/extgl_glx.c
trunk/LWJGL/src/native/linux/extgl_glx.h
trunk/LWJGL/src/native/linux/opengl/GLX.c
trunk/LWJGL/src/native/linux/opengl/GLX.h
trunk/LWJGL/src/native/linux/opengl/context.c
trunk/LWJGL/src/native/linux/opengl/context.h
trunk/LWJGL/src/native/linux/opengl/display.c
trunk/LWJGL/src/native/linux/opengl/extgl_glx.c
trunk/LWJGL/src/native/linux/opengl/extgl_glx.h
trunk/LWJGL/src/native/linux/opengl/org_lwjgl_opengl_Display.c
trunk/LWJGL/src/native/linux/opengl/org_lwjgl_opengl_LinuxAWTGLCanvasPeerInfo.c
trunk/LWJGL/src/native/linux/opengl/org_lwjgl_opengl_LinuxCanvasImplementation.c
trunk/LWJGL/src/native/linux/opengl/org_lwjgl_opengl_LinuxContextImplementation.c
trunk/LWJGL/src/native/linux/opengl/org_lwjgl_opengl_Pbuffer.c
trunk/LWJGL/src/native/linux/opengles/context.c
trunk/LWJGL/src/native/linux/opengles/context.h
trunk/LWJGL/src/native/linux/opengles/display.c
trunk/LWJGL/src/native/linux/opengles/extgl_glx.c
trunk/LWJGL/src/native/linux/opengles/org_lwjgl_opengl_Display.c
trunk/LWJGL/src/native/linux/org_lwjgl_opengl_Display.c
trunk/LWJGL/src/native/linux/org_lwjgl_opengl_LinuxAWTGLCanvasPeerInfo.c
trunk/LWJGL/src/native/linux/org_lwjgl_opengl_LinuxCanvasImplementation.c
trunk/LWJGL/src/native/linux/org_lwjgl_opengl_LinuxContextImplementation.c
trunk/LWJGL/src/native/linux/org_lwjgl_opengl_Pbuffer.c
trunk/LWJGL/src/native/windows/context.c
trunk/LWJGL/src/native/windows/context.h
trunk/LWJGL/src/native/windows/extgl_wgl.c
trunk/LWJGL/src/native/windows/extgl_wgl.h
trunk/LWJGL/src/native/windows/opengl/WGL.c
trunk/LWJGL/src/native/windows/opengl/WGL.h
trunk/LWJGL/src/native/windows/opengl/context.c
trunk/LWJGL/src/native/windows/opengl/context.h
trunk/LWJGL/src/native/windows/opengl/extgl_wgl.c
trunk/LWJGL/src/native/windows/opengl/extgl_wgl.h
trunk/LWJGL/src/native/windows/opengl/org_lwjgl_opengl_Pbuffer.c
trunk/LWJGL/src/native/windows/opengl/org_lwjgl_opengl_WindowsContextImplementation.c
trunk/LWJGL/src/native/windows/opengl/org_lwjgl_opengl_WindowsPeerInfo.c
trunk/LWJGL/src/native/windows/opengles/context.c
trunk/LWJGL/src/native/windows/opengles/context.h
trunk/LWJGL/src/native/windows/opengles/extgl_wgl.c
trunk/LWJGL/src/native/windows/opengles/org_lwjgl_opengl_WindowsPeerInfo.c
trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Pbuffer.c
trunk/LWJGL/src/native/windows/org_lwjgl_opengl_WindowsContextImplementation.c
trunk/LWJGL/src/native/windows/org_lwjgl_opengl_WindowsPeerInfo.c
trunk/LWJGL/src/templates/org/lwjgl/opengles/AMD_compressed_3DC_texture.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/AMD_compressed_ATC_texture.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/AMD_performance_monitor.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/AMD_program_binary_Z400.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/ANGLE_framebuffer_blit.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/ANGLE_framebuffer_multisample.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/APPLE_framebuffer_multisample.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/APPLE_rgb_422.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/APPLE_texture_format_BGRA8888.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/APPLE_texture_max_level.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/ARB_draw_buffers.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/ARB_half_float_pixel.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/ARB_texture_rectangle.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/ARM_mali_shader_binary.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/ARM_rgba8.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/DMP_shader_binary.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/EXT_Cg_shader.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/EXT_bgra.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/EXT_blend_minmax.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/EXT_discard_framebuffer.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/EXT_frag_depth.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/EXT_multi_draw_arrays.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/EXT_packed_float.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/EXT_read_format_bgra.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/EXT_shader_texture_lod.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/EXT_texture_array.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/EXT_texture_compression_dxt1.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/EXT_texture_compression_latc.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/EXT_texture_compression_s3tc.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/EXT_texture_filter_anisotropic.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/EXT_texture_format_BGRA8888.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/EXT_texture_lod_bias.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/EXT_texture_type_2_10_10_10_REV.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/GLES20.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/IMG_multisamples_render_to_texture.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/IMG_program_binary.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/IMG_shader_binary.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/IMG_texture_compression_pvrtc.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/NV_coverage_sample.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/NV_depth_nonlinear.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/NV_draw_path.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/NV_fbo_color_attachments.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/NV_fence.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/NV_framebuffer_vertex_attrib_array.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/NV_get_tex_image.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/NV_read_buffer.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/NV_shader_framebuffer_fetch.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/NV_system_time.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/OES_EGL_image.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/OES_EGL_image_external.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/OES_EGL_sync.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/OES_blend_equation_separate.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/OES_blend_func_separate.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/OES_blend_subtract.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/OES_compressed_ETC1_RGB8_texture.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/OES_compressed_paletted_texture.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/OES_depth24.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/OES_depth32.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/OES_depth_texture.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/OES_element_index_uint.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/OES_fbo_render_mipmap.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/OES_framebuffer_object.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/OES_get_program_binary.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/OES_mapbuffer.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/OES_packed_depth_stencil.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/OES_rgb8_rgba8.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/OES_standard_derivatives.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/OES_stencil1.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/OES_stencil4.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/OES_stencil8.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/OES_texture_3D.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/OES_texture_float.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/OES_texture_float_linear.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/OES_texture_half_float.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/OES_texture_half_float_linear.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/OES_texture_npot.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/OES_vertex_array_object.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/OES_vertex_half_float.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/OES_vertex_type_10_10_10_2.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/QCOM_driver_control.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/QCOM_extended_get.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/QCOM_extended_get2.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/QCOM_performance_monitor_global_mode.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/QCOM_tiled_rendering.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/QCOM_writeonly_rendering.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/VIV_shader_binary.java
Property Changed:
----------------
trunk/LWJGL/
trunk/LWJGL/libs/
trunk/LWJGL/libs/windows/
trunk/LWJGL/src/native/common/
trunk/LWJGL/src/native/linux/
Property changes on: trunk/LWJGL
___________________________________________________________________
Modified: svn:ignore
- .classpath
*.class
*.class~
*.java~
.nbattrs
.project
dist
libs
temp
+ *.class
*.class~
*.java~
.classpath
.nbattrs
.project
bin
dist
libs
temp
Added: svn:mergeinfo
+ /branches/opengles/LWJGL:3533-3560
Modified: trunk/LWJGL/build.xml
===================================================================
--- trunk/LWJGL/build.xml 2011-07-10 10:26:36 UTC (rev 3560)
+++ trunk/LWJGL/build.xml 2011-07-10 16:58:16 UTC (rev 3561)
@@ -9,16 +9,17 @@
<import file="platform_build/build-maven.xml"/>
<!-- ================================================================== -->
- <!-- Everything below this line is targets. -->
- <!-- Do not modify, unless you know what you're doing -->
+ <!-- Everything below this line is targets. -->
+ <!-- Do not modify, unless you know what you're doing -->
<!-- ================================================================== -->
<!-- ================================================================== -->
- <!-- Initialize build -->
+ <!-- Initialize build -->
<!-- ================================================================== -->
<target name="-initialize">
<mkdir dir="${lwjgl.bin}" taskname="initialiazing bin folder" />
<mkdir dir="${lwjgl.bin}/lwjgl" taskname="initialiazing native bin folder" />
+ <mkdir dir="${lwjgl.bin}/lwjgles" taskname="initialiazing native OpenGL ES bin folder"/>
<mkdir dir="${lwjgl.lib}" taskname="initialiazing lib folder" />
<mkdir dir="${lwjgl.dist}" taskname="initialiazing dist folder" />
<mkdir dir="${lwjgl.docs}/javadoc" taskname="initialiazing docs folder" />
@@ -48,6 +49,7 @@
<!-- Useful when we need to force native recompilation -->
<target name="clean-native" description="Cleans native files generated by this ant script" depends="clean-generated-native">
<delete dir="${lwjgl.bin}/lwjgl" quiet="true" failonerror="false" taskname="cleaning native bin folder" />
+ <delete dir="${lwjgl.bin}/lwjgles" quiet="true" failonerror="false" taskname="cleaning native OpenGL ES bin folder"/>
</target>
<!-- Creates a distribution of LWJGL -->
@@ -111,6 +113,12 @@
<antcall target="-jars_NoDEP" />
</target>
+ <!-- Create ONLY the jar archives for the ES build -->
+ <target name="jars_es" description="Creates the Java archives ONLY for the ES build and places them in libs/"
+ depends="-initialize, generate-all, compile, -createjars_es">
+ <antcall target="-jars_NoDEP"/>
+ </target>
+
<target name="-jars_NoDEP">
<move todir="libs/">
<fileset dir="${lwjgl.temp}/jar">
@@ -161,6 +169,22 @@
</jar>
</target>
+ <!-- Packages the java files for the ES build -->
+ <target name="-createjars_es">
+ <!-- Create lwjgl.jar -->
+ <jar destfile="${lwjgl.temp}/jar/lwjgl.jar" taskname="lwjgl.jar">
+ <fileset refid="lwjgl_es.fileset"/>
+ <manifest>
+ <attribute name="Sealed" value="true"/>
+ </manifest>
+ </jar>
+
+ <!-- Create lwjgl_test.jar -->
+ <jar destfile="${lwjgl.temp}/jar/lwjgl_test.jar" taskname="lwjgl_test.jar">
+ <fileset refid="lwjgl_test_es.fileset"/>
+ </jar>
+ </target>
+
<!-- Distributes files -->
<target name="-distribute">
<delete>
@@ -227,25 +251,35 @@
<class name="org.lwjgl.opengl.LinuxKeyboard" />
<class name="org.lwjgl.opengl.LinuxDisplay" />
<class name="org.lwjgl.opengl.LinuxPeerInfo" />
- <class name="org.lwjgl.opengl.LinuxPbufferPeerInfo" />
- <class name="org.lwjgl.opengl.LinuxDisplayPeerInfo" />
- <class name="org.lwjgl.opengl.LinuxAWTGLCanvasPeerInfo" />
- <class name="org.lwjgl.opengl.LinuxContextImplementation" />
- <class name="org.lwjgl.opengl.LinuxCanvasImplementation" />
</javah>
+ <javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.native}/linux/opengl" force="yes">
+ <class name="org.lwjgl.opengl.LinuxPbufferPeerInfo"/>
+ <class name="org.lwjgl.opengl.LinuxDisplayPeerInfo"/>
+ <class name="org.lwjgl.opengl.LinuxAWTGLCanvasPeerInfo"/>
+ <class name="org.lwjgl.opengl.LinuxContextImplementation"/>
+ <class name="org.lwjgl.opengl.LinuxCanvasImplementation"/>
+ </javah>
+
<javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.native}/windows" force="yes">
+ <class name="org.lwjgl.WindowsSysImplementation"/>
<class name="org.lwjgl.opengl.WindowsKeyboard" />
- <class name="org.lwjgl.opengl.WindowsPbufferPeerInfo" />
- <class name="org.lwjgl.opengl.WindowsDisplay" />
<class name="org.lwjgl.opengl.WindowsRegistry" />
- <class name="org.lwjgl.WindowsSysImplementation" />
- <class name="org.lwjgl.opengl.WindowsAWTGLCanvasPeerInfo" />
- <class name="org.lwjgl.opengl.WindowsPeerInfo" />
- <class name="org.lwjgl.opengl.WindowsDisplayPeerInfo" />
- <class name="org.lwjgl.opengl.WindowsContextImplementation" />
+ <class name="org.lwjgl.opengl.WindowsDisplay"/>
+ <class name="org.lwjgl.opengl.WindowsDisplayPeerInfo"/>
+ <class name="org.lwjgl.opengl.WindowsAWTGLCanvasPeerInfo"/>
</javah>
+ <javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.native}/windows/opengl" force="yes">
+ <class name="org.lwjgl.opengl.WindowsPbufferPeerInfo"/>
+ <class name="org.lwjgl.opengl.WindowsPeerInfo"/>
+ <class name="org.lwjgl.opengl.WindowsContextImplementation"/>
+ </javah>
+
+ <javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.native}/windows/opengles" force="yes">
+ <class name="org.lwjgl.opengl.WindowsPeerInfo"/>
+ </javah>
+
<javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.native}/macosx" force="yes">
<class name="org.lwjgl.MacOSXSysImplementation" />
<class name="org.lwjgl.opengl.MacOSXMouseEventQueue" />
@@ -263,13 +297,26 @@
<class name="org.lwjgl.input.Keyboard" />
<class name="org.lwjgl.input.Mouse" />
<class name="org.lwjgl.openal.AL" />
- <class name="org.lwjgl.opengl.GLContext" />
- <class name="org.lwjgl.opengl.Pbuffer" />
- <class name="org.lwjgl.opengl.CallbackUtil" />
- <class name="org.lwjgl.opencl.CL" />
+ <class name="org.lwjgl.opencl.CL" />
<class name="org.lwjgl.opencl.CallbackUtil" />
- <class name="org.lwjgl.BufferUtils" />
+ <class name="org.lwjgl.BufferUtils" />
</javah>
+
+ <javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.headers}/opengl" force="yes">
+ <class name="org.lwjgl.opengl.GLContext"/>
+ <class name="org.lwjgl.opengl.Pbuffer"/>
+ <class name="org.lwjgl.opengl.CallbackUtil"/>
+ <class name="org.lwjgl.opengl.NVPresentVideoUtil"/>
+ <class name="org.lwjgl.opengl.NVVideoCaptureUtil"/>
+ </javah>
+
+ <javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.headers}/opengles" force="yes">
+ <class name="org.lwjgl.opengles.EGL"/>
+ <class name="org.lwjgl.opengles.EGLKHRFenceSync"/>
+ <class name="org.lwjgl.opengles.EGLKHRReusableSync"/>
+ <class name="org.lwjgl.opengles.EGLNVSync"/>
+ <class name="org.lwjgl.opengles.GLContext"/>
+ </javah>
</target>
<target name="touch-version">
@@ -364,6 +411,7 @@
<include name="org/lwjgl/*.java"/>
<include name="org/lwjgl/input/**"/>
<include name="org/lwjgl/opengl/**"/>
+ <include name="org/lwjgl/opengles/**"/>
<include name="org/lwjgl/openal/**"/>
<include name="org/lwjgl/opencl/**"/>
<include name="org/lwjgl/util/**"/>
@@ -430,6 +478,34 @@
<version-check platform="macosx"/>
</target>
+ <target name="compile_native_es" depends="-initialize, headers, touch-version, version-mismatch" description="Compiles the native files">
+ <condition property="lwjgl.platform.windows">
+ <os family="windows"/>
+ </condition>
+ <antcall target="-compile_native_win32_es"/>
+
+ <condition property="lwjgl.platform.linux">
+ <os name="Linux"/>
+ </condition>
+ <antcall target="-compile_native_linux_es"/>
+ </target>
+
+ <!-- Compiles LWJGL ES on Win32 platforms -->
+ <target name="-compile_native_win32_es" if="lwjgl.platform.windows">
+ <ant antfile="platform_build/windows_ant/build_es.xml" inheritAll="false"/>
+ <copy todir="${lwjgl.lib}/windows">
+ <fileset dir="${lwjgl.bin}/lwjgles" includes="lwjgl*.dll"/>
+ </copy>
+ </target>
+
+ <!-- Compiles LWJGL ES on Linux platforms -->
+ <target name="-compile_native_linux_es" if="lwjgl.platform.linux">
+ <ant antfile="platform_build/linux_ant/build_es.xml" inheritAll="false"/>
+ <copy todir="${lwjgl.lib}/linux">
+ <fileset dir="${lwjgl.bin}/lwjgles" includes="liblwjgl*.so"/>
+ </copy>
+ </target>
+
<target name="repack200" description="Pack200-repack a jar file">
<pack200 src="${input}" destfile="${output}" repack="true"/>
</target>
Property changes on: trunk/LWJGL/libs
___________________________________________________________________
Added: svn:ignore
+ lwjgl-debug.jar
lwjgl.jar
lwjgl_test.jar
lwjgl_util.jar
lwjgl_util_applet.jar
Copied: trunk/LWJGL/libs/linux/libEGL.so (from rev 3560, branches/opengles/LWJGL/libs/linux/libEGL.so)
===================================================================
(Binary files differ)
Copied: trunk/LWJGL/libs/linux/libGLESv2.so (from rev 3560, branches/opengles/LWJGL/libs/linux/libGLESv2.so)
===================================================================
(Binary files differ)
Deleted: trunk/LWJGL/libs/linux/x64/libEGL.so
===================================================================
(Binary files differ)
Copied: trunk/LWJGL/libs/linux/x64/libEGL.so (from rev 3560, branches/opengles/LWJGL/libs/linux/x64/libEGL.so)
===================================================================
(Binary files differ)
Deleted: trunk/LWJGL/libs/linux/x64/libGLESv2.so
===================================================================
(Binary files differ)
Copied: trunk/LWJGL/libs/linux/x64/libGLESv2.so (from rev 3560, branches/opengles/LWJGL/libs/linux/x64/libGLESv2.so)
===================================================================
(Binary files differ)
Property changes on: trunk/LWJGL/libs/windows
___________________________________________________________________
Added: svn:ignore
+ lwjgl.dll
Copied: trunk/LWJGL/libs/windows/libEGL.dll (from rev 3560, branches/opengles/LWJGL/libs/windows/libEGL.dll)
===================================================================
(Binary files differ)
Copied: trunk/LWJGL/libs/windows/libEGL.lib (from rev 3560, branches/opengles/LWJGL/libs/windows/libEGL.lib)
===================================================================
(Binary files differ)
Copied: trunk/LWJGL/libs/windows/libGLESv2.dll (from rev 3560, branches/opengles/LWJGL/libs/windows/libGLESv2.dll)
===================================================================
(Binary files differ)
Modified: trunk/LWJGL/platform_build/build-definitions.xml
===================================================================
--- trunk/LWJGL/platform_build/build-definitions.xml 2011-07-10 10:26:36 UTC (rev 3560)
+++ trunk/LWJGL/platform_build/build-definitions.xml 2011-07-10 16:58:16 UTC (rev 3561)
@@ -16,6 +16,7 @@
<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"/>
+ <property name="opengles-template-pattern" value="org/lwjgl/opengles/GLES*.java,org/lwjgl/opengles/ARB*.java,org/lwjgl/opengles/EXT*.java,org/lwjgl/opengles/AMD*.java,org/lwjgl/opengles/ANGLE*.java,org/lwjgl/opengles/APPLE*.java,org/lwjgl/opengles/ARM*.java,org/lwjgl/opengles/DMP*.java,org/lwjgl/opengles/IMG*.java,org/lwjgl/opengles/NV*.java,org/lwjgl/opengles/OES*.java,org/lwjgl/opengles/QCOM*.java,org/lwjgl/opengles/VIV*.java"/>
<property name="opencl-template-pattern-extensions" value="org/lwjgl/opencl/KHR*.java,org/lwjgl/opencl/EXT*.java,org/lwjgl/opencl/APPLE*.java,org/lwjgl/opencl/AMD*.java,org/lwjgl/opencl/NV*.java"/>
<property name="opencl-template-pattern" value="org/lwjgl/opencl/CL*.java,${opencl-template-pattern-extensions}"/>
@@ -27,13 +28,25 @@
<fileset id="lwjgl.fileset" dir="${lwjgl.bin}">
<patternset id="lwjgl.package.pattern">
<include name="org/**/*" />
+ <exclude name="org/lwjgl/opengles/**"/>
<exclude name="org/lwjgl/d3d/**" />
<exclude name="org/lwjgl/test/**" />
<exclude name="org/lwjgl/util/**" />
<exclude name="org/lwjgl/examples/**" />
</patternset>
</fileset>
-
+
+ <!-- Files to include in the lwjgl.jar file, for the ES build -->
+ <fileset id="lwjgl_es.fileset" dir="${lwjgl.bin}">
+ <patternset id="lwjgl_es.package.pattern">
+ <include name="org/**/*"/>
+ <exclude name="org/lwjgl/d3d/**"/>
+ <exclude name="org/lwjgl/test/**"/>
+ <exclude name="org/lwjgl/util/**"/>
+ <exclude name="org/lwjgl/examples/**"/>
+ </patternset>
+ </fileset>
+
<!-- Files to include in the lwjgl_util_applet.jar file -->
<fileset id="lwjgl_util_applet.fileset" dir="${lwjgl.bin}">
<patternset id="lwjgl_util_applet.package.pattern">
@@ -46,6 +59,7 @@
<fileset id="lwjgl_test.fileset" dir="${lwjgl.bin}">
<exclude name="**.*" />
<include name="org/lwjgl/test/**" />
+ <exclude name="org/lwjgl/test/opengles/**"/>
<include name="org/lwjgl/examples/**" />
</fileset>
@@ -59,6 +73,14 @@
<include name="org/lwjgl/test/opencl/gl/*.cl" />
</fileset>
+ <!-- Files to include in the lwjgl_test.jar file for the ES build -->
+ <fileset id="lwjgl_test_es.fileset" dir="${lwjgl.bin}">
+ <exclude name="**.*"/>
+ <include name="org/lwjgl/test/**"/>
+ <exclude name="org/lwjgl/test/opengl/**"/>
+ <exclude name="org/lwjgl/test/*.*"/>
+ </fileset>
+
<!-- Files to include in the lwjgl_util.jar file -->
<fileset id="lwjgl_util.fileset" dir="${lwjgl.bin}">
<patternset id="lwjgl_util.package.pattern">
@@ -68,8 +90,8 @@
<include name="org/lwjgl/util/**" />
</patternset>
</fileset>
-
+
<!-- Files to include in the lwjgl_applet.jar file -->
<fileset id="lwjgl_applet.fileset" dir="${lwjgl.bin}">
<exclude name="**.*"/>
@@ -116,7 +138,7 @@
<include name="liblwjgl*.so" />
<include name="libopenal*.so" />
</patternset>
- <patternset id="lwjgl-linux-jinput.fileset">
+ <patternset id="lwjgl-linux-jinput.fileset">
<include name="libjinput-linux.so" />
<include name="libjinput-linux64.so" />
</patternset>
Modified: trunk/LWJGL/platform_build/build-generator.xml
===================================================================
--- trunk/LWJGL/platform_build/build-generator.xml 2011-07-10 10:26:36 UTC (rev 3560)
+++ trunk/LWJGL/platform_build/build-generator.xml 2011-07-10 16:58:16 UTC (rev 3561)
@@ -18,6 +18,7 @@
<javac debug="yes" srcdir="${lwjgl.src}/java/" destdir="${lwjgl.bin}" includes="org/lwjgl/util/generator/**.java" source="1.5" target="1.5" taskname="generator">
<include name="org/lwjgl/util/generator/openal/**.java"/>
<include name="org/lwjgl/util/generator/opengl/**.java"/>
+ <include name="org/lwjgl/util/generator/opengles/**.java"/>
<include name="org/lwjgl/util/generator/opencl/**.java"/>
<compilerarg value="-Xlint:all"/>
</javac>
@@ -29,6 +30,8 @@
<include name="org/lwjgl/opengl/GLSync.java"/>
<include name="org/lwjgl/opengl/AMDDebugOutputCallback.java"/>
<include name="org/lwjgl/opengl/ARBDebugOutputCallback.java"/>
+ <!-- OpenGL ES -->
+ <include name="org/lwjgl/opengles/EGLImageOES.java"/>
<!-- OpenCL -->
<include name="org/lwjgl/opencl/CLPlatform.java"/>
<include name="org/lwjgl/opencl/CLDevice.java"/>
@@ -45,10 +48,16 @@
</target>
<!-- Proxy target to generate it all -->
- <target name="generate-all" depends="generate-openal, generate-opengl, generate-opengl-capabilities, generate-opengl-references, generate-opencl, generate-opencl-capabilities" description="Generates java and native source"/>
+ <target name="generate-all" depends="generate-openal, generate-opengl, generate-opengl-capabilities, generate-opengl-references, generate-opengles, generate-opengles-capabilities, generate-opencl, generate-opencl-capabilities" description="Generates java and native source"/>
<target name="generate-debug" depends="generate-openal-debug, generate-opengl-debug, generate-opengl-capabilities-debug, generate-opengl-references, generate-opencl-debug, generate-opencl-capabilities-debug" description="Generates java and native source with debug functionality"/>
+ <!-- ********************************************************************************
+ *********************************************************************************
+ OPENAL
+ *********************************************************************************
+ **************************************************************************** -->
+
<!-- Generate OpenAL -->
<target name="generate-openal" depends="generators" description="Generates java and native source for AL">
<apply executable="apt" parallel="true">
@@ -60,7 +69,7 @@
<arg value="-s"/>
<arg path="${lwjgl.src}/generated"/>
<arg value="-d"/>
- <arg path="${lwjgl.src.native}/generated"/>
+ <arg path="${lwjgl.src.native}/generated/openal"/>
<arg value="-Atypemap=org.lwjgl.util.generator.openal.ALTypeMap"/>
<fileset dir="${lwjgl.src.templates}" includes="org/lwjgl/openal/AL10.java, org/lwjgl/openal/AL11.java, org/lwjgl/openal/EFX10.java"/>
</apply>
@@ -77,13 +86,19 @@
<arg value="-s"/>
<arg path="${lwjgl.src}/generated"/>
<arg value="-d"/>
- <arg path="${lwjgl.src.native}/generated"/>
+ <arg path="${lwjgl.src.native}/generated/openal"/>
<arg value="-Atypemap=org.lwjgl.util.generator.openal.ALTypeMap"/>
<arg value="-Ageneratechecks"/>
<fileset dir="${lwjgl.src.templates}" includes="org/lwjgl/openal/AL10.java, org/lwjgl/openal/AL11.java, org/lwjgl/openal/EFX10.java"/>
</apply>
</target>
+ <!-- ********************************************************************************
+ *********************************************************************************
+ OPENGL
+ *********************************************************************************
+ **************************************************************************** -->
+
<!-- Generate OpenGL -->
<target name="generate-opengl" depends="generators" description="Generates java and native source for GL">
<apply executable="apt" parallel="true">
@@ -95,7 +110,7 @@
<arg value="-s"/>
<arg path="${lwjgl.src}/generated"/>
<arg value="-d"/>
- <arg path="${lwjgl.src.native}/generated"/>
+ <arg path="${lwjgl.src.native}/generated/opengl"/>
<arg value="-Acontextspecific"/>
<arg value="-Atypemap=org.lwjgl.util.generator.opengl.GLTypeMap"/>
<fileset dir="${lwjgl.src.templates}" includes="${opengl-template-pattern}"/>
@@ -103,7 +118,7 @@
</target>
<!-- Generate OpenGL [DEBUG] -->
- <target name="generate-opengl-debug" depends="generators" description="Generates java and native source for GL">
+ <target name="generate-opengl-debug" depends="generators" description="Generates debug java and native source for GL">
<apply executable="apt" parallel="true">
<arg value="-nocompile"/>
<arg value="-factory"/>
@@ -113,7 +128,7 @@
<arg value="-s"/>
<arg path="${lwjgl.src}/generated"/>
<arg value="-d"/>
- <arg path="${lwjgl.src.native}/generated"/>
+ <arg path="${lwjgl.src.native}/generated/opengl"/>
<arg value="-Ageneratechecks"/>
<arg value="-Acontextspecific"/>
<arg value="-Atypemap=org.lwjgl.util.generator.opengl.GLTypeMap"/>
@@ -151,7 +166,7 @@
</target>
<!-- Generate OpenGL context capabilities [DEBUG] -->
- <target name="generate-opengl-capabilities-debug" depends="generators" description="Generates java and native source for GL">
+ <target name="generate-opengl-capabilities-debug" depends="generators" description="Generates debug java and native source for GL">
<apply executable="apt" parallel="true">
<arg value="-nocompile"/>
<arg value="-factory"/>
@@ -166,7 +181,87 @@
</apply>
</target>
- <!-- Generate OpenCL -->
+ <!-- ********************************************************************************
+ *********************************************************************************
+ OPENGL ES
+ *********************************************************************************
+ **************************************************************************** -->
+
+ <!-- Generate OpenGL ES -->
+ <target name="generate-opengles" depends="generators" description="Generates java and native source for GL ES">
+ <apply executable="apt" parallel="true">
+ <arg value="-nocompile"/>
+ <arg value="-factory"/>
+ <arg value="org.lwjgl.util.generator.GeneratorProcessorFactory"/>
+ <arg value="-cp"/>
+ <arg path="${lwjgl.src}/java:${lwjgl.src.templates}:${lwjgl.bin}:${java.class.path}"/>
+ <arg value="-s"/>
+ <arg path="${lwjgl.src}/generated"/>
+ <arg value="-d"/>
+ <arg path="${lwjgl.src.native}/generated/opengles"/>
+ <!--<arg value="-Acontextspecific"/>-->
+ <arg value="-Atypemap=org.lwjgl.util.generator.opengl.GLESTypeMap"/>
+ <fileset dir="${lwjgl.src.templates}" includes="${opengles-template-pattern}"/>
+ </apply>
+ </target>
+
+ <!-- Generate OpenGL ES [DEBUG] -->
+ <target name="generate-opengles-debug" depends="generators" description="Generates debug java and native source for GL ES">
+ <apply executable="apt" parallel="true">
+ <arg value="-nocompile"/>
+ <arg value="-factory"/>
+ <arg value="org.lwjgl.util.generator.GeneratorProcessorFactory"/>
+ <arg value="-cp"/>
+ <arg path="${lwjgl.src}/java:${lwjgl.src.templates}:${lwjgl.bin}:${java.class.path}"/>
+ <arg value="-s"/>
+ <arg path="${lwjgl.src}/generated"/>
+ <arg value="-d"/>
+ <arg path="${lwjgl.src.native}/generated/opengles"/>
+ <arg value="-Ageneratechecks"/>
+ <!--<arg value="-Acontextspecific"/>-->
+ <arg value="-Atypemap=org.lwjgl.util.generator.opengl.GLESTypeMap"/>
+ <fileset dir="${lwjgl.src.templates}" includes="${opengles-template-pattern}"/>
+ </apply>
+ </target>
+
+ <!-- Generate OpenGL ES context capabilities -->
+ <target name="generate-opengles-capabilities" depends="generators" description="Generates java and native source for GL ES">
+ <apply executable="apt" parallel="true">
+ <arg value="-nocompile"/>
+ <arg value="-factory"/>
+ <arg value="org.lwjgl.util.generator.opengl.GLESGeneratorProcessorFactory"/>
+ <arg value="-cp"/>
+ <arg path="${lwjgl.src}/java:${lwjgl.src.templates}:${lwjgl.bin}:${java.class.path}"/>
+ <arg value="-s"/>
+ <arg path="${lwjgl.src}/generated"/>
+ <!--<arg value="-Acontextspecific"/>-->
+ <fileset dir="${lwjgl.src.templates}" includes="${opengles-template-pattern}"/>
+ </apply>
+ </target>
+
+ <!-- Generate OpenGL ES context capabilities [DEBUG] -->
+ <target name="generate-opengles-capabilities-debug" depends="generators" description="Generates debug java and native source for GL ES">
+ <apply executable="apt" parallel="true">
+ <arg value="-nocompile"/>
+ <arg value="-factory"/>
+ <arg value="org.lwjgl.util.generator.opengl.GLESGeneratorProcessorFactory"/>
+ <arg value="-cp"/>
+ <arg path="${lwjgl.src}/java:${lwjgl.src.templates}:${lwjgl.bin}:${java.class.path}"/>
+ <arg value="-s"/>
+ <arg path="${lwjgl.src}/generated"/>
+ <arg value="-Ageneratechecks"/>
+ <!--<arg value="-Acontextspecific"/>-->
+ <fileset dir="${lwjgl.src.templates}" includes="${opengles-template-pattern}"/>
+ </apply>
+ </target>
+
+ <!-- ********************************************************************************
+ *********************************************************************************
+ OPENCL
+ *********************************************************************************
+ **************************************************************************** -->
+
+ <!-- Generate OpenCL -->
<target name="generate-opencl" depends="generators" description="Generates java and native source for CL">
<apply executable="apt" parallel="true">
<arg value="-nocompile"/>
@@ -177,7 +272,7 @@
<arg value="-s"/>
<arg path="${lwjgl.src}/generated"/>
<arg value="-d"/>
- <arg path="${lwjgl.src.native}/generated"/>
+ <arg path="${lwjgl.src.native}/generated/opencl"/>
<arg value="-Acontextspecific"/>
<arg value="-Atypemap=org.lwjgl.util.generator.opencl.CLTypeMap"/>
<fileset dir="${lwjgl.src.templates}" includes="${opencl-template-pattern}"/>
@@ -185,7 +280,7 @@
</target>
<!-- Generate OpenCL [DEBUG] -->
- <target name="generate-opencl-debug" depends="generators" description="Generates java and native source for CL">
+ <target name="generate-opencl-debug" depends="generators" description="Generates debug java and native source for CL">
<apply executable="apt" parallel="true">
<arg value="-nocompile"/>
<arg value="-factory"/>
@@ -195,7 +290,7 @@
<arg value="-s"/>
<arg path="${lwjgl.src}/generated"/>
<arg value="-d"/>
- <arg path="${lwjgl.src.native}/generated"/>
+ <arg path="${lwjgl.src.native}/generated/opencl"/>
<arg value="-Ageneratechecks"/>
<arg value="-Acontextspecific"/>
<arg value="-Atypemap=org.lwjgl.util.generator.opencl.CLTypeMap"/>
@@ -219,7 +314,7 @@
</target>
<!-- Generate OpenCL capabilities [DEBUG] -->
- <target name="generate-opencl-capabilities-debug" depends="generators" description="Generates capabilities for CL">
+ <target name="generate-opencl-capabilities-debug" depends="generators" description="Generates debug capabilities for CL">
<apply executable="apt" parallel="true">
<arg value="-nocompile"/>
<arg value="-factory"/>
Modified: trunk/LWJGL/platform_build/linux_ant/build.xml
===================================================================
--- trunk/LWJGL/platform_build/linux_ant/build.xml 2011-07-10 10:26:36 UTC (rev 3560)
+++ trunk/LWJGL/platform_build/linux_ant/build.xml 2011-07-10 16:58:16 UTC (rev 3561)
@@ -73,12 +73,18 @@
<arg value="-I${java.home}/../include/linux"/>
<arg value="-I${java.home}/../include/solaris"/>
<arg value="-I${native}/common"/>
+ <arg value="-I${native}/common/opengl"/>
<arg value="-I${native}/linux"/>
+ <arg value="-I${native}/linux/opengl"/>
<mapper type="glob" from="*.c" to="*.o"/>
- <fileset dir="${native}/linux" includes="*.c"/>
- <fileset dir="${native}/generated" includes="*.c"/>
- <fileset dir="${native}/common" includes="*.c"/>
- </apply>
+ <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}/linux" includes="*.c"/>
+ <fileset dir="${native}/linux/opengl" includes="*.c"/>
+ </apply>
<apply dir="." parallel="true" executable="gcc" failonerror="true">
<srcfile/>
<arg line="${linker_flags32}"/>
@@ -99,12 +105,16 @@
<arg value="-I${java.home}/../include/linux"/>
<arg value="-I${java.home}/../include/solaris"/>
<arg value="-I${native}/common"/>
+ <arg value="-I${native}/common/opengl"/>
<arg value="-I${native}/linux"/>
+ <arg value="-I${native}/linux/opengl"/>
<mapper type="glob" from="*.c" to="*.o"/>
- <fileset dir="${native}/linux" includes="*.c"/>
- <fileset dir="${native}/generated" includes="*.c"/>
- <fileset dir="${native}/common" includes="*.c"/>
- </apply>
+ <fileset dir="${native}/common" includes="*.c"/>
+ <fileset dir="${native}/common/opengl" includes="*.c"/>
+ <fileset dir="${native}/generated/opengl" includes="*.c"/>
+ <fileset dir="${native}/linux" includes="*.c"/>
+ <fileset dir="${native}/linux/opengl" includes="*.c"/>
+ </apply>
<apply dir="." parallel="true" executable="gcc" failonerror="true">
<srcfile/>
<arg line="${linker_flags64}"/>
Copied: trunk/LWJGL/platform_build/linux_ant/build_es.xml (from rev 3560, branches/opengles/LWJGL/platform_build/linux_ant/build_es.xml)
===================================================================
--- trunk/LWJGL/platform_build/linux_ant/build_es.xml (rev 0)
+++ trunk/LWJGL/platform_build/linux_ant/build_es.xml 2011-07-10 16:58:16 UTC (rev 3561)
@@ -0,0 +1,127 @@
+<?xml version="1.0"?>
+
+<project name="lwjgl native code, linux" basedir="../../bin/lwjgles" default="compile">
+ <property name="native" location="../../src/native"/>
+ <property name="libname32" value="liblwjgl.so"/>
+ <property name="libname64" value="liblwjgl64.so"/>
+ <property name="libs32" value="-L/home/spasi/lwjgl/libs/linux -lEGL -L/usr/X11R6/lib -L/usr/X11/lib -lm -lX11 -lXext -lXcursor -lXrandr -lpthread -L${java.home}/lib/i386 -ljawt" />
+ <property name="libs64" value="-L${lib_folder}/x64 -lEGL -L/usr/X11R6/lib64 -L/usr/X11/lib64 -lm -lX11 -lXext -lXcursor -lXrandr -lXxf86vm -lpthread -L${java.home}/lib/amd64 -ljawt" />
+ <property name="cflags32" value="-O2 -Wall -c -fPIC -std=c99 -Wunused"/>
+
+ <target name="clean">
+ <delete>
+ <fileset dir="x32"/>
+ <fileset dir="x64"/>
+ <fileset dir="." includes="*.o"/>
+ <fileset dir="." includes="*.so"/>
+ </delete>
+ </target>
+
+ <target name="compile">
+ <exec executable="uname" outputproperty="hwplatform">
+ <arg value="-m"/>
+ </exec>
+ <cond...
[truncated message content] |
|
From: <sp...@us...> - 2011-07-10 10:26:43
|
Revision: 3560
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3560&view=rev
Author: spasi
Date: 2011-07-10 10:26:36 +0000 (Sun, 10 Jul 2011)
Log Message:
-----------
Merge preparation.
Modified Paths:
--------------
branches/opengles/LWJGL/src/java/org/lwjgl/opencl/CallbackUtil.java
branches/opengles/LWJGL/src/native/common/extcl.h
branches/opengles/LWJGL/src/native/common/org_lwjgl_opencl_CallbackUtil.c
Modified: branches/opengles/LWJGL/src/java/org/lwjgl/opencl/CallbackUtil.java
===================================================================
--- branches/opengles/LWJGL/src/java/org/lwjgl/opencl/CallbackUtil.java 2011-07-10 00:31:16 UTC (rev 3559)
+++ branches/opengles/LWJGL/src/java/org/lwjgl/opencl/CallbackUtil.java 2011-07-10 10:26:36 UTC (rev 3560)
@@ -107,14 +107,13 @@
* @param user_data the global reference pointer
*/
static void registerCallback(final CLContext context, final long user_data) {
- if ( context.getPointerUnsafe() == 0 ) {
- if ( user_data != 0 )
- deleteGlobalRef(user_data);
+ if ( user_data == 0 )
return;
- }
- if ( user_data != 0 )
+ if ( context.isValid() )
contextUserData.put(context, user_data);
+ else
+ deleteGlobalRef(user_data);
}
/**
Modified: branches/opengles/LWJGL/src/native/common/extcl.h
===================================================================
--- branches/opengles/LWJGL/src/native/common/extcl.h 2011-07-10 00:31:16 UTC (rev 3559)
+++ branches/opengles/LWJGL/src/native/common/extcl.h 2011-07-10 10:26:36 UTC (rev 3560)
@@ -59,18 +59,11 @@
#define CL_CALLBACK
#endif
-// TODO: This is a bug in current CL implementations (AMD's only?), remove when fixed. (used for cl_native_kernel_func)
-#if defined(_WIN32)
- #define CL_USER_FUNC_CALLBACK __cdecl
-#else
- #define CL_USER_FUNC_CALLBACK CL_CALLBACK
-#endif
-
typedef void (CL_CALLBACK * cl_create_context_callback)(const char *errinfo, const void *private_info, size_t cb, void *user_data);
typedef void (CL_CALLBACK * cl_mem_object_destructor_callback)(cl_mem memobj, void *user_data);
typedef void (CL_CALLBACK * cl_build_program_callback)(cl_program program, void *user_data);
typedef void (CL_CALLBACK * cl_event_callback)(cl_event event, cl_int event_command_exec_status, void *user_data);
-typedef void (CL_USER_FUNC_CALLBACK * cl_native_kernel_func)(void *args);
+typedef void (CL_CALLBACK * cl_native_kernel_func)(void *args);
// -----------------[ Cross-platform functions ]-----------------
Modified: branches/opengles/LWJGL/src/native/common/org_lwjgl_opencl_CallbackUtil.c
===================================================================
--- branches/opengles/LWJGL/src/native/common/org_lwjgl_opencl_CallbackUtil.c 2011-07-10 00:31:16 UTC (rev 3559)
+++ branches/opengles/LWJGL/src/native/common/org_lwjgl_opencl_CallbackUtil.c 2011-07-10 10:26:36 UTC (rev 3560)
@@ -142,7 +142,7 @@
// ----------------- [ NATIVE KERNEL CALLBACK ] -----------------
-static void CL_USER_FUNC_CALLBACK nativeKernelCallback(void *args) {
+static void CL_CALLBACK nativeKernelCallback(void *args) {
JNIEnv *env = attachCurrentThread();
jobject user_func = (jobject)(intptr_t)*(jlong *)args;
jint num_mem_objects = *(jint *)((char *)args + 8);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2011-07-10 00:31:22
|
Revision: 3559
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3559&view=rev
Author: kappa1
Date: 2011-07-10 00:31:16 +0000 (Sun, 10 Jul 2011)
Log Message:
-----------
minor update to comments and add missing JavaDoc
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java
trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java 2011-07-09 21:56:22 UTC (rev 3558)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java 2011-07-10 00:31:16 UTC (rev 3559)
@@ -956,8 +956,8 @@
* 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 indeed the window that
- * belongs to our current_window. If so then parent window is active.
+ * 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
*/
Modified: trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java 2011-07-09 21:56:22 UTC (rev 3558)
+++ trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java 2011-07-10 00:31:16 UTC (rev 3559)
@@ -120,6 +120,9 @@
* <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>
* <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>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2011-07-09 21:56:28
|
Revision: 3558
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3558&view=rev
Author: spasi
Date: 2011-07-09 21:56:22 +0000 (Sat, 09 Jul 2011)
Log Message:
-----------
Removed __cdecl workaround.
Modified Paths:
--------------
trunk/LWJGL/src/native/common/extcl.h
trunk/LWJGL/src/native/common/org_lwjgl_opencl_CallbackUtil.c
Modified: trunk/LWJGL/src/native/common/extcl.h
===================================================================
--- trunk/LWJGL/src/native/common/extcl.h 2011-07-09 10:20:48 UTC (rev 3557)
+++ trunk/LWJGL/src/native/common/extcl.h 2011-07-09 21:56:22 UTC (rev 3558)
@@ -59,18 +59,11 @@
#define CL_CALLBACK
#endif
-// TODO: This is a bug in current CL implementations (AMD's only?), remove when fixed. (used for cl_native_kernel_func)
-#if defined(_WIN32)
- #define CL_USER_FUNC_CALLBACK __cdecl
-#else
- #define CL_USER_FUNC_CALLBACK CL_CALLBACK
-#endif
-
typedef void (CL_CALLBACK * cl_create_context_callback)(const char *errinfo, const void *private_info, size_t cb, void *user_data);
typedef void (CL_CALLBACK * cl_mem_object_destructor_callback)(cl_mem memobj, void *user_data);
typedef void (CL_CALLBACK * cl_build_program_callback)(cl_program program, void *user_data);
typedef void (CL_CALLBACK * cl_event_callback)(cl_event event, cl_int event_command_exec_status, void *user_data);
-typedef void (CL_USER_FUNC_CALLBACK * cl_native_kernel_func)(void *args);
+typedef void (CL_CALLBACK * cl_native_kernel_func)(void *args);
// -----------------[ Cross-platform functions ]-----------------
Modified: trunk/LWJGL/src/native/common/org_lwjgl_opencl_CallbackUtil.c
===================================================================
--- trunk/LWJGL/src/native/common/org_lwjgl_opencl_CallbackUtil.c 2011-07-09 10:20:48 UTC (rev 3557)
+++ trunk/LWJGL/src/native/common/org_lwjgl_opencl_CallbackUtil.c 2011-07-09 21:56:22 UTC (rev 3558)
@@ -142,7 +142,7 @@
// ----------------- [ NATIVE KERNEL CALLBACK ] -----------------
-static void CL_USER_FUNC_CALLBACK nativeKernelCallback(void *args) {
+static void CL_CALLBACK nativeKernelCallback(void *args) {
JNIEnv *env = attachCurrentThread();
jobject user_func = (jobject)(intptr_t)*(jlong *)args;
jint num_mem_objects = *(jint *)((char *)args + 8);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2011-07-09 10:20:55
|
Revision: 3557
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3557&view=rev
Author: spasi
Date: 2011-07-09 10:20:48 +0000 (Sat, 09 Jul 2011)
Log Message:
-----------
Added support for EXT_framebuffer_multisample_blit_scaled.
Added Paths:
-----------
trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_framebuffer_multisample_blit_scaled.java
Added: trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_framebuffer_multisample_blit_scaled.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_framebuffer_multisample_blit_scaled.java (rev 0)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_framebuffer_multisample_blit_scaled.java 2011-07-09 10:20:48 UTC (rev 3557)
@@ -0,0 +1,40 @@
+/*
+ * 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
+ * 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 EXT_framebuffer_multisample_blit_scaled {
+
+ /** Accepted by the <filter> parameter of BlitFramebuffer: */
+ int GL_SCALED_RESOLVE_FASTEST_EXT = 0x90BA,
+ GL_SCALED_RESOLVE_NICEST_EXT = 0x90BB;
+
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2011-07-08 17:47:22
|
Revision: 3556
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3556&view=rev
Author: kappa1
Date: 2011-07-08 17:47:16 +0000 (Fri, 08 Jul 2011)
Log Message:
-----------
Remove dead code from AWTGears example
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/test/opengl/awt/AWTGears.java
Modified: trunk/LWJGL/src/java/org/lwjgl/test/opengl/awt/AWTGears.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/test/opengl/awt/AWTGears.java 2011-07-02 20:50:27 UTC (rev 3555)
+++ trunk/LWJGL/src/java/org/lwjgl/test/opengl/awt/AWTGears.java 2011-07-08 17:47:16 UTC (rev 3556)
@@ -35,18 +35,9 @@
import java.awt.Color;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
-import java.nio.FloatBuffer;
-import org.lwjgl.BufferUtils;
import org.lwjgl.LWJGLException;
-import org.lwjgl.LWJGLUtil;
-import org.lwjgl.Sys;
-import org.lwjgl.opengl.AWTGLCanvas;
-import org.lwjgl.opengl.GLContext;
-import static org.lwjgl.opengl.ARBTransposeMatrix.*;
-import static org.lwjgl.opengl.GL11.*;
-
/**
* <p>
* AWT version of the gears demo
@@ -57,23 +48,6 @@
*/
public class AWTGears extends Frame {
- /** AWT GL canvas */
- private AWTGLCanvas canvas0;
-
- private float view_rotx = 20.0f;
-
- private float view_roty = 30.0f;
-
- private float view_rotz;
-
- private int gear1;
-
- private int gear2;
-
- private int gear3;
-
- private float angle;
-
/**
* C'tor
*/
@@ -94,185 +68,6 @@
setVisible(true);
}
- private void setup() {
- // setup ogl
- FloatBuffer pos = BufferUtils.createFloatBuffer(4).put(new float[] { 5.0f, 5.0f, 10.0f, 0.0f});
- FloatBuffer red = BufferUtils.createFloatBuffer(4).put(new float[] { 0.8f, 0.1f, 0.0f, 1.0f});
- FloatBuffer green = BufferUtils.createFloatBuffer(4).put(new float[] { 0.0f, 0.8f, 0.2f, 1.0f});
- FloatBuffer blue = BufferUtils.createFloatBuffer(4).put(new float[] { 0.2f, 0.2f, 1.0f, 1.0f});
- pos.flip();
- red.flip();
- green.flip();
- blue.flip();
-
- glLight(GL_LIGHT0, GL_POSITION, pos);
- glEnable(GL_CULL_FACE);
- glEnable(GL_LIGHTING);
- glEnable(GL_LIGHT0);
- glEnable(GL_DEPTH_TEST);
-
- /* make the gears */
- gear1 = glGenLists(1);
- glNewList(gear1, GL_COMPILE);
- glMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, red);
- gear(1.0f, 4.0f, 1.0f, 20, 0.7f);
- glEndList();
-
- gear2 = glGenLists(1);
- glNewList(gear2, GL_COMPILE);
- glMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, green);
- gear(0.5f, 2.0f, 2.0f, 10, 0.7f);
- glEndList();
-
- gear3 = glGenLists(1);
- glNewList(gear3, GL_COMPILE);
- glMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, blue);
- gear(1.3f, 2.0f, 0.5f, 10, 0.7f);
- glEndList();
-
- glEnable(GL_NORMALIZE);
-
- glMatrixMode(GL_PROJECTION);
-
- System.err.println("LWJGL: " + Sys.getVersion() + " / " + LWJGLUtil.getPlatformName());
- System.err.println("GL_VENDOR: " + glGetString(GL_VENDOR));
- System.err.println("GL_RENDERER: " + glGetString(GL_RENDERER));
- System.err.println("GL_VERSION: " + glGetString(GL_VERSION));
- System.err.println();
- System.err.println("glLoadTransposeMatrixfARB() supported: " + GLContext.getCapabilities().GL_ARB_transpose_matrix);
- if (!GLContext.getCapabilities().GL_ARB_transpose_matrix) {
- // --- not using extensions
- glLoadIdentity();
- } else {
- // --- using extensions
- final FloatBuffer identityTranspose = BufferUtils.createFloatBuffer(16).put(
- new float[] { 1, 0, 0, 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0, 0, 0, 1});
- identityTranspose.flip();
- glLoadTransposeMatrixARB(identityTranspose);
- }
-
- float h = (float) 300 / (float) 300;
- glFrustum(-1.0f, 1.0f, -h, h, 5.0f, 60.0f);
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- glTranslatef(0.0f, 0.0f, -40.0f);
- }
-
- /**
- * Draw a gear wheel. You'll probably want to call this function when
- * building a display list since we do a lot of trig here.
- *
- * @param inner_radius radius of hole at center
- * @param outer_radius radius at center of teeth
- * @param width width of gear
- * @param teeth number of teeth
- * @param tooth_depth depth of tooth
- */
- private void gear(float inner_radius, float outer_radius, float width, int teeth, float tooth_depth) {
- int i;
- float r0, r1, r2;
- float angle, da;
- float u, v, len;
-
- r0 = inner_radius;
- r1 = outer_radius - tooth_depth / 2.0f;
- r2 = outer_radius + tooth_depth / 2.0f;
-
- da = 2.0f * (float) Math.PI / teeth / 4.0f;
-
- glShadeModel(GL_FLAT);
-
- glNormal3f(0.0f, 0.0f, 1.0f);
-
- /* draw front face */
- glBegin(GL_QUAD_STRIP);
- for (i = 0; i <= teeth; i++) {
- angle = i * 2.0f * (float) Math.PI / teeth;
- glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), width * 0.5f);
- glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), width * 0.5f);
- if (i < teeth) {
- glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), width * 0.5f);
- glVertex3f(r1 * (float) Math.cos(angle + 3.0f * da), r1 * (float) Math.sin(angle + 3.0f * da),
- width * 0.5f);
- }
- }
- glEnd();
-
- /* draw front sides of teeth */
- glBegin(GL_QUADS);
- for (i = 0; i < teeth; i++) {
- angle = i * 2.0f * (float) Math.PI / teeth;
- glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), width * 0.5f);
- glVertex3f(r2 * (float) Math.cos(angle + da), r2 * (float) Math.sin(angle + da), width * 0.5f);
- glVertex3f(r2 * (float) Math.cos(angle + 2.0f * da), r2 * (float) Math.sin(angle + 2.0f * da), width * 0.5f);
- glVertex3f(r1 * (float) Math.cos(angle + 3.0f * da), r1 * (float) Math.sin(angle + 3.0f * da), width * 0.5f);
- }
- glEnd();
-
- /* draw back face */
- glBegin(GL_QUAD_STRIP);
- for (i = 0; i <= teeth; i++) {
- angle = i * 2.0f * (float) Math.PI / teeth;
- glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), -width * 0.5f);
- glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), -width * 0.5f);
- glVertex3f(r1 * (float) Math.cos(angle + 3 * da), r1 * (float) Math.sin(angle + 3 * da), -width * 0.5f);
- glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), -width * 0.5f);
- }
- glEnd();
-
- /* draw back sides of teeth */
- glBegin(GL_QUADS);
- for (i = 0; i < teeth; i++) {
- angle = i * 2.0f * (float) Math.PI / teeth;
- glVertex3f(r1 * (float) Math.cos(angle + 3 * da), r1 * (float) Math.sin(angle + 3 * da), -width * 0.5f);
- glVertex3f(r2 * (float) Math.cos(angle + 2 * da), r2 * (float) Math.sin(angle + 2 * da), -width * 0.5f);
- glVertex3f(r2 * (float) Math.cos(angle + da), r2 * (float) Math.sin(angle + da), -width * 0.5f);
- glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), -width * 0.5f);
- }
- glEnd();
-
- /* draw outward faces of teeth */
- glBegin(GL_QUAD_STRIP);
- for (i = 0; i < teeth; i++) {
- angle = i * 2.0f * (float) Math.PI / teeth;
- glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), width * 0.5f);
- glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), -width * 0.5f);
- u = r2 * (float) Math.cos(angle + da) - r1 * (float) Math.cos(angle);
- v = r2 * (float) Math.sin(angle + da) - r1 * (float) Math.sin(angle);
- len = (float) Math.sqrt(u * u + v * v);
- u /= len;
- v /= len;
- glNormal3f(v, -u, 0.0f);
- glVertex3f(r2 * (float) Math.cos(angle + da), r2 * (float) Math.sin(angle + da), width * 0.5f);
- glVertex3f(r2 * (float) Math.cos(angle + da), r2 * (float) Math.sin(angle + da), -width * 0.5f);
- glNormal3f((float) Math.cos(angle), (float) Math.sin(angle), 0.0f);
- glVertex3f(r2 * (float) Math.cos(angle + 2 * da), r2 * (float) Math.sin(angle + 2 * da), width * 0.5f);
- glVertex3f(r2 * (float) Math.cos(angle + 2 * da), r2 * (float) Math.sin(angle + 2 * da), -width * 0.5f);
- u = r1 * (float) Math.cos(angle + 3 * da) - r2 * (float) Math.cos(angle + 2 * da);
- v = r1 * (float) Math.sin(angle + 3 * da) - r2 * (float) Math.sin(angle + 2 * da);
- glNormal3f(v, -u, 0.0f);
- glVertex3f(r1 * (float) Math.cos(angle + 3 * da), r1 * (float) Math.sin(angle + 3 * da), width * 0.5f);
- glVertex3f(r1 * (float) Math.cos(angle + 3 * da), r1 * (float) Math.sin(angle + 3 * da), -width * 0.5f);
- glNormal3f((float) Math.cos(angle), (float) Math.sin(angle), 0.0f);
- }
- glVertex3f(r1 * (float) Math.cos(0), r1 * (float) Math.sin(0), width * 0.5f);
- glVertex3f(r1 * (float) Math.cos(0), r1 * (float) Math.sin(0), -width * 0.5f);
- glEnd();
-
- glShadeModel(GL_SMOOTH);
-
- /* draw inside radius cylinder */
- glBegin(GL_QUAD_STRIP);
- for (i = 0; i <= teeth; i++) {
- angle = i * 2.0f * (float) Math.PI / teeth;
- glNormal3f(-(float) Math.cos(angle), -(float) Math.sin(angle), 0.0f);
- glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), -width * 0.5f);
- glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), width * 0.5f);
- }
- glEnd();
- }
-
public static void main(String[] args) throws LWJGLException {
new AWTGears();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2011-07-02 20:50:33
|
Revision: 3555
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3555&view=rev
Author: kappa1
Date: 2011-07-02 20:50:27 +0000 (Sat, 02 Jul 2011)
Log Message:
-----------
LinuxDisplay - fix remaining issues with focus handling when running in xembed mode.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java
trunk/LWJGL/src/native/linux/org_lwjgl_opengl_Display.c
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java 2011-06-26 11:50:23 UTC (rev 3554)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java 2011-07-02 20:50:27 UTC (rev 3555)
@@ -136,11 +136,14 @@
private boolean close_requested;
private long current_cursor;
private long blank_cursor;
+ private boolean mouseInside = true;
+
private Canvas parent;
private long parent_window;
private boolean xembedded;
- private boolean parent_focus;
- private boolean mouseInside = true;
+ private long parent_proxy_focus_window;
+ private boolean parent_focused;
+ private long last_window_focus = 0;
private LinuxKeyboard keyboard;
private LinuxMouse mouse;
@@ -148,12 +151,12 @@
private final FocusListener focus_listener = new FocusListener() {
public void focusGained(FocusEvent e) {
synchronized (GlobalLock.lock) {
- focused = true;
+ parent_focused = true;
}
}
public void focusLost(FocusEvent e) {
synchronized (GlobalLock.lock) {
- focused = false;
+ parent_focused = false;
}
}
};
@@ -460,9 +463,7 @@
if (parent != null) {
parent.addFocusListener(focus_listener);
if (parent.isFocusOwner()) {
- nGrabKeyboard(getDisplay(), current_window);
- focused = true;
- input_released = false;
+ parent_focused = true;
}
}
} finally {
@@ -480,9 +481,12 @@
private static native long getRootWindow(long display, int screen);
private static native boolean hasProperty(long display, long window, long property);
private static native long getParentWindow(long display, long window) throws LWJGLException;
+ private static native int getChildCount(long display, long window) throws LWJGLException;
private static native void mapRaised(long display, long window);
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) {
@@ -743,8 +747,6 @@
return peer_info;
}
- static native void setInputFocus(long display, long window, long time);
-
private void relayEventToParent(LinuxEvent event_buffer, int event_mask) {
tmp_event_buffer.copyFrom(event_buffer);
tmp_event_buffer.setWindow(parent_window);
@@ -900,22 +902,97 @@
unlockAWT();
}
}
-
+
private void checkInput() {
if (parent == null) return;
- if (focused != keyboard_grabbed) {
- if (focused) {
- grabKeyboard();
- input_released = false;
+ 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
}
- else {
- ungrabKeyboard();
- input_released = true;
+
+ if (last_window_focus != current_focus_window || parent_focused != focused) {
+ if (isParentWindowActive(current_focus_window)) {
+ if (parent_focused) {
+ nSetInputFocus(getDisplay(), current_window, CurrentTime);
+ last_window_focus = current_window;
+ focused = true;
+ }
+ else {
+ // return focus to the parent proxy focus window
+ nSetInputFocus(getDisplay(), parent_proxy_focus_window, CurrentTime);
+ last_window_focus = parent_proxy_focus_window;
+ focused = false;
+ }
+ }
+ else {
+ last_window_focus = current_focus_window;
+ focused = false;
+ }
}
}
+ else {
+ if (parent_focused != keyboard_grabbed) {
+ if (parent_focused) {
+ grabKeyboard();
+ input_released = false;
+ focused = true;
+ }
+ else {
+ ungrabKeyboard();
+ input_released = true;
+ focused = false;
+ }
+ }
+ }
}
+ /**
+ * 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
+ * parent window and then test whether this is indeed the window that
+ * belongs 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;
@@ -928,8 +1005,6 @@
releaseInput();
}
}
-
- static native long nGetInputFocus(long display);
private void releaseInput() {
if (isLegacyFullscreen() || input_released)
Modified: trunk/LWJGL/src/native/linux/org_lwjgl_opengl_Display.c
===================================================================
--- trunk/LWJGL/src/native/linux/org_lwjgl_opengl_Display.c 2011-06-26 11:50:23 UTC (rev 3554)
+++ trunk/LWJGL/src/native/linux/org_lwjgl_opengl_Display.c 2011-07-02 20:50:27 UTC (rev 3555)
@@ -380,6 +380,22 @@
return parent;
}
+JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_getChildCount(JNIEnv *env, jclass unused, jlong display, jlong window_ptr) {
+ Display *disp = (Display *)(intptr_t)display;
+ Window window = (Window)window_ptr;
+ Window root, parent;
+ Window *children;
+ unsigned int nchildren;
+ if (XQueryTree(disp, window, &root, &parent, &children, &nchildren) == 0) {
+ throwException(env, "XQueryTree failed");
+ return None;
+ }
+ if (children != NULL)
+ XFree(children);
+
+ return nchildren;
+}
+
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_LinuxDisplay_hasProperty(JNIEnv *env, jclass unusued, jlong display, jlong window_ptr, jlong property_ptr) {
Display *disp = (Display *)(intptr_t)display;
Window window = (Window)window_ptr;
@@ -399,7 +415,15 @@
return result;
}
-JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_setInputFocus(JNIEnv *env, jclass clazz, jlong display, jlong window_ptr, jlong time) {
+JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetInputFocus(JNIEnv *env, jclass unused, jlong display_ptr) {
+ Display *disp = (Display *)(intptr_t)display_ptr;
+ int revert_mode;
+ Window win;
+ XGetInputFocus(disp, &win, &revert_mode);
+ return win;
+}
+
+JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSetInputFocus(JNIEnv *env, jclass clazz, jlong display, jlong window_ptr, jlong time) {
Display *disp = (Display *)(intptr_t)display;
Window window = (Window)window_ptr;
XSetInputFocus(disp, window, RevertToParent, time);
@@ -574,14 +598,6 @@
return cursor;
}
-JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetInputFocus(JNIEnv *env, jclass unused, jlong display_ptr) {
- Display *disp = (Display *)(intptr_t)display_ptr;
- int revert_mode;
- Window win;
- XGetInputFocus(disp, &win, &revert_mode);
- return win;
-}
-
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nIconifyWindow(JNIEnv *env, jclass unused, jlong display_ptr, jlong window_ptr, jint screen) {
Display *disp = (Display *)(intptr_t)display_ptr;
Window win = (Window)window_ptr;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|