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
|
|
From: <sp...@us...> - 2010-10-12 20:49:36
|
Revision: 3442
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3442&view=rev
Author: spasi
Date: 2010-10-12 20:49:29 +0000 (Tue, 12 Oct 2010)
Log Message:
-----------
Another String signature fix.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/util/generator/Utils.java
Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/Utils.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/Utils.java 2010-10-12 20:25:33 UTC (rev 3441)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/Utils.java 2010-10-12 20:49:29 UTC (rev 3442)
@@ -137,7 +137,7 @@
}
private static boolean isAddressableTypeImpl(Class type) {
- return Buffer.class.isAssignableFrom(type) || PointerBuffer.class.isAssignableFrom(type) || CharSequence.class.isAssignableFrom(type);
+ return Buffer.class.isAssignableFrom(type) || PointerBuffer.class.isAssignableFrom(type) || (CharSequence.class.isAssignableFrom(type) && !String.class.equals(type));
}
public static Class getJavaType(TypeMirror type_mirror) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2010-10-12 20:25:39
|
Revision: 3441
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3441&view=rev
Author: spasi
Date: 2010-10-12 20:25:33 +0000 (Tue, 12 Oct 2010)
Log Message:
-----------
Fixed String signatures.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/util/generator/SignatureTranslator.java
Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/SignatureTranslator.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/SignatureTranslator.java 2010-10-12 19:21:35 UTC (rev 3440)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/SignatureTranslator.java 2010-10-12 20:25:33 UTC (rev 3441)
@@ -83,7 +83,7 @@
public void visitClassType(ClassType t) {
Class type = NativeTypeTranslator.getClassFromType(t);
String type_name;
- if ( CharSequence.class.isAssignableFrom(type) || CharSequence[].class.isAssignableFrom(type) || PointerBuffer.class.isAssignableFrom(type) )
+ if ( (CharSequence.class.isAssignableFrom(type) && !String.class.equals(type)) || CharSequence[].class.isAssignableFrom(type) || PointerBuffer.class.isAssignableFrom(type) )
type_name = ByteBuffer.class.getName();
else if ( org.lwjgl.PointerWrapper.class.isAssignableFrom(type) ) {
signature.append("J");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2010-10-12 19:21:42
|
Revision: 3440
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3440&view=rev
Author: matzon
Date: 2010-10-12 19:21:35 +0000 (Tue, 12 Oct 2010)
Log Message:
-----------
updates to webstart to streamline process
Modified Paths:
--------------
trunk/LWJGL/platform_build/build-definitions.xml
trunk/LWJGL/platform_build/build-webstart.xml
Added Paths:
-----------
trunk/LWJGL/www/webstart/
trunk/LWJGL/www/webstart/demo.php
trunk/LWJGL/www/webstart/extension.jnlp
trunk/LWJGL/www/webstart/logo.png
trunk/LWJGL/www/webstart/source.php
Modified: trunk/LWJGL/platform_build/build-definitions.xml
===================================================================
--- trunk/LWJGL/platform_build/build-definitions.xml 2010-10-12 17:44:19 UTC (rev 3439)
+++ trunk/LWJGL/platform_build/build-definitions.xml 2010-10-12 19:21:35 UTC (rev 3440)
@@ -13,6 +13,7 @@
<property name="lwjgl.temp" location="temp" />
<property name="lwjgl.res" location="res" />
<property name="lwjgl.version" value="2.6" />
+ <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="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"/>
Modified: trunk/LWJGL/platform_build/build-webstart.xml
===================================================================
--- trunk/LWJGL/platform_build/build-webstart.xml 2010-10-12 17:44:19 UTC (rev 3439)
+++ trunk/LWJGL/platform_build/build-webstart.xml 2010-10-12 19:21:35 UTC (rev 3440)
@@ -17,32 +17,39 @@
</antcall>
</target>
- <!-- -->
+ <!-- Create webstart demo and extension from release files -->
<target name="-webstart_demo" description="Using released files, creates the necessary files used for jnlp demos">
<!-- delete existing temp -->
<delete dir="${lwjgl.temp}"/>
- <!-- unzip common files -->
- <unzip src="${lwjgl.dist}/lwjgl-${lwjgl.version}.zip" dest="${lwjgl.temp}/jnlp/temp" overwrite="true"/>
+ <!-- unzip release to temp dir -->
+ <unzip src="${lwjgl.dist}/lwjgl-${lwjgl.version}.zip" dest="${lwjgl.temp}/webstart/temp" overwrite="true"/>
- <!-- move files to unified structure -->
- <move todir="${lwjgl.temp}/jnlp/temp">
- <fileset dir="${lwjgl.temp}/jnlp/temp/lwjgl-${lwjgl.version}/">
- <include name="**"/>
- </fileset>
- </move>
+ <!-- DEMO SECTION -->
+ <move file="${lwjgl.temp}/webstart/temp/lwjgl-${lwjgl.version}/jar/lwjgl_test.jar" tofile="${lwjgl.temp}/webstart/lwjgl_test.jar"/>
+ <jar destfile="${lwjgl.temp}/webstart/lwjgl_test.jar" update="true">
+ <manifest>
+ <attribute name="Sealed" value="true"/>
+ </manifest>
+ </jar>
+ <jar destfile="${lwjgl.temp}/webstart/media.jar" basedir="${lwjgl.res}">
+ <manifest>
+ <attribute name="Sealed" value="true"/>
+ </manifest>
+ </jar>
- <!-- move relevant files to root -->
- <move todir="${lwjgl.temp}/jnlp/" flatten="true">
- <fileset dir="${lwjgl.temp}/jnlp/temp">
+ <!-- EXTENSION SECTION -->
+ <move todir="${lwjgl.temp}/webstart/${lwjgl.version}/" flatten="true">
+ <fileset dir="${lwjgl.temp}/webstart/temp">
<include name="**/jinput.jar"/>
<include name="**/lwjgl*.jar"/>
+ <exclude name="**/lwjgl_util_applet.jar"/>
+ <exclude name="**/lwjgl-debug.jar"/>
</fileset>
</move>
- <!-- update Trusted-Library -->
- <jar destfile="${lwjgl.temp}/jnlp/lwjgl.jar" update="true">
+ <jar destfile="${lwjgl.temp}/webstart/${lwjgl.version}/lwjgl.jar" update="true">
<manifest>
<attribute name="Specification-Title" value="LWJGL ${lwjgl.version}"/>
<attribute name="Specification-Version" value="${lwjgl.version}"/>
@@ -57,7 +64,7 @@
</manifest>
</jar>
- <jar destfile="${lwjgl.temp}/jnlp/jinput.jar" update="true">
+ <jar destfile="${lwjgl.temp}/webstart/${lwjgl.version}/jinput.jar" update="true">
<manifest>
<attribute name="Specification-Title" value="LWJGL ${lwjgl.version}"/>
<attribute name="Specification-Version" value="${lwjgl.version}"/>
@@ -72,7 +79,7 @@
</manifest>
</jar>
- <jar destfile="${lwjgl.temp}/jnlp/lwjgl_util.jar" update="true">
+ <jar destfile="${lwjgl.temp}/webstart/${lwjgl.version}/lwjgl_util.jar" update="true">
<manifest>
<attribute name="Specification-Title" value="LWJGL ${lwjgl.version}"/>
<attribute name="Specification-Version" value="${lwjgl.version}"/>
@@ -87,14 +94,8 @@
</manifest>
</jar>
- <jar destfile="${lwjgl.temp}/jnlp/lwjgl_test.jar" update="true">
- <manifest>
- <attribute name="Sealed" value="true"/>
- </manifest>
- </jar>
-
<!-- create native jars -->
- <jar destfile="${lwjgl.temp}/jnlp/native_windows.jar" basedir="${lwjgl.temp}/jnlp/temp/native/windows">
+ <jar destfile="${lwjgl.temp}/webstart/${lwjgl.version}/native_windows.jar" basedir="${lwjgl.temp}/webstart/temp/lwjgl-${lwjgl.version}/native/windows">
<manifest>
<attribute name="Specification-Title" value="LWJGL ${lwjgl.version}"/>
<attribute name="Specification-Version" value="${lwjgl.version}"/>
@@ -109,7 +110,7 @@
</manifest>
</jar>
- <jar destfile="${lwjgl.temp}/jnlp/native_linux.jar" basedir="${lwjgl.temp}/jnlp/temp/native/linux">
+ <jar destfile="${lwjgl.temp}/webstart/${lwjgl.version}/native_linux.jar" basedir="${lwjgl.temp}/webstart/temp/lwjgl-${lwjgl.version}/native/linux">
<manifest>
<attribute name="Specification-Title" value="LWJGL ${lwjgl.version}"/>
<attribute name="Specification-Version" value="${lwjgl.version}"/>
@@ -124,7 +125,7 @@
</manifest>
</jar>
- <jar destfile="${lwjgl.temp}/jnlp/native_macosx.jar" basedir="${lwjgl.temp}/jnlp/temp/native/macosx">
+ <jar destfile="${lwjgl.temp}/webstart/${lwjgl.version}/native_macosx.jar" basedir="${lwjgl.temp}/webstart/temp/lwjgl-${lwjgl.version}/native/macosx">
<manifest>
<attribute name="Specification-Title" value="LWJGL ${lwjgl.version}"/>
<attribute name="Specification-Version" value="${lwjgl.version}"/>
@@ -139,7 +140,7 @@
</manifest>
</jar>
- <jar destfile="${lwjgl.temp}/jnlp/native_solaris.jar" basedir="${lwjgl.temp}/jnlp/temp/native/solaris">
+ <jar destfile="${lwjgl.temp}/webstart/${lwjgl.version}/native_solaris.jar" basedir="${lwjgl.temp}/webstart/temp/lwjgl-${lwjgl.version}/native/solaris">
<manifest>
<attribute name="Specification-Title" value="LWJGL ${lwjgl.version}"/>
<attribute name="Specification-Version" value="${lwjgl.version}"/>
@@ -153,21 +154,28 @@
<attribute name="Trusted-Library" value="true"/>
</manifest>
</jar>
-
- <!-- create media jar -->
- <jar destfile="${lwjgl.temp}/jnlp/media.jar" basedir="${lwjgl.res}">
- <manifest>
- <attribute name="Sealed" value="true"/>
- </manifest>
- </jar>
<!-- sign 'em -->
- <signjar jar="${lwjgl.temp}/jnlp/lwjgl.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/>
- <signjar jar="${lwjgl.temp}/jnlp/lwjgl_util.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/>
- <signjar jar="${lwjgl.temp}/jnlp/jinput.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/>
- <signjar jar="${lwjgl.temp}/jnlp/native_solaris.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/>
- <signjar jar="${lwjgl.temp}/jnlp/native_linux.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/>
- <signjar jar="${lwjgl.temp}/jnlp/native_macosx.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/>
- <signjar jar="${lwjgl.temp}/jnlp/native_windows.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/>
+ <signjar jar="${lwjgl.temp}/webstart/${lwjgl.version}/lwjgl.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/>
+ <signjar jar="${lwjgl.temp}/webstart/${lwjgl.version}/lwjgl_util.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/>
+ <signjar jar="${lwjgl.temp}/webstart/${lwjgl.version}/jinput.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/>
+ <signjar jar="${lwjgl.temp}/webstart/${lwjgl.version}/native_solaris.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/>
+ <signjar jar="${lwjgl.temp}/webstart/${lwjgl.version}/native_linux.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/>
+ <signjar jar="${lwjgl.temp}/webstart/${lwjgl.version}/native_macosx.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/>
+ <signjar jar="${lwjgl.temp}/webstart/${lwjgl.version}/native_windows.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/>
+
+ <!-- copy over extension jnlp file -->
+ <copy todir="${lwjgl.temp}/webstart/${lwjgl.version}">
+ <fileset dir="${lwjgl.web}/webstart">
+ <include name="extension.jnlp"/>
+ </fileset>
+ <filterset>
+ <filter token="LWJGL_VERSION" value="${lwjgl.version}"/>
+ </filterset>
+ </copy>
+
+ <!-- nuke extracted dir -->
+ <delete dir="${lwjgl.temp}/webstart/temp"/>
+
</target>
</project>
\ No newline at end of file
Added: trunk/LWJGL/www/webstart/demo.php
===================================================================
--- trunk/LWJGL/www/webstart/demo.php (rev 0)
+++ trunk/LWJGL/www/webstart/demo.php 2010-10-12 19:21:35 UTC (rev 3440)
@@ -0,0 +1,35 @@
+<?
+header("Content-type: application/x-java-jnlp-file");
+?>
+
+<!-- JNLP File for LWJGL Demos -->
+<jnlp
+ spec="1.0+"
+ codebase="http://lwjgl.org/webstart/"
+ href="demo.php/<?php echo substr($_SERVER["PATH_INFO"], 1, strlen($_SERVER["PATH_INFO"])-1); ?>">
+ <information>
+ <title>LWJGL Demo [<?php echo substr($_SERVER["PATH_INFO"], 1, strlen($_SERVER["PATH_INFO"])-1); ?>]</title>
+ <vendor>LWJGL</vendor>
+ <homepage href="http://lwjgl.org/"/>
+ <description>Demonstration of LWJGL</description>
+ <description kind="short">Technology Preview</description>
+ <icon kind="splash" href="logo.png" />
+ <offline-allowed/>
+ </information>
+ <resources>
+ <j2se version="1.4+"/>
+ <jar href="lwjgl_test.jar" main="true"/>
+ <jar href="media.jar"/>
+ <extension name="lwjgl" href="http://lwjgl.org/webstart/2.5/extension.jnlp" />
+ </resources>
+ <application-desc main-class="org.lwjgl.<?php echo substr($_SERVER["PATH_INFO"], 1, strlen($_SERVER["PATH_INFO"])-1); ?>">
+ <?php
+ if(isset($HTTP_GET_VARS['arguments'])) {
+ $arguments = $HTTP_GET_VARS['arguments'];
+ foreach ($arguments as $argument) {
+ echo "<argument>" . $argument . "</argument>\n";
+ }
+ }
+ ?>
+ </application-desc>
+</jnlp>
Added: trunk/LWJGL/www/webstart/extension.jnlp
===================================================================
--- trunk/LWJGL/www/webstart/extension.jnlp (rev 0)
+++ trunk/LWJGL/www/webstart/extension.jnlp 2010-10-12 19:21:35 UTC (rev 3440)
@@ -0,0 +1,36 @@
+<jnlp codebase="http://lwjgl.org/webstart/@LWJGL_VERSION@" href="extension.jnlp">
+ <information>
+ <title>LWJGL</title>
+ <vendor>lwjgl.org</vendor>
+ <homepage href="http://lwjgl.org/"/>
+ <description>LWJGL webstart extension</description>
+ <description kind="short">LWJGL webstart extension</description>
+ <offline-allowed/>
+ </information>
+ <update check="background" policy="always"/>
+ <security>
+ <all-permissions/>
+ </security>
+ <resources>
+ <jar href="lwjgl.jar"/>
+ <jar href="lwjgl_util.jar"/>
+ <jar href="jinput.jar"/>
+ </resources>
+ <resources os="Windows">
+ <j2se version="1.4+"/>
+ <nativelib href="native_windows.jar"/>
+ </resources>
+ <resources os="Linux">
+ <j2se version="1.4+"/>
+ <nativelib href="native_linux.jar"/>
+ </resources>
+ <resources os="Mac OS X">
+ <j2se version="1.4+"/>
+ <nativelib href="native_macosx.jar"/>
+ </resources>
+ <resources os="SunOS" arch="x86">
+ <j2se version="1.4+"/>
+ <nativelib href="native_solaris.jar"/>
+ </resources>
+ <component-desc />
+</jnlp>
Added: trunk/LWJGL/www/webstart/logo.png
===================================================================
(Binary files differ)
Property changes on: trunk/LWJGL/www/webstart/logo.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/LWJGL/www/webstart/source.php
===================================================================
--- trunk/LWJGL/www/webstart/source.php (rev 0)
+++ trunk/LWJGL/www/webstart/source.php 2010-10-12 19:21:35 UTC (rev 3440)
@@ -0,0 +1,4 @@
+<?php
+ header("Location: http://java-game-lib.svn.sourceforge.net/viewvc/java-game-lib/trunk/LWJGL/src/java/org/lwjgl/" . $_GET['path'] . "?rev=HEAD&content-type=text/vnd.viewcvs-markup");
+ exit;
+?>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2010-10-12 17:44:25
|
Revision: 3439
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3439&view=rev
Author: matzon
Date: 2010-10-12 17:44:19 +0000 (Tue, 12 Oct 2010)
Log Message:
-----------
updates to jnlp to work as installable unit
Modified Paths:
--------------
trunk/LWJGL/platform_build/build-webstart.xml
Modified: trunk/LWJGL/platform_build/build-webstart.xml
===================================================================
--- trunk/LWJGL/platform_build/build-webstart.xml 2010-10-12 15:34:26 UTC (rev 3438)
+++ trunk/LWJGL/platform_build/build-webstart.xml 2010-10-12 17:44:19 UTC (rev 3439)
@@ -25,8 +25,6 @@
<!-- unzip common files -->
<unzip src="${lwjgl.dist}/lwjgl-${lwjgl.version}.zip" dest="${lwjgl.temp}/jnlp/temp" overwrite="true"/>
- <copy file="${lwjgl.lib}/lwjgl_test.jar" tofile="${lwjgl.temp}/jnlp/temp/lwjgl-${lwjgl.version}/lwjgl_test.jar"/>
- <copy file="${lwjgl.lib}/lwjgl_util.jar" tofile="${lwjgl.temp}/jnlp/temp/lwjgl-${lwjgl.version}/lwjgl_util.jar"/>
<!-- move files to unified structure -->
<move todir="${lwjgl.temp}/jnlp/temp">
@@ -46,6 +44,14 @@
<!-- update Trusted-Library -->
<jar destfile="${lwjgl.temp}/jnlp/lwjgl.jar" update="true">
<manifest>
+ <attribute name="Specification-Title" value="LWJGL ${lwjgl.version}"/>
+ <attribute name="Specification-Version" value="${lwjgl.version}"/>
+ <attribute name="Specification-Vendor" value="lwjgl.org"/>
+ <attribute name="Implementation-Title" value="LWJGL ${lwjgl.version}"/>
+ <attribute name="Implementation-Version" value="${lwjgl.version}"/>
+ <attribute name="Implementation-Vendor" value="lwjgl.org"/>
+ <attribute name="Implementation-Vendor-Id" value="org.lwjgl"/>
+ <attribute name="Extension-Name" value="org.lwjgl"/>
<attribute name="Sealed" value="true"/>
<attribute name="Trusted-Library" value="true"/>
</manifest>
@@ -53,6 +59,14 @@
<jar destfile="${lwjgl.temp}/jnlp/jinput.jar" update="true">
<manifest>
+ <attribute name="Specification-Title" value="LWJGL ${lwjgl.version}"/>
+ <attribute name="Specification-Version" value="${lwjgl.version}"/>
+ <attribute name="Specification-Vendor" value="lwjgl.org"/>
+ <attribute name="Implementation-Title" value="LWJGL ${lwjgl.version}"/>
+ <attribute name="Implementation-Version" value="${lwjgl.version}"/>
+ <attribute name="Implementation-Vendor" value="lwjgl.org"/>
+ <attribute name="Implementation-Vendor-Id" value="org.lwjgl"/>
+ <attribute name="Extension-Name" value="org.lwjgl"/>
<attribute name="Sealed" value="true"/>
<attribute name="Trusted-Library" value="true"/>
</manifest>
@@ -60,6 +74,14 @@
<jar destfile="${lwjgl.temp}/jnlp/lwjgl_util.jar" update="true">
<manifest>
+ <attribute name="Specification-Title" value="LWJGL ${lwjgl.version}"/>
+ <attribute name="Specification-Version" value="${lwjgl.version}"/>
+ <attribute name="Specification-Vendor" value="lwjgl.org"/>
+ <attribute name="Implementation-Title" value="LWJGL ${lwjgl.version}"/>
+ <attribute name="Implementation-Version" value="${lwjgl.version}"/>
+ <attribute name="Implementation-Vendor" value="lwjgl.org"/>
+ <attribute name="Implementation-Vendor-Id" value="org.lwjgl"/>
+ <attribute name="Extension-Name" value="org.lwjgl"/>
<attribute name="Sealed" value="true"/>
<attribute name="Trusted-Library" value="true"/>
</manifest>
@@ -68,32 +90,67 @@
<jar destfile="${lwjgl.temp}/jnlp/lwjgl_test.jar" update="true">
<manifest>
<attribute name="Sealed" value="true"/>
- <attribute name="Trusted-Library" value="true"/>
</manifest>
</jar>
<!-- create native jars -->
<jar destfile="${lwjgl.temp}/jnlp/native_windows.jar" basedir="${lwjgl.temp}/jnlp/temp/native/windows">
<manifest>
+ <attribute name="Specification-Title" value="LWJGL ${lwjgl.version}"/>
+ <attribute name="Specification-Version" value="${lwjgl.version}"/>
+ <attribute name="Specification-Vendor" value="lwjgl.org"/>
+ <attribute name="Implementation-Title" value="LWJGL ${lwjgl.version}"/>
+ <attribute name="Implementation-Version" value="${lwjgl.version}"/>
+ <attribute name="Implementation-Vendor" value="lwjgl.org"/>
+ <attribute name="Implementation-Vendor-Id" value="org.lwjgl"/>
+ <attribute name="Extension-Name" value="org.lwjgl"/>
<attribute name="Sealed" value="true"/>
+ <attribute name="Trusted-Library" value="true"/>
</manifest>
</jar>
<jar destfile="${lwjgl.temp}/jnlp/native_linux.jar" basedir="${lwjgl.temp}/jnlp/temp/native/linux">
<manifest>
+ <attribute name="Specification-Title" value="LWJGL ${lwjgl.version}"/>
+ <attribute name="Specification-Version" value="${lwjgl.version}"/>
+ <attribute name="Specification-Vendor" value="lwjgl.org"/>
+ <attribute name="Implementation-Title" value="LWJGL ${lwjgl.version}"/>
+ <attribute name="Implementation-Version" value="${lwjgl.version}"/>
+ <attribute name="Implementation-Vendor" value="lwjgl.org"/>
+ <attribute name="Implementation-Vendor-Id" value="org.lwjgl"/>
+ <attribute name="Extension-Name" value="org.lwjgl"/>
<attribute name="Sealed" value="true"/>
+ <attribute name="Trusted-Library" value="true"/>
</manifest>
</jar>
<jar destfile="${lwjgl.temp}/jnlp/native_macosx.jar" basedir="${lwjgl.temp}/jnlp/temp/native/macosx">
<manifest>
+ <attribute name="Specification-Title" value="LWJGL ${lwjgl.version}"/>
+ <attribute name="Specification-Version" value="${lwjgl.version}"/>
+ <attribute name="Specification-Vendor" value="lwjgl.org"/>
+ <attribute name="Implementation-Title" value="LWJGL ${lwjgl.version}"/>
+ <attribute name="Implementation-Version" value="${lwjgl.version}"/>
+ <attribute name="Implementation-Vendor" value="lwjgl.org"/>
+ <attribute name="Implementation-Vendor-Id" value="org.lwjgl"/>
+ <attribute name="Extension-Name" value="org.lwjgl"/>
<attribute name="Sealed" value="true"/>
+ <attribute name="Trusted-Library" value="true"/>
</manifest>
</jar>
<jar destfile="${lwjgl.temp}/jnlp/native_solaris.jar" basedir="${lwjgl.temp}/jnlp/temp/native/solaris">
<manifest>
+ <attribute name="Specification-Title" value="LWJGL ${lwjgl.version}"/>
+ <attribute name="Specification-Version" value="${lwjgl.version}"/>
+ <attribute name="Specification-Vendor" value="lwjgl.org"/>
+ <attribute name="Implementation-Title" value="LWJGL ${lwjgl.version}"/>
+ <attribute name="Implementation-Version" value="${lwjgl.version}"/>
+ <attribute name="Implementation-Vendor" value="lwjgl.org"/>
+ <attribute name="Implementation-Vendor-Id" value="org.lwjgl"/>
+ <attribute name="Extension-Name" value="org.lwjgl"/>
<attribute name="Sealed" value="true"/>
+ <attribute name="Trusted-Library" value="true"/>
</manifest>
</jar>
@@ -101,7 +158,6 @@
<jar destfile="${lwjgl.temp}/jnlp/media.jar" basedir="${lwjgl.res}">
<manifest>
<attribute name="Sealed" value="true"/>
- <attribute name="Trusted-Library" value="true"/>
</manifest>
</jar>
@@ -109,8 +165,6 @@
<signjar jar="${lwjgl.temp}/jnlp/lwjgl.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/>
<signjar jar="${lwjgl.temp}/jnlp/lwjgl_util.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/>
<signjar jar="${lwjgl.temp}/jnlp/jinput.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/>
- <signjar jar="${lwjgl.temp}/jnlp/lwjgl_test.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/>
- <signjar jar="${lwjgl.temp}/jnlp/media.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/>
<signjar jar="${lwjgl.temp}/jnlp/native_solaris.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/>
<signjar jar="${lwjgl.temp}/jnlp/native_linux.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/>
<signjar jar="${lwjgl.temp}/jnlp/native_macosx.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2010-10-12 15:34:33
|
Revision: 3438
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3438&view=rev
Author: matzon
Date: 2010-10-12 15:34:26 +0000 (Tue, 12 Oct 2010)
Log Message:
-----------
fixed issue with signed/unsigned code dialog popping up
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/examples/spaceinvaders/TextureLoader.java
trunk/LWJGL/src/java/org/lwjgl/util/WaveData.java
Modified: trunk/LWJGL/src/java/org/lwjgl/examples/spaceinvaders/TextureLoader.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/examples/spaceinvaders/TextureLoader.java 2010-10-12 09:32:34 UTC (rev 3437)
+++ trunk/LWJGL/src/java/org/lwjgl/examples/spaceinvaders/TextureLoader.java 2010-10-12 15:34:26 UTC (rev 3438)
@@ -33,6 +33,7 @@
import java.awt.Color;
import java.awt.Graphics;
+import java.awt.Image;
import java.awt.color.ColorSpace;
import java.awt.image.BufferedImage;
import java.awt.image.ColorModel;
@@ -41,7 +42,6 @@
import java.awt.image.DataBufferByte;
import java.awt.image.Raster;
import java.awt.image.WritableRaster;
-import java.io.BufferedInputStream;
import java.io.IOException;
import java.net.URL;
import java.nio.ByteBuffer;
@@ -50,7 +50,7 @@
import java.util.HashMap;
import java.util.Hashtable;
-import javax.imageio.ImageIO;
+import javax.swing.ImageIcon;
import org.lwjgl.BufferUtils;
@@ -277,7 +277,14 @@
throw new IOException("Cannot find: " + ref);
}
- BufferedImage bufferedImage = ImageIO.read(new BufferedInputStream(getClass().getClassLoader().getResourceAsStream(ref)));
+ // due to an issue with ImageIO and mixed signed code
+ // we are now using good oldfashioned ImageIcon to load
+ // images and the paint it on top of a new BufferedImage
+ Image img = new ImageIcon(url).getImage();
+ BufferedImage bufferedImage = new BufferedImage(img.getWidth(null), img.getHeight(null), BufferedImage.TYPE_INT_RGB);
+ Graphics g = bufferedImage.getGraphics();
+ g.drawImage(img, 0, 0, null);
+ g.dispose();
return bufferedImage;
}
Modified: trunk/LWJGL/src/java/org/lwjgl/util/WaveData.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/WaveData.java 2010-10-12 09:32:34 UTC (rev 3437)
+++ trunk/LWJGL/src/java/org/lwjgl/util/WaveData.java 2010-10-12 15:34:26 UTC (rev 3438)
@@ -46,6 +46,8 @@
import org.lwjgl.openal.AL10;
+import com.sun.media.sound.WaveFileReader;
+
/**
*
* Utitlity class for loading wavefiles.
@@ -92,9 +94,11 @@
*/
public static WaveData create(URL path) {
try {
- return create(
- AudioSystem.getAudioInputStream(
- new BufferedInputStream(path.openStream())));
+ // due to an issue with AudioSystem.getAudioInputStream
+ // and mixing unsigned and signed code
+ // we will use the reader directly
+ WaveFileReader wfr = new WaveFileReader();
+ return create(wfr.getAudioInputStream(new BufferedInputStream(path.openStream())));
} catch (Exception e) {
org.lwjgl.LWJGLUtil.log("Unable to create from: " + path + ", " + e.getMessage());
return null;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2010-10-12 09:32:41
|
Revision: 3437
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3437&view=rev
Author: spasi
Date: 2010-10-12 09:32:34 +0000 (Tue, 12 Oct 2010)
Log Message:
-----------
Calling convention is ignored on x64.
Modified Paths:
--------------
trunk/LWJGL/src/native/common/extcl.h
Modified: trunk/LWJGL/src/native/common/extcl.h
===================================================================
--- trunk/LWJGL/src/native/common/extcl.h 2010-10-12 01:35:33 UTC (rev 3436)
+++ trunk/LWJGL/src/native/common/extcl.h 2010-10-12 09:32:34 UTC (rev 3437)
@@ -60,7 +60,7 @@
#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) || defined(_WIN64)
+#if defined(_WIN32)
#define CL_USER_FUNC_CALLBACK __cdecl
#else
#define CL_USER_FUNC_CALLBACK CL_CALLBACK
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2010-10-12 01:35:40
|
Revision: 3436
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3436&view=rev
Author: spasi
Date: 2010-10-12 01:35:33 +0000 (Tue, 12 Oct 2010)
Log Message:
-----------
Replaced HashMap<Long, T> with FastLongMap in the OpenCL package.
Replaced CharsetEncoder with simple ASCII encoding in APIUtil.
Attempt to fix CL native kernels on x64.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/opencl/APIUtil.java
trunk/LWJGL/src/java/org/lwjgl/opencl/CLContext.java
trunk/LWJGL/src/java/org/lwjgl/opencl/CLObjectRegistry.java
trunk/LWJGL/src/java/org/lwjgl/opencl/CLObjectRegistryGlobal.java
trunk/LWJGL/src/java/org/lwjgl/opencl/CLPlatform.java
trunk/LWJGL/src/java/org/lwjgl/opengl/APIUtil.java
trunk/LWJGL/src/native/common/org_lwjgl_opencl_CallbackUtil.c
trunk/LWJGL/src/templates/org/lwjgl/opencl/CL10.java
Added Paths:
-----------
trunk/LWJGL/src/java/org/lwjgl/opencl/FastLongMap.java
Modified: trunk/LWJGL/src/java/org/lwjgl/opencl/APIUtil.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opencl/APIUtil.java 2010-10-08 20:57:23 UTC (rev 3435)
+++ trunk/LWJGL/src/java/org/lwjgl/opencl/APIUtil.java 2010-10-12 01:35:33 UTC (rev 3436)
@@ -34,10 +34,9 @@
import org.lwjgl.BufferUtils;
import org.lwjgl.LWJGLUtil;
import org.lwjgl.PointerBuffer;
+import org.lwjgl.opencl.FastLongMap.Entry;
import java.nio.*;
-import java.nio.charset.Charset;
-import java.nio.charset.CharsetEncoder;
import java.util.HashSet;
import java.util.Set;
import java.util.StringTokenizer;
@@ -75,16 +74,10 @@
protected PointerBuffer initialValue() { return BufferUtils.createPointerBuffer(INITIAL_LENGTHS_SIZE); }
};
- private static final ThreadLocal<InfiniteCharSequence> infiniteSeqTL = new ThreadLocal<InfiniteCharSequence>() {
- protected InfiniteCharSequence initialValue() { return new InfiniteCharSequence(); }
- };
-
private static final ThreadLocal<Buffers> buffersTL = new ThreadLocal<Buffers>() {
protected Buffers initialValue() { return new Buffers(); }
};
- private static final CharsetEncoder encoder = Charset.forName("US-ASCII").newEncoder();
-
private APIUtil() {
}
@@ -188,15 +181,22 @@
return lengths;
}
- private static InfiniteCharSequence getInfiniteSeq() {
- return infiniteSeqTL.get();
- }
+ /**
+ * Simple ASCII encoding.
+ *
+ * @param buffer The target buffer
+ * @param string The source string
+ */
+ private static ByteBuffer encode(final ByteBuffer buffer, final CharSequence string) {
+ for ( int i = 0; i < string.length(); i++ ) {
+ final char c = string.charAt(i);
+ if ( LWJGLUtil.DEBUG && 0x80 <= c ) // Silently ignore and map to 0x1A.
+ buffer.put((byte)0x1A);
+ else
+ buffer.put((byte)c);
+ }
- private static void encode(final ByteBuffer buffer, final CharSequence string) {
- final InfiniteCharSequence infiniteSeq = getInfiniteSeq();
- infiniteSeq.setString(string);
- encoder.encode(infiniteSeq.buffer, buffer, true);
- infiniteSeq.clear();
+ return buffer;
}
/**
@@ -224,10 +224,7 @@
* @return the String as a ByteBuffer
*/
static ByteBuffer getBuffer(final CharSequence string) {
- final ByteBuffer buffer = getBufferByte(string.length());
-
- encode(buffer, string);
-
+ final ByteBuffer buffer = encode(getBufferByte(string.length()), string);
buffer.flip();
return buffer;
}
@@ -240,10 +237,7 @@
* @return the String as a ByteBuffer
*/
static ByteBuffer getBuffer(final CharSequence string, final int offset) {
- final ByteBuffer buffer = getBufferByteOffset(offset + string.length());
-
- encode(buffer, string);
-
+ final ByteBuffer buffer = encode(getBufferByteOffset(offset + string.length()), string);
buffer.flip();
return buffer;
}
@@ -256,10 +250,7 @@
* @return the String as a ByteBuffer
*/
static ByteBuffer getBufferNT(final CharSequence string) {
- final ByteBuffer buffer = getBufferByte(string.length() + 1);
-
- encode(buffer, string);
-
+ final ByteBuffer buffer = encode(getBufferByte(string.length() + 1), string);
buffer.put((byte)0);
buffer.flip();
return buffer;
@@ -283,12 +274,8 @@
static ByteBuffer getBuffer(final CharSequence[] strings) {
final ByteBuffer buffer = getBufferByte(getTotalLength(strings));
- final InfiniteCharSequence infiniteSeq = getInfiniteSeq();
- for ( CharSequence string : strings ) {
- infiniteSeq.setString(string);
- encoder.encode(infiniteSeq.buffer, buffer, true);
- }
- infiniteSeq.clear();
+ for ( CharSequence string : strings )
+ encode(buffer, string);
buffer.flip();
return buffer;
@@ -304,13 +291,10 @@
static ByteBuffer getBufferNT(final CharSequence[] strings) {
final ByteBuffer buffer = getBufferByte(getTotalLength(strings) + strings.length);
- final InfiniteCharSequence infiniteSeq = getInfiniteSeq();
for ( CharSequence string : strings ) {
- infiniteSeq.setString(string);
- encoder.encode(infiniteSeq.buffer, buffer, true);
+ encode(buffer, string);
buffer.put((byte)0);
}
- infiniteSeq.clear();
buffer.flip();
return buffer;
@@ -358,43 +342,6 @@
return (int)size;
}
- /**
- * A mutable CharSequence with very large initial length. We can wrap this in a re-usable CharBuffer for decoding.
- * We cannot subclass CharBuffer because of {@link java.nio.CharBuffer#toString(int,int)}.
- */
- private static class InfiniteCharSequence implements CharSequence {
-
- final CharBuffer buffer;
-
- CharSequence string;
-
- InfiniteCharSequence() {
- buffer = CharBuffer.wrap(this);
- }
-
- void setString(final CharSequence string) {
- this.string = string;
- this.buffer.position(0);
- this.buffer.limit(string.length());
- }
-
- void clear() {
- this.string = null;
- }
-
- public int length() {
- return Integer.MAX_VALUE;
- }
-
- public char charAt(final int index) {
- return string.charAt(index);
- }
-
- public CharSequence subSequence(final int start, final int end) {
- return string.subSequence(start, end);
- }
- }
-
private static class Buffers {
final ShortBuffer shorts;
@@ -559,7 +506,8 @@
if ( registry.isEmpty() )
return;
- for ( final T object : registry.getAll() ) {
+ for ( Entry<T> entry : registry.getAll() ) {
+ final T object = entry.value;
while ( object.isValid() )
destructor.release(object);
}
Modified: trunk/LWJGL/src/java/org/lwjgl/opencl/CLContext.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opencl/CLContext.java 2010-10-08 20:57:23 UTC (rev 3435)
+++ trunk/LWJGL/src/java/org/lwjgl/opencl/CLContext.java 2010-10-12 01:35:33 UTC (rev 3436)
@@ -37,9 +37,7 @@
import org.lwjgl.opengl.Drawable;
import java.nio.IntBuffer;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
/**
* This class is a wrapper around a cl_context pointer.
@@ -57,10 +55,10 @@
private final CLObjectRegistry<CLEvent> clEvents;
/** Global registry for build callbacks. */
- static final Map<Long, CLProgram> clProgramsGlobal = new HashMap<Long, CLProgram>();
+ static final FastLongMap<CLProgram> clProgramsGlobal = new FastLongMap<CLProgram>();
/** Global registry for event callbacks. */
- static final Map<Long, CLEvent> clEventsGlobal = new HashMap<Long, CLEvent>();
+ static final FastLongMap<CLEvent> clEventsGlobal = new FastLongMap<CLEvent>();
CLContext(final long pointer, final CLPlatform platform) {
super(pointer, platform);
Modified: trunk/LWJGL/src/java/org/lwjgl/opencl/CLObjectRegistry.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opencl/CLObjectRegistry.java 2010-10-08 20:57:23 UTC (rev 3435)
+++ trunk/LWJGL/src/java/org/lwjgl/opencl/CLObjectRegistry.java 2010-10-12 01:35:33 UTC (rev 3436)
@@ -2,11 +2,6 @@
import org.lwjgl.LWJGLUtil;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
/**
* A CLObjectChild container.
*
@@ -14,7 +9,7 @@
*/
class CLObjectRegistry<T extends CLObjectChild> {
- private Map<Long, T> registry;
+ private FastLongMap<T> registry;
CLObjectRegistry() {
}
@@ -31,12 +26,12 @@
return registry != null && registry.containsKey(id);
}
- final List<T> getAll() {
- return registry == null ? null : new ArrayList<T>(registry.values());
+ final Iterable<FastLongMap.Entry<T>> getAll() {
+ return registry;
}
void registerObject(final T object) {
- final Map<Long, T> map = getMap();
+ final FastLongMap<T> map = getMap();
final Long key = object.getPointer();
if ( LWJGLUtil.DEBUG && map.containsKey(key) )
@@ -49,9 +44,9 @@
getMap().remove(object.getPointerUnsafe());
}
- private Map<Long, T> getMap() {
+ private FastLongMap<T> getMap() {
if ( registry == null )
- registry = new HashMap<Long, T>();
+ registry = new FastLongMap<T>();
return registry;
}
Modified: trunk/LWJGL/src/java/org/lwjgl/opencl/CLObjectRegistryGlobal.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opencl/CLObjectRegistryGlobal.java 2010-10-08 20:57:23 UTC (rev 3435)
+++ trunk/LWJGL/src/java/org/lwjgl/opencl/CLObjectRegistryGlobal.java 2010-10-12 01:35:33 UTC (rev 3436)
@@ -31,8 +31,6 @@
*/
package org.lwjgl.opencl;
-import java.util.Map;
-
/**
* A CLObject registry that also registers/unregisters objects to/from a global registry.
*
@@ -40,9 +38,9 @@
*/
final class CLObjectRegistryGlobal<T extends CLObjectChild> extends CLObjectRegistry<T> {
- private final Map<Long, T> globalRegistry;
+ private final FastLongMap<T> globalRegistry;
- CLObjectRegistryGlobal(final Map<Long, T> globalRegistry) {
+ CLObjectRegistryGlobal(final FastLongMap<T> globalRegistry) {
this.globalRegistry = globalRegistry;
}
Modified: trunk/LWJGL/src/java/org/lwjgl/opencl/CLPlatform.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opencl/CLPlatform.java 2010-10-08 20:57:23 UTC (rev 3435)
+++ trunk/LWJGL/src/java/org/lwjgl/opencl/CLPlatform.java 2010-10-12 01:35:33 UTC (rev 3436)
@@ -36,9 +36,7 @@
import java.nio.ByteBuffer;
import java.nio.IntBuffer;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
import static java.lang.Math.*;
@@ -51,12 +49,12 @@
private static final CLPlatformUtil util = (CLPlatformUtil)getInfoUtilInstance(CLPlatform.class, "CL_PLATFORM_UTIL");
- private static final Map<Long, CLPlatform> clPlatforms = new HashMap<Long, CLPlatform>();
+ private static final FastLongMap<CLPlatform> clPlatforms = new FastLongMap<CLPlatform>();
private final CLObjectRegistry<CLDevice> clDevices;
/** Global registry for build callbacks. */
- static final Map<Long, CLDevice> clDevicesGlobal = new HashMap<Long, CLDevice>();
+ static final FastLongMap<CLDevice> clDevicesGlobal = new FastLongMap<CLDevice>();
private Object caps;
Added: trunk/LWJGL/src/java/org/lwjgl/opencl/FastLongMap.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opencl/FastLongMap.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/opencl/FastLongMap.java 2010-10-12 01:35:33 UTC (rev 3436)
@@ -0,0 +1,239 @@
+/*
+ * Copyright 2002-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS"
+ * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language
+ * governing permissions and limitations under the License.
+ */
+package org.lwjgl.opencl;
+
+import java.util.Iterator;
+
+/**
+ * A hash map using primitive longs as keys rather than objects.
+ *
+ * @author Justin Couch
+ * @author Alex Chaffee (al...@ap...)
+ * @author Stephen Colebourne
+ * @author Nathan Sweet
+ */
+final class FastLongMap<V> implements Iterable<FastLongMap.Entry<V>> {
+
+ private Entry[] table;
+ private int size, mask, capacity, threshold;
+
+ /** Same as: FastLongMap(16, 0.75f); */
+ FastLongMap() {
+ this(16, 0.75f);
+ }
+
+ /** Same as: FastLongMap(initialCapacity, 0.75f); */
+ FastLongMap(int initialCapacity) {
+ this(initialCapacity, 0.75f);
+ }
+
+ FastLongMap(int initialCapacity, float loadFactor) {
+ if ( initialCapacity > 1 << 30 ) throw new IllegalArgumentException("initialCapacity is too large.");
+ if ( initialCapacity < 0 ) throw new IllegalArgumentException("initialCapacity must be greater than zero.");
+ if ( loadFactor <= 0 ) throw new IllegalArgumentException("initialCapacity must be greater than zero.");
+ capacity = 1;
+ while ( capacity < initialCapacity )
+ capacity <<= 1;
+ this.threshold = (int)(capacity * loadFactor);
+ this.table = new Entry[capacity];
+ this.mask = capacity - 1;
+ }
+
+ private int index(final long key) {
+ return index(key, mask);
+ }
+
+ private static int index(final long key, final int mask) {
+ final int hash = (int)(key ^ (key >>> 32));
+ return hash & mask;
+ }
+
+ public V put(long key, V value) {
+ final Entry<V>[] table = this.table;
+ int index = index(key);
+
+ // Check if key already exists.
+ for ( Entry<V> e = table[index]; e != null; e = e.next ) {
+ if ( e.key != key ) continue;
+ V oldValue = e.value;
+ e.value = value;
+ return oldValue;
+ }
+
+ table[index] = new Entry<V>(key, value, table[index]);
+
+ if ( size++ >= threshold )
+ rehash(table);
+
+ return null;
+ }
+
+ private void rehash(final Entry<V>[] table) {
+ final int newCapacity = 2 * capacity;
+ final int newMask = newCapacity - 1;
+
+ final Entry<V>[] newTable = new Entry[newCapacity];
+
+ for ( int i = 0, index; i < table.length; i++ ) {
+ Entry<V> e = table[i];
+ if ( e == null ) continue;
+ do {
+ final Entry<V> next = e.next;
+ index = index(e.key, newMask);
+ e.next = newTable[index];
+ newTable[index] = e;
+ e = next;
+ } while ( e != null );
+ }
+
+ this.table = newTable;
+ capacity = newCapacity;
+ mask = newMask;
+ threshold *= 2;
+ }
+
+ public V get(long key) {
+ final int index = index(key);
+ for ( Entry<V> e = table[index]; e != null; e = e.next )
+ if ( e.key == key ) return e.value;
+ return null;
+ }
+
+ public boolean containsValue(Object value) {
+ final Entry<V>[] table = this.table;
+ for ( int i = table.length - 1; i >= 0; i-- )
+ for ( Entry<V> e = table[i]; e != null; e = e.next )
+ if ( e.value.equals(value) ) return true;
+ return false;
+ }
+
+ public boolean containsKey(long key) {
+ final int index = index(key);
+ for ( Entry<V> e = table[index]; e != null; e = e.next )
+ if ( e.key == key ) return true;
+ return false;
+ }
+
+ public V remove(long key) {
+ final int index = index(key);
+
+ Entry<V> prev = table[index];
+ Entry<V> e = prev;
+ while ( e != null ) {
+ Entry<V> next = e.next;
+ if ( e.key == key ) {
+ size--;
+ if ( prev == e )
+ table[index] = next;
+ else
+ prev.next = next;
+ return e.value;
+ }
+ prev = e;
+ e = next;
+ }
+ return null;
+ }
+
+ public int size() {
+ return size;
+ }
+
+ public boolean isEmpty() {
+ return size == 0;
+ }
+
+ public void clear() {
+ final Entry<V>[] table = this.table;
+ for ( int index = table.length - 1; index >= 0; index-- )
+ table[index] = null;
+ size = 0;
+ }
+
+ public EntryIterator iterator() {
+ return new EntryIterator();
+ }
+
+ public class EntryIterator implements Iterator<Entry<V>> {
+
+ private int nextIndex;
+ private Entry<V> current;
+
+ EntryIterator() {
+ reset();
+ }
+
+ public void reset() {
+ current = null;
+ // Find first bucket.
+ final Entry<V>[] table = FastLongMap.this.table;
+ int i;
+ for ( i = table.length - 1; i >= 0; i-- )
+ if ( table[i] != null ) break;
+ nextIndex = i;
+ }
+
+ public boolean hasNext() {
+ if ( nextIndex >= 0 ) return true;
+ Entry e = current;
+ return e != null && e.next != null;
+ }
+
+ public Entry<V> next() {
+ // Next entry in current bucket.
+ Entry<V> e = current;
+ if ( e != null ) {
+ e = e.next;
+ if ( e != null ) {
+ current = e;
+ return e;
+ }
+ }
+ // Use the bucket at nextIndex and find the next nextIndex.
+ final Entry<V>[] table = FastLongMap.this.table;
+ int i = nextIndex;
+ e = current = table[i];
+ while ( --i >= 0 )
+ if ( table[i] != null ) break;
+ nextIndex = i;
+ return e;
+ }
+
+ public void remove() {
+ FastLongMap.this.remove(current.key);
+ }
+ }
+
+ static final class Entry<T> {
+
+ final long key;
+ T value;
+ Entry<T> next;
+
+ Entry(long key, T value, Entry<T> next) {
+ this.key = key;
+ this.value = value;
+ this.next = next;
+ }
+
+ public long getKey() {
+ return key;
+ }
+
+ public T getValue() {
+ return value;
+ }
+
+ }
+
+}
\ No newline at end of file
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/APIUtil.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/APIUtil.java 2010-10-08 20:57:23 UTC (rev 3435)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/APIUtil.java 2010-10-12 01:35:33 UTC (rev 3436)
@@ -32,10 +32,9 @@
package org.lwjgl.opengl;
import org.lwjgl.BufferUtils;
+import org.lwjgl.LWJGLUtil;
import java.nio.*;
-import java.nio.charset.Charset;
-import java.nio.charset.CharsetEncoder;
/** @author spasi */
final class APIUtil {
@@ -57,16 +56,10 @@
protected IntBuffer initialValue() { return BufferUtils.createIntBuffer(INITIAL_LENGTHS_SIZE); }
};
- private static final ThreadLocal<InfiniteCharSequence> infiniteSeqTL = new ThreadLocal<InfiniteCharSequence>() {
- protected InfiniteCharSequence initialValue() { return new InfiniteCharSequence(); }
- };
-
private static final ThreadLocal<Buffers> buffersTL = new ThreadLocal<Buffers>() {
protected Buffers initialValue() { return new Buffers(); }
};
- private static CharsetEncoder encoder = Charset.forName("US-ASCII").newEncoder();
-
private APIUtil() {
}
@@ -150,15 +143,22 @@
return lengths;
}
- private static InfiniteCharSequence getInfiniteSeq() {
- return infiniteSeqTL.get();
- }
+ /**
+ * Simple ASCII encoding.
+ *
+ * @param buffer The target buffer
+ * @param string The source string
+ */
+ private static ByteBuffer encode(final ByteBuffer buffer, final CharSequence string) {
+ for ( int i = 0; i < string.length(); i++ ) {
+ final char c = string.charAt(i);
+ if ( LWJGLUtil.DEBUG && 0x80 <= c ) // Silently ignore and map to 0x1A.
+ buffer.put((byte)0x1A);
+ else
+ buffer.put((byte)c);
+ }
- private static void encode(final ByteBuffer buffer, final CharSequence string) {
- final InfiniteCharSequence infiniteSeq = getInfiniteSeq();
- infiniteSeq.setString(string);
- encoder.encode(infiniteSeq.buffer, buffer, true);
- infiniteSeq.clear();
+ return buffer;
}
/**
@@ -186,10 +186,7 @@
* @return the String as a ByteBuffer
*/
static ByteBuffer getBuffer(final CharSequence string) {
- final ByteBuffer buffer = getBufferByte(string.length());
-
- encode(buffer, string);
-
+ final ByteBuffer buffer = encode(getBufferByte(string.length()), string);
buffer.flip();
return buffer;
}
@@ -202,10 +199,7 @@
* @return the String as a ByteBuffer
*/
static ByteBuffer getBuffer(final CharSequence string, final int offset) {
- final ByteBuffer buffer = getBufferByteOffset(offset + string.length());
-
- encode(buffer, string);
-
+ final ByteBuffer buffer = encode(getBufferByteOffset(offset + string.length()), string);
buffer.flip();
return buffer;
}
@@ -218,10 +212,7 @@
* @return the String as a ByteBuffer
*/
static ByteBuffer getBufferNT(final CharSequence string) {
- final ByteBuffer buffer = getBufferByte(string.length() + 1);
-
- encode(buffer, string);
-
+ final ByteBuffer buffer = encode(getBufferByte(string.length() + 1), string);
buffer.put((byte)0);
buffer.flip();
return buffer;
@@ -245,12 +236,8 @@
static ByteBuffer getBuffer(final CharSequence[] strings) {
final ByteBuffer buffer = getBufferByte(getTotalLength(strings));
- final InfiniteCharSequence infiniteSeq = getInfiniteSeq();
- for ( CharSequence string : strings ) {
- infiniteSeq.setString(string);
- encoder.encode(infiniteSeq.buffer, buffer, true);
- }
- infiniteSeq.clear();
+ for ( CharSequence string : strings )
+ encode(buffer, string);
buffer.flip();
return buffer;
@@ -266,13 +253,10 @@
static ByteBuffer getBufferNT(final CharSequence[] strings) {
final ByteBuffer buffer = getBufferByte(getTotalLength(strings) + strings.length);
- final InfiniteCharSequence infiniteSeq = getInfiniteSeq();
for ( CharSequence string : strings ) {
- infiniteSeq.setString(string);
- encoder.encode(infiniteSeq.buffer, buffer, true);
+ encode(buffer, string);
buffer.put((byte)0);
}
- infiniteSeq.clear();
buffer.flip();
return buffer;
@@ -295,43 +279,6 @@
return buffer;
}
- /**
- * A mutable CharSequence with very large initial length. We can wrap this in a re-usable CharBuffer for decoding.
- * We cannot subclass CharBuffer because of {@link CharBuffer#toString(int,int)}.
- */
- private static class InfiniteCharSequence implements CharSequence {
-
- final CharBuffer buffer;
-
- CharSequence string;
-
- InfiniteCharSequence() {
- buffer = CharBuffer.wrap(this);
- }
-
- void setString(final CharSequence string) {
- this.string = string;
- this.buffer.position(0);
- this.buffer.limit(string.length());
- }
-
- void clear() {
- this.string = null;
- }
-
- public int length() {
- return Integer.MAX_VALUE;
- }
-
- public char charAt(final int index) {
- return string.charAt(index);
- }
-
- public CharSequence subSequence(final int start, final int end) {
- return string.subSequence(start, end);
- }
- }
-
private static class Buffers {
final ShortBuffer shorts;
Modified: trunk/LWJGL/src/native/common/org_lwjgl_opencl_CallbackUtil.c
===================================================================
--- trunk/LWJGL/src/native/common/org_lwjgl_opencl_CallbackUtil.c 2010-10-08 20:57:23 UTC (rev 3435)
+++ trunk/LWJGL/src/native/common/org_lwjgl_opencl_CallbackUtil.c 2010-10-12 01:35:33 UTC (rev 3436)
@@ -156,9 +156,9 @@
for ( i = 0; i < num_mem_objects; i++ ) {
buffer = (*env)->NewDirectByteBuffer(env,
// Pointer to cl_mem buffer
- (void *)((char *)args + (12 + 4 + (i * (4 + sizeof(size_t))))),
+ (void *)((char *)args + (12 + 4 + (i * (4 + sizeof(void *))))),
// cl_mem buffer size
- *((jint *)((char *)args + (12 + (i * (4 + sizeof(size_t))))))
+ *((jint *)((char *)args + (12 + (i * (4 + sizeof(void *))))))
);
(*env)->SetObjectArrayElement(env, memobjs, i, buffer);
}
Modified: trunk/LWJGL/src/templates/org/lwjgl/opencl/CL10.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opencl/CL10.java 2010-10-08 20:57:23 UTC (rev 3435)
+++ trunk/LWJGL/src/templates/org/lwjgl/opencl/CL10.java 2010-10-12 01:35:33 UTC (rev 3436)
@@ -1061,7 +1061,7 @@
nativeAfterVars = "\tvoid **args_mem_loc = num_mem_objects == 0 ? NULL : (void **)malloc(num_mem_objects * sizeof(void *));",
nativeBeforeCall = "\t_ptr_i = 0;\n" +
"\twhile ( _ptr_i < num_mem_objects ) {\n" +
- "\t\targs_mem_loc[_ptr_i] = (cl_void *)((char *)args_address + (4 + _ptr_i * (4 + sizeof(size_t))));\n" +
+ "\t\targs_mem_loc[_ptr_i] = (cl_void *)((char *)args_address + (4 + _ptr_i * (4 + sizeof(void *))));\n" +
"\t\t_ptr_i++;\n" +
"\t}",
nativeAfterCall = "\tfree(args_mem_loc);"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2010-10-08 20:57:30
|
Revision: 3435
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3435&view=rev
Author: kappa1
Date: 2010-10-08 20:57:23 +0000 (Fri, 08 Oct 2010)
Log Message:
-----------
AppletLoader: use the tmp directory on Windows to store cache.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java
Modified: trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java 2010-10-08 20:19:44 UTC (rev 3434)
+++ trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java 2010-10-08 20:57:23 UTC (rev 3435)
@@ -784,7 +784,7 @@
protected String getCacheDir() {
String cacheDir = System.getProperty("deployment.user.cachedir");
- if (cacheDir == null) {
+ if (cacheDir == null || System.getProperty("os.name").startsWith("Win")) {
cacheDir = System.getProperty("java.io.tmpdir");
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2010-10-08 20:19:50
|
Revision: 3434
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3434&view=rev
Author: kappa1
Date: 2010-10-08 20:19:44 +0000 (Fri, 08 Oct 2010)
Log Message:
-----------
fix for focus issues with Display.setParent on linux when using it as a non applet. Thx to MatthiasM for finding this and providing a small test case.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java 2010-10-07 20:38:50 UTC (rev 3433)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java 2010-10-08 20:19:44 UTC (rev 3434)
@@ -894,9 +894,11 @@
if (focused) {
acquireInput();
+ if (!xembedded) parent.setFocusable(false);
}
else {
releaseInput();
+ if (!xembedded) parent.setFocusable(true);
}
}
static native long nGetInputFocus(long display);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2010-10-07 20:38:56
|
Revision: 3433
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3433&view=rev
Author: kappa1
Date: 2010-10-07 20:38:50 +0000 (Thu, 07 Oct 2010)
Log Message:
-----------
catch null pointer exception that can be thrown on mac, app shouldn't explode now.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/opengl/AWTUtil.java
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/AWTUtil.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/AWTUtil.java 2010-10-07 20:33:01 UTC (rev 3432)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/AWTUtil.java 2010-10-07 20:38:50 UTC (rev 3433)
@@ -122,7 +122,7 @@
}
return null;
}
- } catch (PrivilegedActionException e) {
+ } catch (Exception e) {
LWJGLUtil.log("Failed to query pointer location: " + e.getCause());
}
return null;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2010-10-07 20:33:07
|
Revision: 3432
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3432&view=rev
Author: kappa1
Date: 2010-10-07 20:33:01 +0000 (Thu, 07 Oct 2010)
Log Message:
-----------
AppletLoader: move cache directory to a better location, as the current location is periodically purged on mac and linux.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java
Modified: trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java 2010-10-04 22:51:19 UTC (rev 3431)
+++ trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java 2010-10-07 20:33:01 UTC (rev 3432)
@@ -259,7 +259,7 @@
*/
public void init() {
state = STATE_INIT;
-
+
// sanity check
String[] requiredArgs = {"al_main", "al_logo", "al_progressbar", "al_jars"};
for ( String requiredArg : requiredArgs ) {
@@ -693,7 +693,7 @@
}
codebase += File.separator;
}
- return System.getProperty("java.io.tmpdir") + File.separator + codebase + getParameter("al_title") + File.separator;
+ return getCacheDir() + File.separator + codebase + getParameter("al_title") + File.separator;
}
});
@@ -775,6 +775,21 @@
loaderThread = null;
}
}
+
+ /**
+ * get path to the lwjgl cache directory
+ *
+ * @return path to the lwjgl cache directory
+ */
+ protected String getCacheDir() {
+ String cacheDir = System.getProperty("deployment.user.cachedir");
+
+ if (cacheDir == null) {
+ cacheDir = System.getProperty("java.io.tmpdir");
+ }
+
+ return cacheDir + File.separator + "lwjglcache";
+ }
/**
* read the current version file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2010-10-04 22:51:26
|
Revision: 3431
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3431&view=rev
Author: spasi
Date: 2010-10-04 22:51:19 +0000 (Mon, 04 Oct 2010)
Log Message:
-----------
Fixed 64bit loading.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/Sys.java
Removed Paths:
-------------
trunk/LWJGL/src/native/common/org_lwjgl_opencl_CL.h
trunk/LWJGL/src/native/common/org_lwjgl_opencl_CallbackUtil.h
trunk/LWJGL/src/native/common/org_lwjgl_opengl_CallbackUtil.h
Modified: trunk/LWJGL/src/java/org/lwjgl/Sys.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/Sys.java 2010-10-04 17:04:46 UTC (rev 3430)
+++ trunk/LWJGL/src/java/org/lwjgl/Sys.java 2010-10-04 22:51:19 UTC (rev 3431)
@@ -84,6 +84,7 @@
if (implementation.has64Bit()) {
try {
doLoadLibrary(lib_name + POSTFIX64BIT);
+ return;
} catch (UnsatisfiedLinkError e2) {
LWJGLUtil.log("Failed to load 64 bit library: " + e2.getMessage());
}
Deleted: trunk/LWJGL/src/native/common/org_lwjgl_opencl_CL.h
===================================================================
--- trunk/LWJGL/src/native/common/org_lwjgl_opencl_CL.h 2010-10-04 17:04:46 UTC (rev 3430)
+++ trunk/LWJGL/src/native/common/org_lwjgl_opencl_CL.h 2010-10-04 22:51:19 UTC (rev 3431)
@@ -1,62 +0,0 @@
-/* DO NOT EDIT THIS FILE - it is machine generated */
-#include <jni.h>
-/* Header for class org_lwjgl_opencl_CL */
-
-#ifndef _Included_org_lwjgl_opencl_CL
-#define _Included_org_lwjgl_opencl_CL
-#ifdef __cplusplus
-extern "C" {
-#endif
-/* Inaccessible static: created */
-/*
- * Class: org_lwjgl_opencl_CL
- * Method: nCreate
- * Signature: (Ljava/lang/String;)V
- */
-JNIEXPORT void JNICALL Java_org_lwjgl_opencl_CL_nCreate
- (JNIEnv *, jclass, jstring);
-
-/*
- * Class: org_lwjgl_opencl_CL
- * Method: nCreateDefault
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_org_lwjgl_opencl_CL_nCreateDefault
- (JNIEnv *, jclass);
-
-/*
- * Class: org_lwjgl_opencl_CL
- * Method: nDestroy
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_org_lwjgl_opencl_CL_nDestroy
- (JNIEnv *, jclass);
-
-/*
- * Class: org_lwjgl_opencl_CL
- * Method: getFunctionAddress
- * Signature: (Ljava/lang/String;)J
- */
-JNIEXPORT jlong JNICALL Java_org_lwjgl_opencl_CL_getFunctionAddress
- (JNIEnv *, jclass, jstring);
-
-/*
- * Class: org_lwjgl_opencl_CL
- * Method: getHostBuffer
- * Signature: (JI)Ljava/nio/ByteBuffer;
- */
-JNIEXPORT jobject JNICALL Java_org_lwjgl_opencl_CL_getHostBuffer
- (JNIEnv *, jclass, jlong, jint);
-
-/*
- * Class: org_lwjgl_opencl_CL
- * Method: resetNativeStubs
- * Signature: (Ljava/lang/Class;)V
- */
-JNIEXPORT void JNICALL Java_org_lwjgl_opencl_CL_resetNativeStubs
- (JNIEnv *, jclass, jclass);
-
-#ifdef __cplusplus
-}
-#endif
-#endif
Deleted: trunk/LWJGL/src/native/common/org_lwjgl_opencl_CallbackUtil.h
===================================================================
--- trunk/LWJGL/src/native/common/org_lwjgl_opencl_CallbackUtil.h 2010-10-04 17:04:46 UTC (rev 3430)
+++ trunk/LWJGL/src/native/common/org_lwjgl_opencl_CallbackUtil.h 2010-10-04 22:51:19 UTC (rev 3431)
@@ -1,94 +0,0 @@
-/* DO NOT EDIT THIS FILE - it is machine generated */
-#include <jni.h>
-/* Header for class org_lwjgl_opencl_CallbackUtil */
-
-#ifndef _Included_org_lwjgl_opencl_CallbackUtil
-#define _Included_org_lwjgl_opencl_CallbackUtil
-#ifdef __cplusplus
-extern "C" {
-#endif
-/* Inaccessible static: contextUserData */
-/*
- * Class: org_lwjgl_opencl_CallbackUtil
- * Method: ncreateGlobalRef
- * Signature: (Ljava/lang/Object;)J
- */
-JNIEXPORT jlong JNICALL Java_org_lwjgl_opencl_CallbackUtil_ncreateGlobalRef
- (JNIEnv *, jclass, jobject);
-
-/*
- * Class: org_lwjgl_opencl_CallbackUtil
- * Method: deleteGlobalRef
- * Signature: (J)V
- */
-JNIEXPORT void JNICALL Java_org_lwjgl_opencl_CallbackUtil_deleteGlobalRef
- (JNIEnv *, jclass, jlong);
-
-/*
- * Class: org_lwjgl_opencl_CallbackUtil
- * Method: getContextCallback
- * Signature: ()J
- */
-JNIEXPORT jlong JNICALL Java_org_lwjgl_opencl_CallbackUtil_getContextCallback
- (JNIEnv *, jclass);
-
-/*
- * Class: org_lwjgl_opencl_CallbackUtil
- * Method: getMemObjectDestructorCallback
- * Signature: ()J
- */
-JNIEXPORT jlong JNICALL Java_org_lwjgl_opencl_CallbackUtil_getMemObjectDestructorCallback
- (JNIEnv *, jclass);
-
-/*
- * Class: org_lwjgl_opencl_CallbackUtil
- * Method: getBuildProgramCallback
- * Signature: ()J
- */
-JNIEXPORT jlong JNICALL Java_org_lwjgl_opencl_CallbackUtil_getBuildProgramCallback
- (JNIEnv *, jclass);
-
-/*
- * Class: org_lwjgl_opencl_CallbackUtil
- * Method: getNativeKernelCallback
- * Signature: ()J
- */
-JNIEXPORT jlong JNICALL Java_org_lwjgl_opencl_CallbackUtil_getNativeKernelCallback
- (JNIEnv *, jclass);
-
-/*
- * Class: org_lwjgl_opencl_CallbackUtil
- * Method: getEventCallback
- * Signature: ()J
- */
-JNIEXPORT jlong JNICALL Java_org_lwjgl_opencl_CallbackUtil_getEventCallback
- (JNIEnv *, jclass);
-
-/*
- * Class: org_lwjgl_opencl_CallbackUtil
- * Method: getLogMessageToSystemLogAPPLE
- * Signature: ()J
- */
-JNIEXPORT jlong JNICALL Java_org_lwjgl_opencl_CallbackUtil_getLogMessageToSystemLogAPPLE
- (JNIEnv *, jclass);
-
-/*
- * Class: org_lwjgl_opencl_CallbackUtil
- * Method: getLogMessageToStdoutAPPLE
- * Signature: ()J
- */
-JNIEXPORT jlong JNICALL Java_org_lwjgl_opencl_CallbackUtil_getLogMessageToStdoutAPPLE
- (JNIEnv *, jclass);
-
-/*
- * Class: org_lwjgl_opencl_CallbackUtil
- * Method: getLogMessageToStderrAPPLE
- * Signature: ()J
- */
-JNIEXPORT jlong JNICALL Java_org_lwjgl_opencl_CallbackUtil_getLogMessageToStderrAPPLE
- (JNIEnv *, jclass);
-
-#ifdef __cplusplus
-}
-#endif
-#endif
Deleted: trunk/LWJGL/src/native/common/org_lwjgl_opengl_CallbackUtil.h
===================================================================
--- trunk/LWJGL/src/native/common/org_lwjgl_opengl_CallbackUtil.h 2010-10-04 17:04:46 UTC (rev 3430)
+++ trunk/LWJGL/src/native/common/org_lwjgl_opengl_CallbackUtil.h 2010-10-04 22:51:19 UTC (rev 3431)
@@ -1,47 +0,0 @@
-/* DO NOT EDIT THIS FILE - it is machine generated */
-#include <jni.h>
-/* Header for class org_lwjgl_opengl_CallbackUtil */
-
-#ifndef _Included_org_lwjgl_opengl_CallbackUtil
-#define _Included_org_lwjgl_opengl_CallbackUtil
-#ifdef __cplusplus
-extern "C" {
-#endif
-/* Inaccessible static: contextUserParamsARB */
-/* Inaccessible static: contextUserParamsAMD */
-/*
- * Class: org_lwjgl_opengl_CallbackUtil
- * Method: ncreateGlobalRef
- * Signature: (Ljava/lang/Object;)J
- */
-JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_CallbackUtil_ncreateGlobalRef
- (JNIEnv *, jclass, jobject);
-
-/*
- * Class: org_lwjgl_opengl_CallbackUtil
- * Method: deleteGlobalRef
- * Signature: (J)V
- */
-JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CallbackUtil_deleteGlobalRef
- (JNIEnv *, jclass, jlong);
-
-/*
- * Class: org_lwjgl_opengl_CallbackUtil
- * Method: getDebugOutputCallbackARB
- * Signature: ()J
- */
-JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_CallbackUtil_getDebugOutputCallbackARB
- (JNIEnv *, jclass);
-
-/*
- * Class: org_lwjgl_opengl_CallbackUtil
- * Method: getDebugOutputCallbackAMD
- * Signature: ()J
- */
-JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_CallbackUtil_getDebugOutputCallbackAMD
- (JNIEnv *, jclass);
-
-#ifdef __cplusplus
-}
-#endif
-#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2010-10-04 17:04:53
|
Revision: 3430
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3430&view=rev
Author: spasi
Date: 2010-10-04 17:04:46 +0000 (Mon, 04 Oct 2010)
Log Message:
-----------
Minor clean-up.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorProcessorFactory.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorVisitor.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaTypeTranslator.java
trunk/LWJGL/src/native/common/org_lwjgl_opencl_CallbackUtil.c
Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorProcessorFactory.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorProcessorFactory.java 2010-10-02 13:07:46 UTC (rev 3429)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorProcessorFactory.java 2010-10-04 17:04:46 UTC (rev 3430)
@@ -38,8 +38,6 @@
import java.util.Collection;
import java.util.Map;
import java.util.Set;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
import com.sun.mirror.apt.*;
import com.sun.mirror.declaration.AnnotationTypeDeclaration;
Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorVisitor.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorVisitor.java 2010-10-02 13:07:46 UTC (rev 3429)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorVisitor.java 2010-10-04 17:04:46 UTC (rev 3430)
@@ -110,10 +110,6 @@
NativeType native_type_annotation = NativeTypeTranslator.getAnnotation(annotation, NativeType.class);
if (native_type_annotation != null) {
Class<? extends Annotation> annotation_type = NativeTypeTranslator.getClassFromType(annotation.getAnnotationType());
- /*System.out.println("\nYO:");
- System.out.println("annotation = " + annotation);
- System.out.println("native_type_annotation = " + native_type_annotation);
- System.out.println("annotation_type = " + annotation_type);*/
Class type = Utils.getJavaType(type_mirror);
if (Buffer.class.equals(type))
continue;
@@ -229,10 +225,8 @@
native_writer.println("#include <jni.h>");
type_map.printNativeIncludes(native_writer);
native_writer.println();
- //if ( d.getAnnotation(NoTypeDefs.class) == null ) {
TypedefsGenerator.generateNativeTypedefs(type_map, native_writer, d.getMethods());
native_writer.println();
- //}
if (!context_specific) {
generateMethodsNativePointers(native_writer, d.getMethods());
native_writer.println();
Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java 2010-10-02 13:07:46 UTC (rev 3429)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java 2010-10-04 17:04:46 UTC (rev 3430)
@@ -134,7 +134,7 @@
first_parameter = false;
if ( printTypes )
writer.print("boolean ");
- writer.print( TypeInfo.UNSIGNED_PARAMETER_NAME);
+ writer.print(TypeInfo.UNSIGNED_PARAMETER_NAME);
}
}
} else if (
Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaTypeTranslator.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaTypeTranslator.java 2010-10-02 13:07:46 UTC (rev 3429)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaTypeTranslator.java 2010-10-04 17:04:46 UTC (rev 3430)
@@ -74,27 +74,6 @@
throw new RuntimeException(e);
}
}
-
- /*
- final String className = t.getComponentType().toString();
- if ( "java.lang.CharSequence".equals(className) )
- type = CharSequence[].class;
- else if ( "java.nio.ByteBuffer".equals(className) )
- type = ByteBuffer[].class;
- else if ( "org.lwjgl.opencl.CLMem".equals(className) )
- type = CLMem[].class;
- else
- throw new RuntimeException(t + " is not allowed");
- //*/
- /*
- try {
- System.out.println("t = " + t);
- System.out.println("t.getClass() = " + t.getClass());
- System.out.println("t.getComponentType() = " + t.getComponentType());
- type = Class.forName(t.toString());
- } catch (ClassNotFoundException e) {
- throw new RuntimeException(e);
- }*/
}
public static Class getPrimitiveClassFromKind(PrimitiveType.Kind kind) {
Modified: trunk/LWJGL/src/native/common/org_lwjgl_opencl_CallbackUtil.c
===================================================================
--- trunk/LWJGL/src/native/common/org_lwjgl_opencl_CallbackUtil.c 2010-10-02 13:07:46 UTC (rev 3429)
+++ trunk/LWJGL/src/native/common/org_lwjgl_opencl_CallbackUtil.c 2010-10-04 17:04:46 UTC (rev 3430)
@@ -144,7 +144,7 @@
static void CL_USER_FUNC_CALLBACK nativeKernelCallback(void *args) {
JNIEnv *env = attachCurrentThread();
- jobject user_func = (jobject)*(intptr_t *)args;
+ jobject user_func = (jobject)(intptr_t)*(jlong *)args;
jint num_mem_objects = *(jint *)((char *)args + 8);
jobjectArray memobjs = NULL;
jobject buffer;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2010-10-02 13:07:53
|
Revision: 3429
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3429&view=rev
Author: spasi
Date: 2010-10-02 13:07:46 +0000 (Sat, 02 Oct 2010)
Log Message:
-----------
Added cl_khr_select_fprounding_mode.
Added Paths:
-----------
trunk/LWJGL/src/templates/org/lwjgl/opencl/KHR_select_fprounding_mode.java
Added: trunk/LWJGL/src/templates/org/lwjgl/opencl/KHR_select_fprounding_mode.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opencl/KHR_select_fprounding_mode.java (rev 0)
+++ trunk/LWJGL/src/templates/org/lwjgl/opencl/KHR_select_fprounding_mode.java 2010-10-02 13:07:46 UTC (rev 3429)
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2002-2010 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opencl;
+
+import org.lwjgl.util.generator.opencl.CLDeviceExtension;
+
+@CLDeviceExtension
+public interface KHR_select_fprounding_mode {
+
+}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2010-10-02 12:19:07
|
Revision: 3428
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3428&view=rev
Author: spasi
Date: 2010-10-02 12:19:00 +0000 (Sat, 02 Oct 2010)
Log Message:
-----------
Attempt to fix build issues.
Modified Paths:
--------------
trunk/LWJGL/build.xml
trunk/LWJGL/platform_build/build-generator.xml
Modified: trunk/LWJGL/build.xml
===================================================================
--- trunk/LWJGL/build.xml 2010-10-01 22:37:45 UTC (rev 3427)
+++ trunk/LWJGL/build.xml 2010-10-02 12:19:00 UTC (rev 3428)
@@ -34,23 +34,21 @@
</target>
<!-- Cleans up any files created during the execution of this script -->
- <target name="clean" description="Cleans the directories controlled by this ant script" depends="clean-generated">
- <delete dir="${lwjgl.temp}" quiet="true" failonerror="false" taskname="cleaning temp folder" />
- <delete dir="${lwjgl.docs}/javadoc" quiet="true" failonerror="false" taskname="cleaning javadoc folder" />
+ <target name="clean" description="Cleans all directories controlled by this ant script" depends="clean-java, clean-native"/>
+
+ <!-- Cleans up any non-native files created during the execution of this script -->
+ <target name="clean-java" description="Cleans non-native files generated by this ant script" depends="clean-generated">
+ <delete dir="${lwjgl.temp}" quiet="true" failonerror="false" taskname="cleaning temp folder" />
+ <delete dir="${lwjgl.docs}/javadoc" quiet="true" failonerror="false" taskname="cleaning javadoc folder" />
<!-- Delete java classes only to avoid unnecessary native recompilation -->
- <delete dir="${lwjgl.bin}/org" quiet="true" failonerror="false" taskname="cleaning bin folder" />
- </target>
+ <delete dir="${lwjgl.bin}/org" quiet="true" failonerror="false" taskname="cleaning bin folder" />
+ </target>
<!-- Useful when we need to force native recompilation -->
- <target name="clean-native" description="Cleans bin folder's native directory" depends="clean-generated-native">
+ <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" />
- <mkdir dir="${lwjgl.bin}/lwjgl" taskname="initialiazing native bin folder" />
</target>
- <target name="clean-all" depends="clean, clean-generated-native" description="Cleans all directories controlled by this ant script">
- <delete dir="${lwjgl.bin}/lwjgl" quiet="true" failonerror="false" taskname="cleaning native bin folder" />
- </target>
-
<!-- Creates a distribution of LWJGL -->
<target name="release" description="Creates a distribution of LWJGL using supplied native binaries">
<!-- Warn user -->
@@ -67,7 +65,7 @@
<!-- prepare -->
<delete dir="${lwjgl.dist}" quiet="true" failonerror="false" />
- <antcall target="clean" />
+ <antcall target="clean-java" />
<antcall target="-initialize" />
<!-- compile and create debug jars -->
@@ -335,6 +333,7 @@
<sequential>
<java classname="org.lwjgl.test.NativeTest" logError="false" resultproperty="nativetest.res" outputproperty="nativetest.out" errorproperty="nativetest.err" fork="true">
<jvmarg value="-Djava.library.path=libs/@{platform}"/>
+ <jvmarg value="-Dorg.lwjgl.util.Debug=true"/>
<classpath>
<pathelement path="${lwjgl.bin}"/>
<pathelement path="${java.class.path}"/>
@@ -371,7 +370,7 @@
<javac debug="yes" srcdir="${lwjgl.src}/java/" destdir="${lwjgl.bin}" includes="org/lwjgl/examples/**" source="1.5" target="1.5" taskname="examples" />
</target>
- <target name="compile_native" depends="headers, touch-version, version-mismatch" description="Compiles the native files">
+ <target name="compile_native" depends="-initialize, headers, touch-version, version-mismatch" description="Compiles the native files">
<condition property="lwjgl.platform.windows">
<os family="windows" />
</condition>
Modified: trunk/LWJGL/platform_build/build-generator.xml
===================================================================
--- trunk/LWJGL/platform_build/build-generator.xml 2010-10-01 22:37:45 UTC (rev 3427)
+++ trunk/LWJGL/platform_build/build-generator.xml 2010-10-02 12:19:00 UTC (rev 3428)
@@ -7,8 +7,8 @@
</delete>
</target>
- <target name="clean-generated-native" description="Deletes the generated native source">
- <delete quiet="true" failonerror="false">
+ <target name="clean-generated-native" description="Deletes the generated native source" depends="clean-generated">
+ <delete quiet="false" failonerror="false">
<fileset dir="${lwjgl.src.native}/generated" includes="**"/>
</delete>
</target>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2010-10-01 22:37:51
|
Revision: 3427
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3427&view=rev
Author: spasi
Date: 2010-10-01 22:37:45 +0000 (Fri, 01 Oct 2010)
Log Message:
-----------
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/opencl/CallbackUtil.java
Modified: trunk/LWJGL/src/java/org/lwjgl/opencl/CallbackUtil.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opencl/CallbackUtil.java 2010-10-01 22:20:14 UTC (rev 3426)
+++ trunk/LWJGL/src/java/org/lwjgl/opencl/CallbackUtil.java 2010-10-01 22:37:45 UTC (rev 3427)
@@ -34,8 +34,6 @@
import java.util.HashMap;
import java.util.Map;
-import static org.lwjgl.opencl.CL10.*;
-
/**
* Utility class that handles OpenCL API callbacks.
*
@@ -81,7 +79,7 @@
* @param user_data the GlobalRef memory address
*/
static void checkCallback(final int errcode, final long user_data) {
- if ( errcode != CL_SUCCESS && user_data != 0 )
+ if ( errcode != 0x0 && user_data != 0 )
deleteGlobalRef(user_data);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2010-10-01 22:20:21
|
Revision: 3426
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3426&view=rev
Author: spasi
Date: 2010-10-01 22:20:14 +0000 (Fri, 01 Oct 2010)
Log Message:
-----------
OpenCL bug fixes on MacOS.
Improved 64bit pointer detection.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/DefaultSysImplementation.java
trunk/LWJGL/src/java/org/lwjgl/Sys.java
trunk/LWJGL/src/java/org/lwjgl/SysImplementation.java
trunk/LWJGL/src/java/org/lwjgl/opencl/APIUtil.java
trunk/LWJGL/src/java/org/lwjgl/opencl/CallbackUtil.java
trunk/LWJGL/src/java/org/lwjgl/test/opencl/HelloOpenCL.java
trunk/LWJGL/src/native/common/common_tools.c
Modified: trunk/LWJGL/src/java/org/lwjgl/DefaultSysImplementation.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/DefaultSysImplementation.java 2010-10-01 17:00:17 UTC (rev 3425)
+++ trunk/LWJGL/src/java/org/lwjgl/DefaultSysImplementation.java 2010-10-01 22:20:14 UTC (rev 3426)
@@ -40,6 +40,7 @@
*/
abstract class DefaultSysImplementation implements SysImplementation {
public native int getJNIVersion();
+ public native int getPointerSize();
public native void setDebug(boolean debug);
public long getTimerResolution() {
Modified: trunk/LWJGL/src/java/org/lwjgl/Sys.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/Sys.java 2010-10-01 17:00:17 UTC (rev 3425)
+++ trunk/LWJGL/src/java/org/lwjgl/Sys.java 2010-10-01 22:20:14 UTC (rev 3426)
@@ -77,15 +77,13 @@
});
}
- private static boolean loadLibrary(final String lib_name) {
+ private static void loadLibrary(final String lib_name) {
try {
doLoadLibrary(lib_name);
- return false;
} catch (UnsatisfiedLinkError e) {
if (implementation.has64Bit()) {
try {
doLoadLibrary(lib_name + POSTFIX64BIT);
- return true;
} catch (UnsatisfiedLinkError e2) {
LWJGLUtil.log("Failed to load 64 bit library: " + e2.getMessage());
}
@@ -97,13 +95,14 @@
static {
implementation = createImplementation();
- is64Bit = loadLibrary(JNI_LIBRARY_NAME);
+ loadLibrary(JNI_LIBRARY_NAME);
+ is64Bit = implementation.getPointerSize() == 8;
int native_jni_version = implementation.getJNIVersion();
int required_version = implementation.getRequiredJNIVersion();
if (native_jni_version != required_version)
throw new LinkageError("Version mismatch: jar version is '" + required_version +
- "', native libary version is '" + native_jni_version + "'");
+ "', native library version is '" + native_jni_version + "'");
implementation.setDebug(LWJGLUtil.DEBUG);
}
Modified: trunk/LWJGL/src/java/org/lwjgl/SysImplementation.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/SysImplementation.java 2010-10-01 17:00:17 UTC (rev 3425)
+++ trunk/LWJGL/src/java/org/lwjgl/SysImplementation.java 2010-10-01 22:20:14 UTC (rev 3426)
@@ -51,6 +51,11 @@
*/
int getJNIVersion();
+ /**
+ * Returns the platform's pointer size in bytes
+ */
+ int getPointerSize();
+
void setDebug(boolean debug);
/**
Modified: trunk/LWJGL/src/java/org/lwjgl/opencl/APIUtil.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opencl/APIUtil.java 2010-10-01 17:00:17 UTC (rev 3425)
+++ trunk/LWJGL/src/java/org/lwjgl/opencl/APIUtil.java 2010-10-01 22:20:14 UTC (rev 3426)
@@ -430,9 +430,11 @@
static Set<String> getExtensions(final String extensionList) {
final Set<String> extensions = new HashSet<String>();
- final StringTokenizer tokenizer = new StringTokenizer(extensionList);
- while ( tokenizer.hasMoreTokens() )
- extensions.add(tokenizer.nextToken());
+ if ( extensionList != null ) {
+ final StringTokenizer tokenizer = new StringTokenizer(extensionList);
+ while ( tokenizer.hasMoreTokens() )
+ extensions.add(tokenizer.nextToken());
+ }
return extensions;
}
Modified: trunk/LWJGL/src/java/org/lwjgl/opencl/CallbackUtil.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opencl/CallbackUtil.java 2010-10-01 17:00:17 UTC (rev 3425)
+++ trunk/LWJGL/src/java/org/lwjgl/opencl/CallbackUtil.java 2010-10-01 22:20:14 UTC (rev 3426)
@@ -34,6 +34,8 @@
import java.util.HashMap;
import java.util.Map;
+import static org.lwjgl.opencl.CL10.*;
+
/**
* Utility class that handles OpenCL API callbacks.
*
@@ -79,7 +81,7 @@
* @param user_data the GlobalRef memory address
*/
static void checkCallback(final int errcode, final long user_data) {
- if ( errcode != 0x0 && user_data != 0 )
+ if ( errcode != CL_SUCCESS && user_data != 0 )
deleteGlobalRef(user_data);
}
@@ -107,7 +109,7 @@
* @param user_data the global reference pointer
*/
static void registerCallback(final CLContext context, final long user_data) {
- if ( context.getPointer() == 0 ) {
+ if ( context.getPointerUnsafe() == 0 ) {
if ( user_data != 0 )
deleteGlobalRef(user_data);
return;
Modified: trunk/LWJGL/src/java/org/lwjgl/test/opencl/HelloOpenCL.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/test/opencl/HelloOpenCL.java 2010-10-01 17:00:17 UTC (rev 3425)
+++ trunk/LWJGL/src/java/org/lwjgl/test/opencl/HelloOpenCL.java 2010-10-01 22:20:14 UTC (rev 3426)
@@ -33,6 +33,7 @@
import org.lwjgl.BufferUtils;
import org.lwjgl.LWJGLException;
+import org.lwjgl.LWJGLUtil;
import org.lwjgl.PointerBuffer;
import org.lwjgl.opencl.*;
import org.lwjgl.opencl.api.CLBufferRegion;
@@ -49,7 +50,7 @@
public HelloOpenCL() {
}
- protected void execute() {
+ protected static void execute() {
try {
CL.create();
@@ -135,28 +136,31 @@
clRetainMemObject(buffer);
- final long exec_caps = device.getInfoLong(CL_DEVICE_EXECUTION_CAPABILITIES);
- if ( (exec_caps & CL_EXEC_NATIVE_KERNEL) == CL_EXEC_NATIVE_KERNEL ) {
- System.out.println("-TRYING TO EXEC NATIVE KERNEL-");
- final CLCommandQueue queue = clCreateCommandQueue(context, device, 0, null);
+ if ( LWJGLUtil.getPlatform() != LWJGLUtil.PLATFORM_MACOSX ) {
+ // TODO: Native kernels crash on MacOSX, disable this until we can debug properly.
+ final long exec_caps = device.getInfoLong(CL_DEVICE_EXECUTION_CAPABILITIES);
+ if ( (exec_caps & CL_EXEC_NATIVE_KERNEL) == CL_EXEC_NATIVE_KERNEL ) {
+ System.out.println("-TRYING TO EXEC NATIVE KERNEL-");
+ final CLCommandQueue queue = clCreateCommandQueue(context, device, 0, null);
- clEnqueueNativeKernel(queue, new CLNativeKernel() {
- protected void execute(final ByteBuffer[] memobjs) {
- if ( memobjs == null )
- System.out.println("OK, it's null");
- else {
- System.out.println("memobjs = " + memobjs.length);
- for ( int k = 0; k < memobjs.length; k++ ) {
- System.out.println("memobjs[" + k + "].remaining() = " + memobjs[k].remaining());
- for ( int l = memobjs[k].position(); l < memobjs[k].limit(); l++ ) {
- memobjs[k].put(l, (byte)l);
+ clEnqueueNativeKernel(queue, new CLNativeKernel() {
+ protected void execute(final ByteBuffer[] memobjs) {
+ if ( memobjs == null )
+ System.out.println("OK, it's null");
+ else {
+ System.out.println("memobjs = " + memobjs.length);
+ for ( int k = 0; k < memobjs.length; k++ ) {
+ System.out.println("memobjs[" + k + "].remaining() = " + memobjs[k].remaining());
+ for ( int l = memobjs[k].position(); l < memobjs[k].limit(); l++ ) {
+ memobjs[k].put(l, (byte)l);
+ }
}
}
}
- }
- }, new CLMem[] { buffer }, new long[] { 128 }, null, null);
+ }, new CLMem[] { buffer }, new long[] { 128 }, null, null);
- clFinish(queue);
+ clFinish(queue);
+ }
}
clReleaseMemObject(buffer);
Modified: trunk/LWJGL/src/native/common/common_tools.c
===================================================================
--- trunk/LWJGL/src/native/common/common_tools.c 2010-10-01 17:00:17 UTC (rev 3425)
+++ trunk/LWJGL/src/native/common/common_tools.c 2010-10-01 22:20:14 UTC (rev 3426)
@@ -61,6 +61,10 @@
list->current_index++;
}
+JNIEXPORT jint JNICALL Java_org_lwjgl_DefaultSysImplementation_getPointerSize(JNIEnv *env, jclass clazz) {
+ return (jint)sizeof(void *);
+}
+
JNIEXPORT void JNICALL Java_org_lwjgl_DefaultSysImplementation_setDebug
(JNIEnv *env, jobject ignored, jboolean enable) {
debug = enable == JNI_TRUE ? true : false;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2010-10-01 17:00:24
|
Revision: 3425
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3425&view=rev
Author: spasi
Date: 2010-10-01 17:00:17 +0000 (Fri, 01 Oct 2010)
Log Message:
-----------
Fixed Mandelbrot.cl to not crash on Cuda.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/test/opencl/gl/DemoFractal.java
trunk/LWJGL/src/java/org/lwjgl/test/opencl/gl/Mandelbrot.cl
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_viewport_array.java
Modified: trunk/LWJGL/src/java/org/lwjgl/test/opencl/gl/DemoFractal.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/test/opencl/gl/DemoFractal.java 2010-10-01 03:48:41 UTC (rev 3424)
+++ trunk/LWJGL/src/java/org/lwjgl/test/opencl/gl/DemoFractal.java 2010-10-01 17:00:17 UTC (rev 3425)
@@ -476,7 +476,7 @@
for ( int i = 0; i < programs.length; i++ ) {
final CLDevice device = queues[i].getCLDevice();
- final StringBuilder options = new StringBuilder(useTextures ? " -D USE_TEXTURE" : "");
+ final StringBuilder options = new StringBuilder(useTextures ? "-D USE_TEXTURE" : "");
final CLDeviceCapabilities caps = CLCapabilities.getDeviceCapabilities(device);
if ( doublePrecision && isDoubleFPAvailable(device) ) {
//cl_khr_fp64
Modified: trunk/LWJGL/src/java/org/lwjgl/test/opencl/gl/Mandelbrot.cl
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/test/opencl/gl/Mandelbrot.cl 2010-10-01 03:48:41 UTC (rev 3424)
+++ trunk/LWJGL/src/java/org/lwjgl/test/opencl/gl/Mandelbrot.cl 2010-10-01 17:00:17 UTC (rev 3425)
@@ -4,15 +4,17 @@
#else
#pragma OPENCL EXTENSION cl_khr_fp64 : enable
#endif
- typedef double varfloat;
+ #define varfloat double
+ #define _255 255.0
#else
- typedef float varfloat;
+ #define varfloat float
+ #define _255 255.0f
#endif
#ifdef USE_TEXTURE
- typedef __write_only image2d_t OUTPUT_TYPE;
+ #define OUTPUT_TYPE __write_only image2d_t
#else
- typedef global uint * OUTPUT_TYPE;
+ #define OUTPUT_TYPE global uint *
#endif
/**
@@ -54,7 +56,7 @@
#else
output[iy * width + ix] = 0;
#endif
- } else {
+ } else {
varfloat alpha = (varfloat)iteration / maxIterations;
int colorIndex = (int)(alpha * colorMapSize);
#ifdef USE_TEXTURE
@@ -67,9 +69,9 @@
(c & 0xFF) >> 0,
(c & 0xFF00) >> 8,
(c & 0xFF0000) >> 16,
- 255.0
+ _255
);
- write_imagef(output, (int2)(ix, iy), oc / 255.0);
+ write_imagef(output, (int2)(ix, iy), oc / _255);
#else
output[iy * width + ix] = colorMap[colorIndex];
#endif
Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_viewport_array.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_viewport_array.java 2010-10-01 03:48:41 UTC (rev 3424)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_viewport_array.java 2010-10-01 17:00:17 UTC (rev 3425)
@@ -122,17 +122,15 @@
@StripPostfix("data")
void glGetDoublei_v2(@GLenum int target, @GLuint int index, @OutParameter DoubleBuffer data);
- // TODO: It's glGetIntegerIndexedvEXT in EXT_draw_buffers2, spec typo?
- //@Reuse(extension = "EXT_draw_buffers2", className = "EXTDrawBuffers2")
+ @Reuse("EXTDrawBuffers2")
@StripPostfix(value = "v", extension = "EXT")
- void glGetIntegerIndexedivEXT(@GLenum int target, @GLuint int index, @Check @OutParameter IntBuffer v);
+ void glGetIntegerIndexedvEXT(@GLenum int target, @GLuint int index, @Check @OutParameter IntBuffer v);
- // TODO: It's glGetIntegerIndexedvEXT in EXT_draw_buffers2, spec typo?
- //@Reuse(extension = "EXT_draw_buffers2", className = "EXTDrawBuffers2")
+ @Reuse("EXTDrawBuffers2")
@Alternate("glGetIntegerIndexedivEXT")
@GLreturn("v")
@StripPostfix(value = "v", extension = "EXT")
- void glGetIntegerIndexedivEXT2(@GLenum int target, @GLuint int index, @OutParameter IntBuffer v);
+ void glGetIntegerIndexedvEXT2(@GLenum int target, @GLuint int index, @OutParameter IntBuffer v);
@Reuse("EXTDrawBuffers2")
void glEnableIndexedEXT(@GLenum int target, @GLuint int index);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2010-10-01 03:48:49
|
Revision: 3424
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3424&view=rev
Author: spasi
Date: 2010-10-01 03:48:41 +0000 (Fri, 01 Oct 2010)
Log Message:
-----------
OpenCL C 1.0 didn't support 3-component vectors.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/test/opencl/gl/DemoFractal.java
trunk/LWJGL/src/java/org/lwjgl/test/opencl/gl/Mandelbrot.cl
Modified: trunk/LWJGL/src/java/org/lwjgl/test/opencl/gl/DemoFractal.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/test/opencl/gl/DemoFractal.java 2010-10-01 00:18:45 UTC (rev 3423)
+++ trunk/LWJGL/src/java/org/lwjgl/test/opencl/gl/DemoFractal.java 2010-10-01 03:48:41 UTC (rev 3424)
@@ -346,10 +346,12 @@
else if ( device_type == CL_DEVICE_TYPE_CPU && !caps.OpenGL21 )
throw new RuntimeException("OpenGL 2.1 is required to run this demo.");
- if ( caps.GL_ARB_debug_output )
- glDebugMessageCallbackARB(new ARBDebugOutputCallback());
- else if ( caps.GL_AMD_debug_output )
- glDebugMessageCallbackAMD(new AMDDebugOutputCallback());
+ if ( params.contains("debugGL") ) {
+ if ( caps.GL_ARB_debug_output )
+ glDebugMessageCallbackARB(new ARBDebugOutputCallback());
+ else if ( caps.GL_AMD_debug_output )
+ glDebugMessageCallbackAMD(new AMDDebugOutputCallback());
+ }
if ( device_type == CL_DEVICE_TYPE_GPU )
System.out.println("OpenCL Device Type: GPU (Use -forceCPU to use CPU)");
Modified: trunk/LWJGL/src/java/org/lwjgl/test/opencl/gl/Mandelbrot.cl
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/test/opencl/gl/Mandelbrot.cl 2010-10-01 00:18:45 UTC (rev 3423)
+++ trunk/LWJGL/src/java/org/lwjgl/test/opencl/gl/Mandelbrot.cl 2010-10-01 03:48:41 UTC (rev 3424)
@@ -63,12 +63,13 @@
// We could also use an R32UI texture and do the unpacking in GLSL,
// but then we'd require OpenGL 3.0 (GLSL 1.30).
uint c = colorMap[colorIndex];
- float3 oc = (float3)(
+ float4 oc = (float4)(
(c & 0xFF) >> 0,
(c & 0xFF00) >> 8,
- (c & 0xFF0000) >> 16
+ (c & 0xFF0000) >> 16,
+ 255.0
);
- write_imagef(output, (int2)(ix, iy), (float4)(oc / 255.0, 1.0));
+ write_imagef(output, (int2)(ix, iy), oc / 255.0);
#else
output[iy * width + ix] = colorMap[colorIndex];
#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2010-10-01 00:18:51
|
Revision: 3423
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3423&view=rev
Author: spasi
Date: 2010-10-01 00:18:45 +0000 (Fri, 01 Oct 2010)
Log Message:
-----------
More CL fixes.
Modified Paths:
--------------
trunk/LWJGL/src/templates/org/lwjgl/opencl/APPLE_gl_sharing.java
trunk/LWJGL/src/templates/org/lwjgl/opencl/KHR_gl_sharing.java
Removed Paths:
-------------
trunk/LWJGL/src/templates/org/lwjgl/opencl/AMD_event_callback.java
Deleted: trunk/LWJGL/src/templates/org/lwjgl/opencl/AMD_event_callback.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opencl/AMD_event_callback.java 2010-09-30 23:36:37 UTC (rev 3422)
+++ trunk/LWJGL/src/templates/org/lwjgl/opencl/AMD_event_callback.java 2010-10-01 00:18:45 UTC (rev 3423)
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 2002-2010 LWJGL Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * * Neither the name of 'LWJGL' nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-package org.lwjgl.opencl;
-
-import org.lwjgl.util.generator.opencl.CLPlatformExtension;
-
-@CLPlatformExtension
-public interface AMD_event_callback {
- // Not implemented
-}
\ No newline at end of file
Modified: trunk/LWJGL/src/templates/org/lwjgl/opencl/APPLE_gl_sharing.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opencl/APPLE_gl_sharing.java 2010-09-30 23:36:37 UTC (rev 3422)
+++ trunk/LWJGL/src/templates/org/lwjgl/opencl/APPLE_gl_sharing.java 2010-10-01 00:18:45 UTC (rev 3423)
@@ -69,7 +69,7 @@
@Code(
javaBeforeNative = "\t\tif ( param_value_size_ret == null && APIUtil.isDevicesParam(param_name) ) param_value_size_ret = APIUtil.getBufferPointer();",
- javaAfterNative = "\t\tif ( __result == CL_SUCCESS && param_value != null && APIUtil.isDevicesParam(param_name) ) context.getParent().registerCLDevices(param_value, param_value_size_ret);"
+ javaAfterNative = "\t\tif ( __result == CL10.CL_SUCCESS && param_value != null && APIUtil.isDevicesParam(param_name) ) context.getParent().registerCLDevices(param_value, param_value_size_ret);"
)
@cl_int
int clGetGLContextInfoAPPLE(@PointerWrapper("cl_context") CLContext context,
Modified: trunk/LWJGL/src/templates/org/lwjgl/opencl/KHR_gl_sharing.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opencl/KHR_gl_sharing.java 2010-09-30 23:36:37 UTC (rev 3422)
+++ trunk/LWJGL/src/templates/org/lwjgl/opencl/KHR_gl_sharing.java 2010-10-01 00:18:45 UTC (rev 3423)
@@ -65,7 +65,7 @@
@Code(
javaBeforeNative = "\t\tif ( param_value_size_ret == null && APIUtil.isDevicesParam(param_name) ) param_value_size_ret = APIUtil.getBufferPointer();",
- javaAfterNative = "\t\tif ( __result == CL_SUCCESS && param_value != null && APIUtil.isDevicesParam(param_name) ) APIUtil.getCLPlatform(properties).registerCLDevices(param_value, param_value_size_ret);"
+ javaAfterNative = "\t\tif ( __result == CL10.CL_SUCCESS && param_value != null && APIUtil.isDevicesParam(param_name) ) APIUtil.getCLPlatform(properties).registerCLDevices(param_value, param_value_size_ret);"
)
@cl_int
int clGetGLContextInfoKHR(@NullTerminated @Const @NativeType("cl_context_properties") PointerBuffer properties,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2010-09-30 23:36:48
|
Revision: 3422
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3422&view=rev
Author: spasi
Date: 2010-09-30 23:36:37 +0000 (Thu, 30 Sep 2010)
Log Message:
-----------
Misc CL fixes.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/PointerBuffer.java
trunk/LWJGL/src/java/org/lwjgl/PointerWrapperAbstract.java
trunk/LWJGL/src/java/org/lwjgl/opencl/APIUtil.java
trunk/LWJGL/src/java/org/lwjgl/opencl/CLPlatform.java
trunk/LWJGL/src/java/org/lwjgl/opencl/InfoUtilFactory.java
trunk/LWJGL/src/java/org/lwjgl/test/opencl/HelloOpenCL.java
trunk/LWJGL/src/templates/org/lwjgl/opencl/APPLE_gl_sharing.java
trunk/LWJGL/src/templates/org/lwjgl/opencl/CL10.java
trunk/LWJGL/src/templates/org/lwjgl/opencl/KHR_gl_sharing.java
Modified: trunk/LWJGL/src/java/org/lwjgl/PointerBuffer.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/PointerBuffer.java 2010-09-30 19:04:25 UTC (rev 3421)
+++ trunk/LWJGL/src/java/org/lwjgl/PointerBuffer.java 2010-09-30 23:36:37 UTC (rev 3422)
@@ -290,6 +290,16 @@
}
/**
+ * Returns the number of bytes between the current position and the
+ * limit. </p>
+ *
+ * @return The number of bytes remaining in this buffer
+ */
+ public final int remainingByte() {
+ return remaining() * getPointerSize();
+ }
+
+ /**
* Tells whether there are any elements between the current position and
* the limit. </p>
*
Modified: trunk/LWJGL/src/java/org/lwjgl/PointerWrapperAbstract.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/PointerWrapperAbstract.java 2010-09-30 19:04:25 UTC (rev 3421)
+++ trunk/LWJGL/src/java/org/lwjgl/PointerWrapperAbstract.java 2010-09-30 23:36:37 UTC (rev 3422)
@@ -87,6 +87,6 @@
}
public String toString() {
- return getClass().getSimpleName() + " pointer (0x" + Long.toHexString(pointer) + ")";
+ return getClass().getSimpleName() + " pointer (0x" + Long.toHexString(pointer).toUpperCase() + ")";
}
}
\ No newline at end of file
Modified: trunk/LWJGL/src/java/org/lwjgl/opencl/APIUtil.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opencl/APIUtil.java 2010-09-30 19:04:25 UTC (rev 3421)
+++ trunk/LWJGL/src/java/org/lwjgl/opencl/APIUtil.java 2010-09-30 23:36:37 UTC (rev 3422)
@@ -42,6 +42,11 @@
import java.util.Set;
import java.util.StringTokenizer;
+import static org.lwjgl.opencl.APPLEGLSharing.*;
+import static org.lwjgl.opencl.CL10.*;
+import static org.lwjgl.opencl.EXTDeviceFission.*;
+import static org.lwjgl.opencl.KHRGLSharing.*;
+
/**
* Utility class for OpenCL API calls.
*
@@ -432,6 +437,19 @@
return extensions;
}
+ static boolean isDevicesParam(final int param_name) {
+ switch ( param_name ) {
+ case CL_CONTEXT_DEVICES:
+ case CL_CURRENT_DEVICE_FOR_GL_CONTEXT_KHR:
+ case CL_DEVICES_FOR_GL_CONTEXT_KHR:
+ case CL_CGL_DEVICE_FOR_CURRENT_VIRTUAL_SCREEN_APPLE:
+ case CL_CGL_DEVICES_FOR_SUPPORTED_VIRTUAL_SCREENS_APPLE:
+ return true;
+ }
+
+ return false;
+ }
+
static CLPlatform getCLPlatform(final PointerBuffer properties) {
long platformID = 0;
@@ -441,7 +459,7 @@
if ( key == 0 )
break;
- if ( key == 0x1084 ) { // CL_CONTEXT_PLATFORM
+ if ( key == CL_CONTEXT_PLATFORM ) {
platformID = properties.get((k << 1) + 1);
break;
}
@@ -452,7 +470,7 @@
final CLPlatform platform = CLPlatform.getCLPlatform(platformID);
if ( platform == null )
- throw new IllegalStateException("Could not find a valid CLPlatform. Make sure clGetPlatformIDs has been used before creating a CLContext.");
+ throw new IllegalStateException("Could not find a valid CLPlatform. Make sure clGetPlatformIDs has been used before.");
return platform;
}
@@ -546,25 +564,25 @@
}
private static final ObjectDestructor<CLDevice> DESTRUCTOR_CLSubDevice = new ObjectDestructor<CLDevice>() {
- public void release(final CLDevice object) { EXTDeviceFission.clReleaseDeviceEXT(object); }
+ public void release(final CLDevice object) { clReleaseDeviceEXT(object); }
};
private static final ObjectDestructor<CLMem> DESTRUCTOR_CLMem = new ObjectDestructor<CLMem>() {
- public void release(final CLMem object) { CL10.clReleaseMemObject(object); }
+ public void release(final CLMem object) { clReleaseMemObject(object); }
};
private static final ObjectDestructor<CLCommandQueue> DESTRUCTOR_CLCommandQueue = new ObjectDestructor<CLCommandQueue>() {
- public void release(final CLCommandQueue object) { CL10.clReleaseCommandQueue(object); }
+ public void release(final CLCommandQueue object) { clReleaseCommandQueue(object); }
};
private static final ObjectDestructor<CLSampler> DESTRUCTOR_CLSampler = new ObjectDestructor<CLSampler>() {
- public void release(final CLSampler object) { CL10.clReleaseSampler(object); }
+ public void release(final CLSampler object) { clReleaseSampler(object); }
};
private static final ObjectDestructor<CLProgram> DESTRUCTOR_CLProgram = new ObjectDestructor<CLProgram>() {
- public void release(final CLProgram object) { CL10.clReleaseProgram(object); }
+ public void release(final CLProgram object) { clReleaseProgram(object); }
};
private static final ObjectDestructor<CLKernel> DESTRUCTOR_CLKernel = new ObjectDestructor<CLKernel>() {
- public void release(final CLKernel object) { CL10.clReleaseKernel(object); }
+ public void release(final CLKernel object) { clReleaseKernel(object); }
};
private static final ObjectDestructor<CLEvent> DESTRUCTOR_CLEvent = new ObjectDestructor<CLEvent>() {
- public void release(final CLEvent object) { CL10.clReleaseEvent(object); }
+ public void release(final CLEvent object) { clReleaseEvent(object); }
};
private interface ObjectDestructor<T extends CLObjectChild> {
Modified: trunk/LWJGL/src/java/org/lwjgl/opencl/CLPlatform.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opencl/CLPlatform.java 2010-09-30 19:04:25 UTC (rev 3421)
+++ trunk/LWJGL/src/java/org/lwjgl/opencl/CLPlatform.java 2010-09-30 23:36:37 UTC (rev 3422)
@@ -210,7 +210,7 @@
for ( int i = 0; i < count; i++ ) {
final long id = devices.get(pos + i);
if ( !clDevices.hasObject(id) )
- new CLDevice(devices.get(pos + i), this);
+ new CLDevice(id, this);
}
}
@@ -226,7 +226,7 @@
final int offset = pos + (i * PointerBuffer.getPointerSize());
final long id = PointerBuffer.is64Bit() ? devices.getLong(offset) : devices.getInt(offset);
if ( !clDevices.hasObject(id) )
- new CLDevice(devices.get(pos + i), this);
+ new CLDevice(id, this);
}
}
Modified: trunk/LWJGL/src/java/org/lwjgl/opencl/InfoUtilFactory.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opencl/InfoUtilFactory.java 2010-09-30 19:04:25 UTC (rev 3421)
+++ trunk/LWJGL/src/java/org/lwjgl/opencl/InfoUtilFactory.java 2010-09-30 23:36:37 UTC (rev 3422)
@@ -96,25 +96,31 @@
}
/** Custom clCreateContext implementation (reuses APIUtil.getBufferPointer) */
- public CLContext create(final CLPlatform platform, final List<CLDevice> devices, final CLContextCallback pfn_notify, final Drawable share_drawable, final IntBuffer errcode_ret) throws LWJGLException {
+ public CLContext create(final CLPlatform platform, final List<CLDevice> devices, final CLContextCallback pfn_notify, final Drawable share_drawable, IntBuffer errcode_ret) throws LWJGLException {
final int propertyCount = 2 + (share_drawable == null ? 0 : 4) + 1;
- final PointerBuffer buffer = APIUtil.getBufferPointer(propertyCount + devices.size());
- buffer.put(CL_CONTEXT_PLATFORM).put(platform);
+ final PointerBuffer properties = APIUtil.getBufferPointer(propertyCount + devices.size());
+ properties.put(CL_CONTEXT_PLATFORM).put(platform);
if ( share_drawable != null )
- share_drawable.setCLSharingProperties(buffer);
- buffer.put(0);
+ share_drawable.setCLSharingProperties(properties);
+ properties.put(0);
- buffer.position(propertyCount); // Make sure we're at the right offset, setCLSharingProperties might not use all 4 positions.
+ properties.position(propertyCount); // Make sure we're at the right offset, setCLSharingProperties might not use all 4 positions.
for ( CLDevice device : devices )
- buffer.put(device);
+ properties.put(device);
final long function_pointer = CLCapabilities.clCreateContext;
BufferChecks.checkFunctionAddress(function_pointer);
+ if ( errcode_ret != null )
+ BufferChecks.checkBuffer(errcode_ret, 1);
+ else if ( LWJGLUtil.DEBUG )
+ errcode_ret = APIUtil.getBufferInt();
final long user_data = pfn_notify == null || pfn_notify.isCustom() ? 0 : CallbackUtil.createGlobalRef(pfn_notify);
CLContext __result = null;
try {
- __result = new CLContext(nclCreateContext(buffer.getBuffer(), 0, devices.size(), buffer.getBuffer(), propertyCount * PointerBuffer.getPointerSize(), pfn_notify == null ? 0 : pfn_notify.getPointer(), user_data, errcode_ret, errcode_ret != null ? errcode_ret.position() : 0, function_pointer), platform);
+ __result = new CLContext(nclCreateContext(properties.getBuffer(), 0, devices.size(), properties.getBuffer(), propertyCount * PointerBuffer.getPointerSize(), pfn_notify == null ? 0 : pfn_notify.getPointer(), user_data, errcode_ret, errcode_ret != null ? errcode_ret.position() : 0, function_pointer), platform);
+ if ( LWJGLUtil.DEBUG )
+ Util.checkCLError(errcode_ret.get(0));
return __result;
} finally {
CallbackUtil.registerCallback(__result, user_data);
@@ -282,7 +288,7 @@
return clGetMemObjectInfo(mem, param_name, param_value, param_value_size_ret);
}
- public CLMem createImage2D(final CLContext context, final long flags, final CLImageFormat image_format, final long image_width, final long image_height, final long image_row_pitch, final Buffer host_ptr, final IntBuffer errcode_ret) {
+ public CLMem createImage2D(final CLContext context, final long flags, final CLImageFormat image_format, final long image_width, final long image_height, final long image_row_pitch, final Buffer host_ptr, IntBuffer errcode_ret) {
final ByteBuffer formatBuffer = APIUtil.getBufferByte(2 * 4);
formatBuffer.putInt(0, image_format.getChannelOrder());
formatBuffer.putInt(4, image_format.getChannelType());
@@ -291,12 +297,18 @@
BufferChecks.checkFunctionAddress(function_pointer);
if ( errcode_ret != null )
BufferChecks.checkBuffer(errcode_ret, 1);
- return new CLMem(nclCreateImage2D(context.getPointer(), flags, formatBuffer, 0, image_width, image_height, image_row_pitch, host_ptr,
- host_ptr != null ? BufferChecks.checkBuffer(host_ptr, CLChecks.calculateImage2DSize(formatBuffer, image_width, image_height, image_row_pitch)) : 0,
- errcode_ret, errcode_ret != null ? errcode_ret.position() : 0, function_pointer), context);
+ else if ( LWJGLUtil.DEBUG )
+ errcode_ret = APIUtil.getBufferInt();
+
+ CLMem __result = new CLMem(nclCreateImage2D(context.getPointer(), flags, formatBuffer, 0, image_width, image_height, image_row_pitch, host_ptr,
+ host_ptr != null ? BufferChecks.checkBuffer(host_ptr, CLChecks.calculateImage2DSize(formatBuffer, image_width, image_height, image_row_pitch)) : 0,
+ errcode_ret, errcode_ret != null ? errcode_ret.position() : 0, function_pointer), context);
+ if ( LWJGLUtil.DEBUG )
+ Util.checkCLError(errcode_ret.get(0));
+ return __result;
}
- public CLMem createImage3D(final CLContext context, final long flags, final CLImageFormat image_format, final long image_width, final long image_height, final long image_depth, final long image_row_pitch, final long image_slice_pitch, final Buffer host_ptr, final IntBuffer errcode_ret) {
+ public CLMem createImage3D(final CLContext context, final long flags, final CLImageFormat image_format, final long image_width, final long image_height, final long image_depth, final long image_row_pitch, final long image_slice_pitch, final Buffer host_ptr, IntBuffer errcode_ret) {
final ByteBuffer formatBuffer = APIUtil.getBufferByte(2 * 4);
formatBuffer.putInt(0, image_format.getChannelOrder());
formatBuffer.putInt(4, image_format.getChannelType());
@@ -305,9 +317,15 @@
BufferChecks.checkFunctionAddress(function_pointer);
if ( errcode_ret != null )
BufferChecks.checkBuffer(errcode_ret, 1);
- return new CLMem(nclCreateImage3D(context.getPointer(), flags, formatBuffer, 0, image_width, image_height, image_depth, image_row_pitch, image_slice_pitch, host_ptr,
- host_ptr != null ? BufferChecks.checkBuffer(host_ptr, CLChecks.calculateImage3DSize(formatBuffer, image_width, image_height, image_depth, image_row_pitch, image_slice_pitch)) : 0,
- errcode_ret, errcode_ret != null ? errcode_ret.position() : 0, function_pointer), context);
+ else if ( LWJGLUtil.DEBUG )
+ errcode_ret = APIUtil.getBufferInt();
+
+ CLMem __result = new CLMem(nclCreateImage3D(context.getPointer(), flags, formatBuffer, 0, image_width, image_height, image_depth, image_row_pitch, image_slice_pitch, host_ptr,
+ host_ptr != null ? BufferChecks.checkBuffer(host_ptr, CLChecks.calculateImage3DSize(formatBuffer, image_width, image_height, image_depth, image_row_pitch, image_slice_pitch)) : 0,
+ errcode_ret, errcode_ret != null ? errcode_ret.position() : 0, function_pointer), context);
+ if ( LWJGLUtil.DEBUG )
+ Util.checkCLError(errcode_ret.get(0));
+ return __result;
}
public CLMem createSubBuffer(final CLMem mem, final long flags, final int buffer_create_type, final CLBufferRegion buffer_create_info, final IntBuffer errcode_ret) {
@@ -317,7 +335,6 @@
infoBuffer.put(buffer_create_info.getSize());
return clCreateSubBuffer(mem, flags, buffer_create_type, infoBuffer.getBuffer(), errcode_ret);
-
}
public ByteBuffer getInfoHostBuffer(final CLMem mem) {
Modified: trunk/LWJGL/src/java/org/lwjgl/test/opencl/HelloOpenCL.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/test/opencl/HelloOpenCL.java 2010-09-30 19:04:25 UTC (rev 3421)
+++ trunk/LWJGL/src/java/org/lwjgl/test/opencl/HelloOpenCL.java 2010-09-30 23:36:37 UTC (rev 3422)
@@ -54,6 +54,9 @@
CL.create();
final List<CLPlatform> platforms = CLPlatform.getPlatforms();
+ if ( platforms == null )
+ throw new RuntimeException("No OpenCL platforms found.");
+
for ( CLPlatform platform : platforms ) {
System.out.println("\n-------------------------");
System.out.println("NEW PLATFORM: " + platform.getPointer());
Modified: trunk/LWJGL/src/templates/org/lwjgl/opencl/APPLE_gl_sharing.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opencl/APPLE_gl_sharing.java 2010-09-30 19:04:25 UTC (rev 3421)
+++ trunk/LWJGL/src/templates/org/lwjgl/opencl/APPLE_gl_sharing.java 2010-09-30 23:36:37 UTC (rev 3422)
@@ -67,6 +67,10 @@
/** Error code returned by clGetGLContextInfoAPPLE if an invalid platform_gl_ctx is provided */
int CL_INVALID_GL_CONTEXT_APPLE = -1000;
+ @Code(
+ javaBeforeNative = "\t\tif ( param_value_size_ret == null && APIUtil.isDevicesParam(param_name) ) param_value_size_ret = APIUtil.getBufferPointer();",
+ javaAfterNative = "\t\tif ( __result == CL_SUCCESS && param_value != null && APIUtil.isDevicesParam(param_name) ) context.getParent().registerCLDevices(param_value, param_value_size_ret);"
+ )
@cl_int
int clGetGLContextInfoAPPLE(@PointerWrapper("cl_context") CLContext context,
@Check("1") @NativeType("cl_void") PointerBuffer platform_gl_ctx,
Modified: trunk/LWJGL/src/templates/org/lwjgl/opencl/CL10.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opencl/CL10.java 2010-09-30 19:04:25 UTC (rev 3421)
+++ trunk/LWJGL/src/templates/org/lwjgl/opencl/CL10.java 2010-09-30 23:36:37 UTC (rev 3422)
@@ -456,8 +456,8 @@
int clReleaseContext(@PointerWrapper("cl_context") CLContext context);
@Code(
- javaBeforeNative = "\t\tif ( param_name == CL_CONTEXT_DEVICES && param_value_size_ret == null ) param_value_size_ret = APIUtil.getBufferPointer();",
- javaAfterNative = "\t\tif ( param_name == CL_CONTEXT_DEVICES && __result == CL_SUCCESS && param_value != null ) context.getParent().registerCLDevices(param_value, param_value_size_ret);"
+ javaBeforeNative = "\t\tif ( param_value_size_ret == null && APIUtil.isDevicesParam(param_name) ) param_value_size_ret = APIUtil.getBufferPointer();",
+ javaAfterNative = "\t\tif ( __result == CL_SUCCESS && param_value != null && APIUtil.isDevicesParam(param_name) ) context.getParent().registerCLDevices(param_value, param_value_size_ret);"
)
@cl_int
int clGetContextInfo(@PointerWrapper("cl_context") CLContext context,
@@ -915,7 +915,7 @@
@cl_int
int clGetProgramInfo2(@PointerWrapper("cl_program") CLProgram program,
@Constant("CL_PROGRAM_BINARIES") @NativeType("cl_program_info") int param_name,
- @Constant("sizes.remaining() * PointerBuffer.getPointerSize()") @size_t long param_value_size,
+ @Constant("sizes.remainingByte()") @size_t long param_value_size,
@Helper(passToNative = true) @Check("1") @Const @NativeType("size_t") PointerBuffer sizes,
@OutParameter @Check("APIUtil.getSize(sizes)") @PointerArray(value = "param_value_size", lengths = "sizes") @NativeType("cl_uchar") ByteBuffer param_value,
@OutParameter @Check(value = "1", canBeNull = true) @NativeType("size_t") PointerBuffer param_value_size_ret);
Modified: trunk/LWJGL/src/templates/org/lwjgl/opencl/KHR_gl_sharing.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opencl/KHR_gl_sharing.java 2010-09-30 19:04:25 UTC (rev 3421)
+++ trunk/LWJGL/src/templates/org/lwjgl/opencl/KHR_gl_sharing.java 2010-09-30 23:36:37 UTC (rev 3422)
@@ -63,6 +63,10 @@
CL_WGL_HDC_KHR = 0x200B,
CL_CGL_SHAREGROUP_KHR = 0x200C;
+ @Code(
+ javaBeforeNative = "\t\tif ( param_value_size_ret == null && APIUtil.isDevicesParam(param_name) ) param_value_size_ret = APIUtil.getBufferPointer();",
+ javaAfterNative = "\t\tif ( __result == CL_SUCCESS && param_value != null && APIUtil.isDevicesParam(param_name) ) APIUtil.getCLPlatform(properties).registerCLDevices(param_value, param_value_size_ret);"
+ )
@cl_int
int clGetGLContextInfoKHR(@NullTerminated @Const @NativeType("cl_context_properties") PointerBuffer properties,
@NativeType("cl_gl_context_info") int param_name,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2010-09-30 19:04:31
|
Revision: 3421
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3421&view=rev
Author: spasi
Date: 2010-09-30 19:04:25 +0000 (Thu, 30 Sep 2010)
Log Message:
-----------
Added NV OpenCL extensions.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/test/opencl/HelloOpenCL.java
trunk/LWJGL/src/templates/org/lwjgl/opencl/KHR_fp16.java
Added Paths:
-----------
trunk/LWJGL/src/templates/org/lwjgl/opencl/NV_compiler_options.java
trunk/LWJGL/src/templates/org/lwjgl/opencl/NV_device_attribute_query.java
trunk/LWJGL/src/templates/org/lwjgl/opencl/NV_pragma_unroll.java
Modified: trunk/LWJGL/src/java/org/lwjgl/test/opencl/HelloOpenCL.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/test/opencl/HelloOpenCL.java 2010-09-30 17:52:16 UTC (rev 3420)
+++ trunk/LWJGL/src/java/org/lwjgl/test/opencl/HelloOpenCL.java 2010-09-30 19:04:25 UTC (rev 3421)
@@ -94,6 +94,7 @@
printDeviceInfo(device, "CL_DRIVER_VERSION", CL_DRIVER_VERSION);
printDeviceInfo(device, "CL_DEVICE_PROFILE", CL_DEVICE_PROFILE);
printDeviceInfo(device, "CL_DEVICE_VERSION", CL_DEVICE_VERSION);
+ printDeviceInfo(device, "CL_DEVICE_EXTENSIONS", CL_DEVICE_EXTENSIONS);
if ( caps.OpenCL11 )
printDeviceInfo(device, "CL_DEVICE_OPENCL_C_VERSION", CL_DEVICE_OPENCL_C_VERSION);
Modified: trunk/LWJGL/src/templates/org/lwjgl/opencl/KHR_fp16.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opencl/KHR_fp16.java 2010-09-30 17:52:16 UTC (rev 3420)
+++ trunk/LWJGL/src/templates/org/lwjgl/opencl/KHR_fp16.java 2010-09-30 19:04:25 UTC (rev 3421)
@@ -36,4 +36,7 @@
@CLDeviceExtension
public interface KHR_fp16 {
+ /** cl_device_info */
+ int CL_DEVICE_HALF_FP_CONFIG = 0x1033;
+
}
\ No newline at end of file
Added: trunk/LWJGL/src/templates/org/lwjgl/opencl/NV_compiler_options.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opencl/NV_compiler_options.java (rev 0)
+++ trunk/LWJGL/src/templates/org/lwjgl/opencl/NV_compiler_options.java 2010-09-30 19:04:25 UTC (rev 3421)
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2002-2010 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opencl;
+
+import org.lwjgl.util.generator.opencl.CLDeviceExtension;
+
+@CLDeviceExtension
+public interface NV_compiler_options {
+
+}
\ No newline at end of file
Added: trunk/LWJGL/src/templates/org/lwjgl/opencl/NV_device_attribute_query.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opencl/NV_device_attribute_query.java (rev 0)
+++ trunk/LWJGL/src/templates/org/lwjgl/opencl/NV_device_attribute_query.java 2010-09-30 19:04:25 UTC (rev 3421)
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2002-2010 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opencl;
+
+import org.lwjgl.util.generator.opencl.CLDeviceExtension;
+
+@CLDeviceExtension
+public interface NV_device_attribute_query {
+
+ /** Accepted as the <param_name> parameter of clGetDeviceInfo. */
+ int CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV = 0x4000,
+ CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV = 0x4001,
+ CL_DEVICE_REGISTERS_PER_BLOCK_NV = 0x4002,
+ CL_DEVICE_WARP_SIZE_NV = 0x4003,
+ CL_DEVICE_GPU_OVERLAP_NV = 0x4004,
+ CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV = 0x4005,
+ CL_DEVICE_INTEGRATED_MEMORY_NV = 0x4006;
+
+}
\ No newline at end of file
Added: trunk/LWJGL/src/templates/org/lwjgl/opencl/NV_pragma_unroll.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opencl/NV_pragma_unroll.java (rev 0)
+++ trunk/LWJGL/src/templates/org/lwjgl/opencl/NV_pragma_unroll.java 2010-09-30 19:04:25 UTC (rev 3421)
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2002-2010 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opencl;
+
+import org.lwjgl.util.generator.opencl.CLDeviceExtension;
+
+@CLDeviceExtension
+public interface NV_pragma_unroll {
+
+}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2010-09-30 17:52:22
|
Revision: 3420
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3420&view=rev
Author: spasi
Date: 2010-09-30 17:52:16 +0000 (Thu, 30 Sep 2010)
Log Message:
-----------
Added checks for CL 1.1 stuff.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/test/opencl/HelloOpenCL.java
Modified: trunk/LWJGL/src/java/org/lwjgl/test/opencl/HelloOpenCL.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/test/opencl/HelloOpenCL.java 2010-09-30 17:21:50 UTC (rev 3419)
+++ trunk/LWJGL/src/java/org/lwjgl/test/opencl/HelloOpenCL.java 2010-09-30 17:52:16 UTC (rev 3420)
@@ -35,6 +35,7 @@
import org.lwjgl.LWJGLException;
import org.lwjgl.PointerBuffer;
import org.lwjgl.opencl.*;
+import org.lwjgl.opencl.api.CLBufferRegion;
import java.nio.ByteBuffer;
import java.util.List;
@@ -70,8 +71,10 @@
final List<CLDevice> devices = platform.getDevices(CL_DEVICE_TYPE_ALL);
for ( CLDevice device : devices ) {
+ final CLDeviceCapabilities caps = CLCapabilities.getDeviceCapabilities(device);
+
System.out.println("\n\tNEW DEVICE: " + device.getPointer());
- System.out.println(CLCapabilities.getDeviceCapabilities(device));
+ System.out.println(caps);
System.out.println("\t-------------------------");
System.out.println("\tCL_DEVICE_TYPE = " + device.getInfoInt(CL_DEVICE_TYPE));
@@ -91,7 +94,8 @@
printDeviceInfo(device, "CL_DRIVER_VERSION", CL_DRIVER_VERSION);
printDeviceInfo(device, "CL_DEVICE_PROFILE", CL_DEVICE_PROFILE);
printDeviceInfo(device, "CL_DEVICE_VERSION", CL_DEVICE_VERSION);
- printDeviceInfo(device, "CL_DEVICE_OPENCL_C_VERSION", CL_DEVICE_OPENCL_C_VERSION);
+ if ( caps.OpenCL11 )
+ printDeviceInfo(device, "CL_DEVICE_OPENCL_C_VERSION", CL_DEVICE_OPENCL_C_VERSION);
CLContext context = clCreateContext(ctxProps, device, new CLContextCallback() {
protected void handleMessage(final String errinfo, final ByteBuffer private_info) {
@@ -101,29 +105,29 @@
CLMem buffer = clCreateBuffer(context, CL_MEM_READ_ONLY, 128, null);
- clSetMemObjectDestructorCallback(buffer, new CLMemObjectDestructorCallback() {
- protected void handleMessage(final long memobj) {
- System.out.println("FIRST Buffer destructed: " + memobj);
- }
- });
+ if ( caps.OpenCL11 ) {
+ clSetMemObjectDestructorCallback(buffer, new CLMemObjectDestructorCallback() {
+ protected void handleMessage(final long memobj) {
+ System.out.println("FIRST Buffer destructed: " + memobj);
+ }
+ });
- clSetMemObjectDestructorCallback(buffer, new CLMemObjectDestructorCallback() {
- protected void handleMessage(final long memobj) {
- System.out.println("SECOND Buffer destructed: " + memobj);
- }
- });
+ clSetMemObjectDestructorCallback(buffer, new CLMemObjectDestructorCallback() {
+ protected void handleMessage(final long memobj) {
+ System.out.println("SECOND Buffer destructed: " + memobj);
+ }
+ });
+ }
- ByteBuffer bufferCreateInfo = BufferUtils.createByteBuffer(2 * PointerBuffer.getPointerSize());
- PointerBuffer.put(bufferCreateInfo, 0);
- PointerBuffer.put(bufferCreateInfo, 64);
- bufferCreateInfo.flip();
- CLMem subbuffer = clCreateSubBuffer(buffer, CL10.CL_MEM_READ_ONLY, CL11.CL_BUFFER_CREATE_TYPE_REGION, bufferCreateInfo, null);
+ if ( caps.OpenCL11 ) {
+ CLMem subbuffer = buffer.createSubBuffer(CL_MEM_READ_ONLY, CL_BUFFER_CREATE_TYPE_REGION, new CLBufferRegion(0, 64), null);
- clSetMemObjectDestructorCallback(subbuffer, new CLMemObjectDestructorCallback() {
- protected void handleMessage(final long memobj) {
- System.out.println("Sub Buffer destructed: " + memobj);
- }
- });
+ clSetMemObjectDestructorCallback(subbuffer, new CLMemObjectDestructorCallback() {
+ protected void handleMessage(final long memobj) {
+ System.out.println("Sub Buffer destructed: " + memobj);
+ }
+ });
+ }
clRetainMemObject(buffer);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2010-09-30 17:21:59
|
Revision: 3419
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3419&view=rev
Author: spasi
Date: 2010-09-30 17:21:50 +0000 (Thu, 30 Sep 2010)
Log Message:
-----------
Misc GL/CL fixes and additions.
Made native calls package private, we can now use them from the high-level API.
Added support for "render-to-texture" in the fractal demo.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/BufferChecks.java
trunk/LWJGL/src/java/org/lwjgl/LWJGLUtil.java
trunk/LWJGL/src/java/org/lwjgl/PointerWrapperAbstract.java
trunk/LWJGL/src/java/org/lwjgl/opencl/APIUtil.java
trunk/LWJGL/src/java/org/lwjgl/opencl/CLChecks.java
trunk/LWJGL/src/java/org/lwjgl/opencl/CLContext.java
trunk/LWJGL/src/java/org/lwjgl/opencl/CLMem.java
trunk/LWJGL/src/java/org/lwjgl/opencl/CLProgram.java
trunk/LWJGL/src/java/org/lwjgl/opencl/InfoUtilAbstract.java
trunk/LWJGL/src/java/org/lwjgl/opencl/InfoUtilFactory.java
trunk/LWJGL/src/java/org/lwjgl/opencl/Util.java
trunk/LWJGL/src/java/org/lwjgl/test/opencl/gl/DemoFractal.java
trunk/LWJGL/src/java/org/lwjgl/test/opencl/gl/Mandelbrot.cl
trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_direct_state_access.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/GL40.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_half_float.java
Added Paths:
-----------
trunk/LWJGL/src/java/org/lwjgl/opencl/api/CLBufferRegion.java
trunk/LWJGL/src/java/org/lwjgl/opencl/api/CLImageFormat.java
Modified: trunk/LWJGL/src/java/org/lwjgl/BufferChecks.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/BufferChecks.java 2010-09-28 21:11:35 UTC (rev 3418)
+++ trunk/LWJGL/src/java/org/lwjgl/BufferChecks.java 2010-09-30 17:21:50 UTC (rev 3419)
@@ -31,13 +31,7 @@
*/
package org.lwjgl;
-import java.nio.Buffer;
-import java.nio.ByteBuffer;
-import java.nio.DoubleBuffer;
-import java.nio.FloatBuffer;
-import java.nio.IntBuffer;
-import java.nio.ShortBuffer;
-import java.nio.LongBuffer;
+import java.nio.*;
/**
* <p>A class to check buffer boundaries in general. If there is unsufficient space
@@ -89,21 +83,21 @@
/** Helper method to ensure an IntBuffer is null-terminated */
public static void checkNullTerminated(IntBuffer buf) {
- if ( buf.get(buf.limit() - 1) != 0 ) {
+ if ( LWJGLUtil.CHECKS && buf.get(buf.limit() - 1) != 0 ) {
throw new IllegalArgumentException("Missing null termination");
}
}
/** Helper method to ensure a LongBuffer is null-terminated */
public static void checkNullTerminated(LongBuffer buf) {
- if ( buf.get(buf.limit() - 1) != 0 ) {
+ if ( LWJGLUtil.CHECKS && buf.get(buf.limit() - 1) != 0 ) {
throw new IllegalArgumentException("Missing null termination");
}
}
/** Helper method to ensure a PointerBuffer is null-terminated */
public static void checkNullTerminated(PointerBuffer buf) {
- if ( buf.get(buf.limit() - 1) != 0 ) {
+ if ( LWJGLUtil.CHECKS && buf.get(buf.limit() - 1) != 0 ) {
throw new IllegalArgumentException("Missing null termination");
}
}
@@ -196,6 +190,41 @@
}
}
+ /**
+ * Detects the buffer type and performs the corresponding check
+ * and also returns the buffer position in bytes.
+ *
+ * @param buffer the buffer to check
+ * @param size the size to check
+ *
+ * @return the buffer position in bytes
+ */
+ public static int checkBuffer(final Buffer buffer, final int size) {
+ final int posShift;
+ if ( buffer instanceof ByteBuffer ) {
+ BufferChecks.checkBuffer((ByteBuffer)buffer, size);
+ posShift = 0;
+ } else if ( buffer instanceof ShortBuffer ) {
+ BufferChecks.checkBuffer((ShortBuffer)buffer, size);
+ posShift = 1;
+ } else if ( buffer instanceof IntBuffer ) {
+ BufferChecks.checkBuffer((IntBuffer)buffer, size);
+ posShift = 2;
+ } else if ( buffer instanceof LongBuffer ) {
+ BufferChecks.checkBuffer((LongBuffer)buffer, size);
+ posShift = 4;
+ } else if ( buffer instanceof FloatBuffer ) {
+ BufferChecks.checkBuffer((FloatBuffer)buffer, size);
+ posShift = 2;
+ } else if ( buffer instanceof DoubleBuffer ) {
+ BufferChecks.checkBuffer((DoubleBuffer)buffer, size);
+ posShift = 4;
+ } else
+ throw new IllegalArgumentException("Unsupported Buffer type specified: " + buffer.getClass());
+
+ return buffer.position() << posShift;
+ }
+
public static void checkBuffer(ByteBuffer buf, int size) {
if ( LWJGLUtil.CHECKS ) {
checkBufferSize(buf, size);
Modified: trunk/LWJGL/src/java/org/lwjgl/LWJGLUtil.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/LWJGLUtil.java 2010-09-28 21:11:35 UTC (rev 3418)
+++ trunk/LWJGL/src/java/org/lwjgl/LWJGLUtil.java 2010-09-30 17:21:50 UTC (rev 3419)
@@ -32,17 +32,16 @@
package org.lwjgl;
import java.io.File;
+import java.lang.reflect.Field;
import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
import java.nio.ByteBuffer;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.StringTokenizer;
+import java.util.*;
-
/**
* <p>
* Internal library methods
@@ -488,4 +487,92 @@
return major > major_required || (major == major_required && minor >= minor_required);
}
-}
+ /**
+ * Returns a map of public static final integer fields in the specified classes, to their String representations.
+ * An optional filter can be specified to only include specific fields. The target map may be null, in which
+ * case a new map is allocated and returned.
+ * <p>
+ * This method is useful when debugging to quickly identify values returned from the AL/GL/CL APIs.
+ *
+ * @param filter the filter to use (optional)
+ * @param target the target map (optional)
+ * @param tokenClasses an array of classes to get tokens from
+ *
+ * @return the token map
+ */
+
+ public static Map<Integer, String> getClassTokens(final TokenFilter filter, final Map<Integer, String> target, final Class ... tokenClasses) {
+ return getClassTokens(filter, target, Arrays.asList(tokenClasses));
+ }
+
+ /**
+ * Returns a map of public static final integer fields in the specified classes, to their String representations.
+ * An optional filter can be specified to only include specific fields. The target map may be null, in which
+ * case a new map is allocated and returned.
+ * <p>
+ * This method is useful when debugging to quickly identify values returned from the AL/GL/CL APIs.
+ *
+ * @param filter the filter to use (optional)
+ * @param target the target map (optional)
+ * @param tokenClasses the classes to get tokens from
+ *
+ * @return the token map
+ */
+ public static Map<Integer, String> getClassTokens(final TokenFilter filter, Map<Integer, String> target, final Iterable<Class> tokenClasses) {
+ if ( target == null )
+ target = new HashMap<Integer, String>();
+
+ final int TOKEN_MODIFIERS = Modifier.PUBLIC | Modifier.STATIC | Modifier.FINAL;
+
+ for ( final Class tokenClass : tokenClasses ) {
+ for ( final Field field : tokenClass.getDeclaredFields() ) {
+ // Get only <public static final int> fields.
+ if ( (field.getModifiers() & TOKEN_MODIFIERS) == TOKEN_MODIFIERS && field.getType() == int.class ) {
+ try {
+ final int value = field.getInt(null);
+ if ( filter != null && !filter.accept(field, value) )
+ continue;
+
+ if ( target.containsKey(value) ) // Print colliding tokens in their hex representation.
+ target.put(value, toHexString(value));
+ else
+ target.put(value, field.getName());
+ } catch (IllegalAccessException e) {
+ // Ignore
+ }
+ }
+ }
+ }
+
+ return target;
+ }
+
+ /**
+ * Returns a string representation of the integer argument as an
+ * unsigned integer in base 16. The string will be uppercase
+ * and will have a leading '0x'.
+ *
+ * @param value the integer value
+ *
+ * @return the hex string representation
+ */
+ public static String toHexString(final int value) {
+ return "0x" + Integer.toHexString(value).toUpperCase();
+ }
+
+ /** Simple interface for Field filtering. */
+ public interface TokenFilter {
+
+ /**
+ * Should return true if the specified Field passes the filter.
+ *
+ * @param field the Field to test
+ * @param value the integer value of the field
+ *
+ * @result true if the Field is accepted
+ */
+ boolean accept(Field field, int value);
+
+ }
+
+}
\ No newline at end of file
Modified: trunk/LWJGL/src/java/org/lwjgl/PointerWrapperAbstract.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/PointerWrapperAbstract.java 2010-09-28 21:11:35 UTC (rev 3418)
+++ trunk/LWJGL/src/java/org/lwjgl/PointerWrapperAbstract.java 2010-09-30 17:21:50 UTC (rev 3419)
@@ -63,7 +63,7 @@
*/
public final void checkValid() {
if ( LWJGLUtil.DEBUG && !isValid() )
- throw new IllegalStateException("This pointer is not valid.");
+ throw new IllegalStateException("This " + getClass().getSimpleName() + " pointer is not valid.");
}
public final long getPointer() {
Modified: trunk/LWJGL/src/java/org/lwjgl/opencl/APIUtil.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opencl/APIUtil.java 2010-09-28 21:11:35 UTC (rev 3418)
+++ trunk/LWJGL/src/java/org/lwjgl/opencl/APIUtil.java 2010-09-30 17:21:50 UTC (rev 3419)
@@ -35,18 +35,15 @@
import org.lwjgl.LWJGLUtil;
import org.lwjgl.PointerBuffer;
-import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
import java.nio.*;
import java.nio.charset.Charset;
import java.nio.charset.CharsetEncoder;
-import java.util.*;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.StringTokenizer;
-import static org.lwjgl.opencl.CL10.*;
-
/**
* Utility class for OpenCL API calls.
- * TODO: Remove useless stuff
*
* @author spasi
*/
@@ -356,38 +353,6 @@
return (int)size;
}
- static String toHexString(final int value) {
- return "0x" + Integer.toHexString(value).toUpperCase();
- }
-
- static void getClassTokens(final Class[] tokenClasses, final Map<Integer, String> target, final TokenFilter filter) {
- getClassTokens(Arrays.asList(tokenClasses), target, filter);
- }
-
- static void getClassTokens(final Iterable<Class> tokenClasses, final Map<Integer, String> target, final TokenFilter filter) {
- final int TOKEN_MODIFIERS = Modifier.PUBLIC | Modifier.STATIC | Modifier.FINAL;
-
- for ( final Class tokenClass : tokenClasses ) {
- for ( final Field field : tokenClass.getDeclaredFields() ) {
- // Get only <public static final int> fields.
- if ( (field.getModifiers() & TOKEN_MODIFIERS) == TOKEN_MODIFIERS && field.getType() == int.class ) {
- try {
- final int value = field.getInt(null);
- if ( filter != null && !filter.accept(field, value) )
- continue;
-
- if ( target.containsKey(value) ) // Print colliding tokens in their hex representation.
- target.put(value, toHexString(value));
- else
- target.put(value, field.getName());
- } catch (IllegalAccessException e) {
- // Ignore
- }
- }
- }
- }
- }
-
/**
* A mutable CharSequence with very large initial length. We can wrap this in a re-usable CharBuffer for decoding.
* We cannot subclass CharBuffer because of {@link java.nio.CharBuffer#toString(int,int)}.
@@ -451,14 +416,6 @@
}
- /** Simple interface for Field filtering */
- interface TokenFilter {
-
- /** Should return true if the specified Field passes the filter. */
- boolean accept(Field field, int value);
-
- }
-
/* ------------------------------------------------------------------------
---------------------------------------------------------------------------
OPENCL API UTILITIES BELOW
Modified: trunk/LWJGL/src/java/org/lwjgl/opencl/CLChecks.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opencl/CLChecks.java 2010-09-28 21:11:35 UTC (rev 3418)
+++ trunk/LWJGL/src/java/org/lwjgl/opencl/CLChecks.java 2010-09-30 17:21:50 UTC (rev 3419)
@@ -68,24 +68,24 @@
final long y = origin.get(1);
final long z = origin.get(2);
- if ( x < 0 || y < 0 || z < 0 )
+ if ( LWJGLUtil.DEBUG && (x < 0 || y < 0 || z < 0) )
throw new IllegalArgumentException("Invalid cl_mem host origin: " + x + ", " + y + ", " + z);
final long w = region.get(0);
final long h = region.get(1);
final long d = region.get(2);
- if ( w < 1 || h < 1 || d < 1 )
+ if ( LWJGLUtil.DEBUG && (w < 1 || h < 1 || d < 1) )
throw new IllegalArgumentException("Invalid cl_mem rectangle region dimensions: " + w + " x " + h + " x " + d);
if ( row_pitch == 0 )
row_pitch = w;
- else if ( row_pitch < w )
+ else if ( LWJGLUtil.DEBUG && row_pitch < w )
throw new IllegalArgumentException("Invalid host row pitch specified: " + row_pitch);
if ( slice_pitch == 0 )
slice_pitch = row_pitch * h;
- else if ( slice_pitch < (row_pitch * h) )
+ else if ( LWJGLUtil.DEBUG && slice_pitch < (row_pitch * h) )
throw new IllegalArgumentException("Invalid host slice pitch specified: " + slice_pitch);
return (int)((z * slice_pitch + y * row_pitch + x) + (w * h * d));
@@ -110,17 +110,17 @@
final long h = region.get(1);
final long d = region.get(2);
- if ( w < 1 || h < 1 || d < 1 )
+ if ( LWJGLUtil.DEBUG && (w < 1 || h < 1 || d < 1) )
throw new IllegalArgumentException("Invalid cl_mem image region dimensions: " + w + " x " + h + " x " + d);
if ( row_pitch == 0 )
row_pitch = w;
- else if ( row_pitch < w )
+ else if ( LWJGLUtil.DEBUG && row_pitch < w )
throw new IllegalArgumentException("Invalid row pitch specified: " + row_pitch);
if ( slice_pitch == 0 )
slice_pitch = row_pitch * h;
- else if ( slice_pitch < (row_pitch * h) )
+ else if ( LWJGLUtil.DEBUG && slice_pitch < (row_pitch * h) )
throw new IllegalArgumentException("Invalid slice pitch specified: " + slice_pitch);
return (int)(slice_pitch * d);
@@ -138,14 +138,17 @@
* @return the 2D image size in bytes
*/
static int calculateImage2DSize(final ByteBuffer format, final long w, final long h, long row_pitch) {
- if ( LWJGLUtil.CHECKS && (w < 1 || h < 1) )
+ if ( !LWJGLUtil.CHECKS )
+ return 0;
+
+ if ( LWJGLUtil.DEBUG && (w < 1 || h < 1) )
throw new IllegalArgumentException("Invalid 2D image dimensions: " + w + " x " + h);
final int elementSize = getElementSize(format);
if ( row_pitch == 0 )
row_pitch = w * elementSize;
- else if ( LWJGLUtil.CHECKS && ((row_pitch < w * elementSize) || (row_pitch % elementSize != 0)) )
+ else if ( LWJGLUtil.DEBUG && ((row_pitch < w * elementSize) || (row_pitch % elementSize != 0)) )
throw new IllegalArgumentException("Invalid image_row_pitch specified: " + row_pitch);
return (int)(row_pitch * h);
@@ -164,19 +167,22 @@
* @return the 3D image size in bytes
*/
static int calculateImage3DSize(final ByteBuffer format, final long w, final long h, final long d, long row_pitch, long slice_pitch) {
- if ( LWJGLUtil.CHECKS && (w < 1 || h < 1 || d < 2) )
+ if ( !LWJGLUtil.CHECKS )
+ return 0;
+
+ if ( LWJGLUtil.DEBUG && (w < 1 || h < 1 || d < 2) )
throw new IllegalArgumentException("Invalid 3D image dimensions: " + w + " x " + h + " x " + d);
final int elementSize = getElementSize(format);
if ( row_pitch == 0 )
row_pitch = w * elementSize;
- else if ( LWJGLUtil.CHECKS && ((row_pitch < w * elementSize) || (row_pitch % elementSize != 0)) )
+ else if ( LWJGLUtil.DEBUG && ((row_pitch < w * elementSize) || (row_pitch % elementSize != 0)) )
throw new IllegalArgumentException("Invalid image_row_pitch specified: " + row_pitch);
if ( slice_pitch == 0 )
slice_pitch = row_pitch * h;
- else if ( LWJGLUtil.CHECKS && ((row_pitch < row_pitch * h) || (slice_pitch % row_pitch != 0)) )
+ else if ( LWJGLUtil.DEBUG && ((row_pitch < row_pitch * h) || (slice_pitch % row_pitch != 0)) )
throw new IllegalArgumentException("Invalid image_slice_pitch specified: " + row_pitch);
return (int)(slice_pitch * d);
@@ -223,7 +229,7 @@
case CL_ARGB:
return 4;
default:
- throw new IllegalArgumentException("Invalid cl_channel_order specified: " + APIUtil.toHexString(channelOrder));
+ throw new IllegalArgumentException("Invalid cl_channel_order specified: " + LWJGLUtil.toHexString(channelOrder));
}
}
@@ -255,7 +261,7 @@
case CL_FLOAT:
return 4;
default:
- throw new IllegalArgumentException("Invalid cl_channel_type specified: " + APIUtil.toHexString(channelType));
+ throw new IllegalArgumentException("Invalid cl_channel_type specified: " + LWJGLUtil.toHexString(channelType));
}
}
Modified: trunk/LWJGL/src/java/org/lwjgl/opencl/CLContext.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opencl/CLContext.java 2010-09-28 21:11:35 UTC (rev 3418)
+++ trunk/LWJGL/src/java/org/lwjgl/opencl/CLContext.java 2010-09-30 17:21:50 UTC (rev 3419)
@@ -31,6 +31,12 @@
*/
package org.lwjgl.opencl;
+import org.lwjgl.LWJGLException;
+import org.lwjgl.opencl.api.CLImageFormat;
+import org.lwjgl.opencl.api.Filter;
+import org.lwjgl.opengl.Drawable;
+
+import java.nio.IntBuffer;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -125,6 +131,100 @@
// ---------------[ UTILITY METHODS ]---------------
/**
+ * Creates a new CLContext.
+ *
+ * @param platform the platform to use
+ * @param devices the devices to use
+ * @param errcode_ret the error code result
+ *
+ * @return the new CLContext
+ *
+ * @throws LWJGLException if an exception occurs while creating the context
+ */
+ public static CLContext create(final CLPlatform platform, final List<CLDevice> devices, final IntBuffer errcode_ret) throws LWJGLException {
+ return create(platform, devices, null, null, errcode_ret);
+ }
+
+ /**
+ * Creates a new CLContext.
+ *
+ * @param platform the platform to use
+ * @param devices the devices to use
+ * @param pfn_notify the context callback function
+ * @param errcode_ret the error code result
+ *
+ * @return the new CLContext
+ *
+ * @throws LWJGLException if an exception occurs while creating the context
+ */
+ public static CLContext create(final CLPlatform platform, final List<CLDevice> devices, final CLContextCallback pfn_notify, final IntBuffer errcode_ret) throws LWJGLException {
+ return create(platform, devices, pfn_notify, null, errcode_ret);
+ }
+
+ /**
+ * Creates a new CLContext.
+ *
+ * @param platform the platform to use
+ * @param devices the devices to use
+ * @param share_drawable the OpenGL drawable to share objects with
+ * @param errcode_ret the error code result
+ *
+ * @return the new CLContext
+ *
+ * @throws LWJGLException if an exception occurs while creating the context
+ */
+ public static CLContext create(final CLPlatform platform, final List<CLDevice> devices, final CLContextCallback pfn_notify, final Drawable share_drawable, final IntBuffer errcode_ret) throws LWJGLException {
+ return util.create(platform, devices, pfn_notify, share_drawable, errcode_ret);
+ }
+
+ /**
+ * Creates a new CLContext.
+ *
+ * @param platform the platform to use
+ * @param device_type the device type to use
+ * @param errcode_ret the error code result
+ *
+ * @return the new CLContext
+ *
+ * @throws LWJGLException if an exception occurs while creating the context
+ */
+ public static CLContext createFromType(final CLPlatform platform, final long device_type, final IntBuffer errcode_ret) throws LWJGLException {
+ return util.createFromType(platform, device_type, null, null, errcode_ret);
+ }
+
+ /**
+ * Creates a new CLContext.
+ *
+ * @param platform the platform to use
+ * @param device_type the device type to use
+ * @param pfn_notify the context callback function
+ * @param errcode_ret the error code result
+ *
+ * @return the new CLContext
+ *
+ * @throws LWJGLException if an exception occurs while creating the context
+ */
+ public static CLContext createFromType(final CLPlatform platform, final long device_type, final CLContextCallback pfn_notify, final IntBuffer errcode_ret) throws LWJGLException {
+ return util.createFromType(platform, device_type, pfn_notify, null, errcode_ret);
+ }
+
+ /**
+ * Creates a new CLContext.
+ *
+ * @param platform the platform to use
+ * @param device_type the device type to use
+ * @param share_drawable the OpenGL drawable to share objects with
+ * @param errcode_ret the error code result
+ *
+ * @return the new CLContext
+ *
+ * @throws LWJGLException if an exception occurs while creating the context
+ */
+ public static CLContext createFromType(final CLPlatform platform, final long device_type, final CLContextCallback pfn_notify, final Drawable share_drawable, final IntBuffer errcode_ret) throws LWJGLException {
+ return util.createFromType(platform, device_type, pfn_notify, share_drawable, errcode_ret);
+ }
+
+ /**
* Returns the integer value of the specified parameter.
*
* @param param_name the parameter
@@ -144,11 +244,25 @@
return util.getInfoDevices(this);
}
+ public List<CLImageFormat> getSupportedImageFormats(final long flags, final int image_type) {
+ return getSupportedImageFormats(flags, image_type, null);
+ }
+
+ public List<CLImageFormat> getSupportedImageFormats(final long flags, final int image_type, final Filter<CLImageFormat> filter) {
+ return util.getSupportedImageFormats(this, flags, image_type, filter);
+ }
+
/** CLContext utility methods interface. */
interface CLContextUtil extends InfoUtil<CLContext> {
List<CLDevice> getInfoDevices(CLContext context);
+ CLContext create(CLPlatform platform, List<CLDevice> devices, CLContextCallback pfn_notify, Drawable share_drawable, IntBuffer errcode_ret) throws LWJGLException;
+
+ CLContext createFromType(CLPlatform platform, long device_type, CLContextCallback pfn_notify, Drawable share_drawable, IntBuffer errcode_ret) throws LWJGLException;
+
+ List<CLImageFormat> getSupportedImageFormats(CLContext context, final long flags, final int image_type, Filter<CLImageFormat> filter);
+
}
// -------[ IMPLEMENTATION STUFF BELOW ]-------
Modified: trunk/LWJGL/src/java/org/lwjgl/opencl/CLMem.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opencl/CLMem.java 2010-09-28 21:11:35 UTC (rev 3418)
+++ trunk/LWJGL/src/java/org/lwjgl/opencl/CLMem.java 2010-09-30 17:21:50 UTC (rev 3419)
@@ -31,7 +31,12 @@
*/
package org.lwjgl.opencl;
+import org.lwjgl.opencl.api.CLBufferRegion;
+import org.lwjgl.opencl.api.CLImageFormat;
+
+import java.nio.Buffer;
import java.nio.ByteBuffer;
+import java.nio.IntBuffer;
/**
* This class is a wrapper around a cl_mem pointer.
@@ -51,6 +56,52 @@
// ---------------[ UTILITY METHODS ]---------------
/**
+ * Creates a new 2D image object.
+ *
+ * @param context the context on which to create the image object
+ * @param flags the memory object flags
+ * @param image_format the image format
+ * @param image_width the image width
+ * @param image_height the image height
+ * @param image_row_pitch the image row pitch
+ * @param host_ptr the host buffer from which to read image data (optional)
+ * @param errcode_ret the error code result
+ *
+ * @return the new CLMem object
+ */
+ public static CLMem createImage2D(final CLContext context, final long flags, final CLImageFormat image_format,
+ final long image_width, final long image_height, final long image_row_pitch,
+ final Buffer host_ptr, final IntBuffer errcode_ret) {
+ return util.createImage2D(context, flags, image_format, image_width, image_height, image_row_pitch, host_ptr, errcode_ret);
+ }
+
+ /**
+ * Creates a new 3D image object.
+ *
+ * @param context the context on which to create the image object
+ * @param flags the memory object flags
+ * @param image_format the image format
+ * @param image_width the image width
+ * @param image_height the image height
+ * @param image_depth the image depth
+ * @param image_row_pitch the image row pitch
+ * @param image_slice_pitch the image slice pitch
+ * @param host_ptr the host buffer from which to read image data (optional)
+ * @param errcode_ret the error code result
+ *
+ * @return the new CLMem object
+ */
+ public static CLMem createImage3D(final CLContext context, final long flags, final CLImageFormat image_format,
+ final long image_width, final long image_height, final long image_depth, final long image_row_pitch, final long image_slice_pitch,
+ final Buffer host_ptr, final IntBuffer errcode_ret) {
+ return util.createImage3D(context, flags, image_format, image_width, image_height, image_depth, image_row_pitch, image_slice_pitch, host_ptr, errcode_ret);
+ }
+
+ public CLMem createSubBuffer(final long flags, final int buffer_create_type, final CLBufferRegion buffer_create_info, final IntBuffer errcode_ret) {
+ return util.createSubBuffer(this, flags, buffer_create_type, buffer_create_info, errcode_ret);
+ }
+
+ /**
* Returns the integer value of the specified parameter.
*
* @param param_name the parameter
@@ -109,6 +160,15 @@
}
/**
+ * Returns the image format. Applicable to image objects only.
+ *
+ * @return the parameter value
+ */
+ public CLImageFormat getImageFormat() {
+ return util.getImageInfoFormat(this);
+ }
+
+ /**
* Returns the image channel order. Applicable to image objects only.
*
* @return the parameter value
@@ -165,10 +225,18 @@
/** CLMem utility methods interface. */
interface CLMemUtil extends InfoUtil<CLMem> {
+ CLMem createImage2D(CLContext context, long flags, CLImageFormat image_format, long image_width, long image_height, long image_row_pitch, Buffer host_ptr, IntBuffer errcode_ret);
+
+ CLMem createImage3D(CLContext context, long flags, CLImageFormat image_format, long image_width, long image_height, long image_depth, long image_row_pitch, long image_slice_pitch, Buffer host_ptr, IntBuffer errcode_ret);
+
+ CLMem createSubBuffer(CLMem mem, long flags, int buffer_create_type, CLBufferRegion buffer_create_info, IntBuffer errcode_ret);
+
ByteBuffer getInfoHostBuffer(CLMem mem);
long getImageInfoSize(CLMem mem, int param_name);
+ CLImageFormat getImageInfoFormat(CLMem mem);
+
int getImageInfoFormat(CLMem mem, int index);
int getGLObjectType(CLMem mem);
Modified: trunk/LWJGL/src/java/org/lwjgl/opencl/CLProgram.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opencl/CLProgram.java 2010-09-28 21:11:35 UTC (rev 3418)
+++ trunk/LWJGL/src/java/org/lwjgl/opencl/CLProgram.java 2010-09-30 17:21:50 UTC (rev 3419)
@@ -70,6 +70,15 @@
// ---------------[ UTILITY METHODS ]---------------
/**
+ * Creates kernel objects for all kernels functions in this program.
+ *
+ * @return a CLKernel array
+ */
+ public CLKernel[] createKernelsInProgram() {
+ return util.createKernelsInProgram(this);
+ }
+
+ /**
* Returns the String value of the specified parameter.
*
* @param param_name the parameter
@@ -168,6 +177,8 @@
/** CLProgram utility methods interface. */
interface CLProgramUtil extends InfoUtil<CLProgram> {
+ CLKernel[] createKernelsInProgram(CLProgram program);
+
CLDevice[] getInfoDevices(CLProgram program);
ByteBuffer getInfoBinaries(CLProgram program, ByteBuffer target);
Modified: trunk/LWJGL/src/java/org/lwjgl/opencl/InfoUtilAbstract.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opencl/InfoUtilAbstract.java 2010-09-28 21:11:35 UTC (rev 3418)
+++ trunk/LWJGL/src/java/org/lwjgl/opencl/InfoUtilAbstract.java 2010-09-30 17:21:50 UTC (rev 3419)
@@ -31,6 +31,7 @@
*/
package org.lwjgl.opencl;
+import org.lwjgl.LWJGLUtil;
import org.lwjgl.PointerBuffer;
import java.nio.ByteBuffer;
@@ -112,8 +113,8 @@
object.checkValid();
final int bytes = getSizeRet(object, param_name);
- if ( bytes == 0 )
- return "";
+ if ( bytes <= 1 )
+ return null;
final ByteBuffer buffer = APIUtil.getBufferByte(bytes);
getInfo(object, param_name, buffer, null);
@@ -126,7 +127,7 @@
final PointerBuffer bytes = APIUtil.getBufferPointer();
final int errcode = getInfo(object, param_name, null, bytes);
if ( errcode != CL_SUCCESS )
- throw new IllegalArgumentException("Invalid parameter specified: " + APIUtil.toHexString(param_name));
+ throw new IllegalArgumentException("Invalid parameter specified: " + LWJGLUtil.toHexString(param_name));
return (int)bytes.get(0);
}
Modified: trunk/LWJGL/src/java/org/lwjgl/opencl/InfoUtilFactory.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opencl/InfoUtilFactory.java 2010-09-28 21:11:35 UTC (rev 3418)
+++ trunk/LWJGL/src/java/org/lwjgl/opencl/InfoUtilFactory.java 2010-09-30 17:21:50 UTC (rev 3419)
@@ -32,8 +32,12 @@
package org.lwjgl.opencl;
import org.lwjgl.*;
+import org.lwjgl.opencl.api.CLBufferRegion;
+import org.lwjgl.opencl.api.CLImageFormat;
import org.lwjgl.opencl.api.Filter;
+import org.lwjgl.opengl.Drawable;
+import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.IntBuffer;
import java.util.ArrayList;
@@ -49,7 +53,6 @@
* so that they can be compiled for the generator.
*
* @author Spasi
- * @since 28 \xD3\xE5\xF0 2010
*/
final class InfoUtilFactory {
@@ -92,6 +95,70 @@
}
+ /** Custom clCreateContext implementation (reuses APIUtil.getBufferPointer) */
+ public CLContext create(final CLPlatform platform, final List<CLDevice> devices, final CLContextCallback pfn_notify, final Drawable share_drawable, final IntBuffer errcode_ret) throws LWJGLException {
+ final int propertyCount = 2 + (share_drawable == null ? 0 : 4) + 1;
+
+ final PointerBuffer buffer = APIUtil.getBufferPointer(propertyCount + devices.size());
+ buffer.put(CL_CONTEXT_PLATFORM).put(platform);
+ if ( share_drawable != null )
+ share_drawable.setCLSharingProperties(buffer);
+ buffer.put(0);
+
+ buffer.position(propertyCount); // Make sure we're at the right offset, setCLSharingProperties might not use all 4 positions.
+ for ( CLDevice device : devices )
+ buffer.put(device);
+
+ final long function_pointer = CLCapabilities.clCreateContext;
+ BufferChecks.checkFunctionAddress(function_pointer);
+ final long user_data = pfn_notify == null || pfn_notify.isCustom() ? 0 : CallbackUtil.createGlobalRef(pfn_notify);
+ CLContext __result = null;
+ try {
+ __result = new CLContext(nclCreateContext(buffer.getBuffer(), 0, devices.size(), buffer.getBuffer(), propertyCount * PointerBuffer.getPointerSize(), pfn_notify == null ? 0 : pfn_notify.getPointer(), user_data, errcode_ret, errcode_ret != null ? errcode_ret.position() : 0, function_pointer), platform);
+ return __result;
+ } finally {
+ CallbackUtil.registerCallback(__result, user_data);
+ }
+ }
+
+ public CLContext createFromType(final CLPlatform platform, final long device_type, final CLContextCallback pfn_notify, final Drawable share_drawable, final IntBuffer errcode_ret) throws LWJGLException {
+ final int propertyCount = 2 + (share_drawable == null ? 0 : 4) + 1;
+
+ final PointerBuffer properties = APIUtil.getBufferPointer(propertyCount);
+ properties.put(CL_CONTEXT_PLATFORM).put(platform);
+ if ( share_drawable != null )
+ share_drawable.setCLSharingProperties(properties);
+ properties.put(0);
+ properties.flip();
+
+ return clCreateContextFromType(properties, device_type, pfn_notify, errcode_ret);
+ }
+
+ public List<CLImageFormat> getSupportedImageFormats(final CLContext context, final long flags, final int image_type, final Filter<CLImageFormat> filter) {
+ final IntBuffer numBuffer = APIUtil.getBufferInt();
+ clGetSupportedImageFormats(context, flags, image_type, null, numBuffer);
+
+ final int num_image_formats = numBuffer.get(0);
+ if ( num_image_formats == 0 )
+ return null;
+
+ final ByteBuffer formatBuffer = BufferUtils.createByteBuffer(num_image_formats * CLImageFormat.STRUCT_SIZE);
+ clGetSupportedImageFormats(context, flags, image_type, formatBuffer, null);
+
+ final List<CLImageFormat> formats = new ArrayList<CLImageFormat>(num_image_formats);
+ for ( int i = 0; i < num_image_formats; i++ ) {
+ final int offset = num_image_formats * CLImageFormat.STRUCT_SIZE;
+ final CLImageFormat format = new CLImageFormat(
+ formatBuffer.getInt(offset),
+ formatBuffer.getInt(offset + 4)
+ );
+ if ( filter == null || filter.accept(format) )
+ formats.add(format);
+ }
+
+ return formats.size() == 0 ? null : formats;
+ }
+
}
static final InfoUtil<CLDevice> CL_DEVICE_UTIL = new CLDeviceUtil();
@@ -106,7 +173,7 @@
case CL_DEVICE_MAX_WORK_ITEM_SIZES:
return getInfoInt(device, CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS);
default:
- throw new IllegalArgumentException("Unsupported parameter: " + APIUtil.toHexString(param_name));
+ throw new IllegalArgumentException("Unsupported parameter: " + LWJGLUtil.toHexString(param_name));
}
}
@@ -183,7 +250,7 @@
size = 3;
break;
default:
- throw new IllegalArgumentException("Unsupported parameter: " + APIUtil.toHexString(param_name));
+ throw new IllegalArgumentException("Unsupported parameter: " + LWJGLUtil.toHexString(param_name));
}
final PointerBuffer buffer = APIUtil.getBufferPointer(size);
@@ -215,6 +282,44 @@
return clGetMemObjectInfo(mem, param_name, param_value, param_value_size_ret);
}
+ public CLMem createImage2D(final CLContext context, final long flags, final CLImageFormat image_format, final long image_width, final long image_height, final long image_row_pitch, final Buffer host_ptr, final IntBuffer errcode_ret) {
+ final ByteBuffer formatBuffer = APIUtil.getBufferByte(2 * 4);
+ formatBuffer.putInt(0, image_format.getChannelOrder());
+ formatBuffer.putInt(4, image_format.getChannelType());
+
+ final long function_pointer = CLCapabilities.clCreateImage2D;
+ BufferChecks.checkFunctionAddress(function_pointer);
+ if ( errcode_ret != null )
+ BufferChecks.checkBuffer(errcode_ret, 1);
+ return new CLMem(nclCreateImage2D(context.getPointer(), flags, formatBuffer, 0, image_width, image_height, image_row_pitch, host_ptr,
+ host_ptr != null ? BufferChecks.checkBuffer(host_ptr, CLChecks.calculateImage2DSize(formatBuffer, image_width, image_height, image_row_pitch)) : 0,
+ errcode_ret, errcode_ret != null ? errcode_ret.position() : 0, function_pointer), context);
+ }
+
+ public CLMem createImage3D(final CLContext context, final long flags, final CLImageFormat image_format, final long image_width, final long image_height, final long image_depth, final long image_row_pitch, final long image_slice_pitch, final Buffer host_ptr, final IntBuffer errcode_ret) {
+ final ByteBuffer formatBuffer = APIUtil.getBufferByte(2 * 4);
+ formatBuffer.putInt(0, image_format.getChannelOrder());
+ formatBuffer.putInt(4, image_format.getChannelType());
+
+ final long function_pointer = CLCapabilities.clCreateImage3D;
+ BufferChecks.checkFunctionAddress(function_pointer);
+ if ( errcode_ret != null )
+ BufferChecks.checkBuffer(errcode_ret, 1);
+ return new CLMem(nclCreateImage3D(context.getPointer(), flags, formatBuffer, 0, image_width, image_height, image_depth, image_row_pitch, image_slice_pitch, host_ptr,
+ host_ptr != null ? BufferChecks.checkBuffer(host_ptr, CLChecks.calculateImage3DSize(formatBuffer, image_width, image_height, image_depth, image_row_pitch, image_slice_pitch)) : 0,
+ errcode_ret, errcode_ret != null ? errcode_ret.position() : 0, function_pointer), context);
+ }
+
+ public CLMem createSubBuffer(final CLMem mem, final long flags, final int buffer_create_type, final CLBufferRegion buffer_create_info, final IntBuffer errcode_ret) {
+ final PointerBuffer infoBuffer = APIUtil.getBufferPointer(2);
+
+ infoBuffer.put(buffer_create_info.getOrigin());
+ infoBuffer.put(buffer_create_info.getSize());
+
+ return clCreateSubBuffer(mem, flags, buffer_create_type, infoBuffer.getBuffer(), errcode_ret);
+
+ }
+
public ByteBuffer getInfoHostBuffer(final CLMem mem) {
mem.checkValid();
@@ -242,6 +347,16 @@
return buffer.get(0);
}
+ public CLImageFormat getImageInfoFormat(final CLMem mem) {
+ mem.checkValid();
+
+ final ByteBuffer format = APIUtil.getBufferByte(2 * 4);
+
+ clGetImageInfo(mem, CL_IMAGE_FORMAT, format, null);
+
+ return new CLImageFormat(format.getInt(0), format.getInt(4));
+ }
+
public int getImageInfoFormat(final CLMem mem, final int index) {
mem.checkValid();
@@ -346,10 +461,28 @@
case CL_PROGRAM_BINARY_SIZES:
return getInfoInt(program, CL_PROGRAM_NUM_DEVICES);
default:
- throw new IllegalArgumentException("Unsupported parameter: " + APIUtil.toHexString(param_name));
+ throw new IllegalArgumentException("Unsupported parameter: " + LWJGLUtil.toHexString(param_name));
}
}
+ public CLKernel[] createKernelsInProgram(final CLProgram program) {
+ final IntBuffer numBuffer = APIUtil.getBufferInt();
+ clCreateKernelsInProgram(program, null, numBuffer);
+
+ final int num_kernels = numBuffer.get(0);
+ if ( num_kernels == 0 )
+ return null;
+
+ final PointerBuffer kernelIDs = APIUtil.getBufferPointer(num_kernels);
+ clCreateKernelsInProgram(program, kernelIDs, null);
+
+ final CLKernel[] kernels = new CLKernel[num_kernels];
+ for ( int i = 0; i < num_kernels; i++ )
+ kernels[i] = program.getCLKernel(kernelIDs.get(i));
+
+ return kernels;
+ }
+
public CLDevice[] getInfoDevices(final CLProgram program) {
program.checkValid();
@@ -413,8 +546,8 @@
program.checkValid();
final int bytes = getBuildSizeRet(program, device, param_name);
- if ( bytes == 0 )
- throw new IllegalArgumentException("Invalid parameter specified: " + APIUtil.toHexString(param_name));
+ if ( bytes <= 1 )
+ return null;
final ByteBuffer buffer = APIUtil.getBufferByte(bytes);
clGetProgramBuildInfo(program, device, param_name, buffer, null);
@@ -435,8 +568,10 @@
private static int getBuildSizeRet(final CLProgram program, final CLDevice device, final int param_name) {
final PointerBuffer bytes = APIUtil.getBufferPointer();
final int errcode = clGetProgramBuildInfo(program, device, param_name, null, bytes);
+ if ( errcode != CL_SUCCESS )
+ throw new IllegalArgumentException("Invalid parameter specified: " + LWJGLUtil.toHexString(param_name));
- return errcode == CL_SUCCESS ? (int)bytes.get(0) : 0;
+ return (int)bytes.get(0);
}
}
Modified: trunk/LWJGL/src/java/org/lwjgl/opencl/Util.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opencl/Util.java 2010-09-28 21:11:35 UTC (rev 3418)
+++ trunk/LWJGL/src/java/org/lwjgl/opencl/Util.java 2010-09-30 17:21:50 UTC (rev 3419)
@@ -31,8 +31,9 @@
*/
package org.lwjgl.opencl;
+import org.lwjgl.LWJGLUtil;
+
import java.lang.reflect.Field;
-import java.util.HashMap;
import java.util.Map;
/**
@@ -43,21 +44,12 @@
public final class Util {
/** Maps OpenCL error token values to their String representations. */
- private static final Map<Integer, String> CL_ERROR_TOKENS = new HashMap<Integer, String>(64);
+ private static final Map<Integer, String> CL_ERROR_TOKENS = LWJGLUtil.getClassTokens(new LWJGLUtil.TokenFilter() {
+ public boolean accept(final Field field, final int value) {
+ return value < 0; // Currently, all OpenCL errors have negative values.
+ }
+ }, null, CL10.class, CL11.class, KHRGLSharing.class, KHRICD.class, APPLEGLSharing.class, EXTDeviceFission.class);
- static {
- APIUtil.getClassTokens(new Class[] {
- CL10.class, CL11.class,
- KHRGLSharing.class, KHRICD.class,
- APPLEGLSharing.class,
- EXTDeviceFission.class,
- }, CL_ERROR_TOKENS, new APIUtil.TokenFilter() {
- public boolean accept(final Field field, final int value) {
- return value < 0; // Currently, all OpenCL errors have negative values.
- }
- });
- }
-
private Util() {
}
@@ -70,7 +62,7 @@
String errname = CL_ERROR_TOKENS.get(errcode);
if ( errname == null )
errname = "UNKNOWN";
- throw new OpenCLException("Error Code: " + errname + " (" + APIUtil.toHexString(errcode) + ")");
+ throw new OpenCLException("Error Code: " + errname + " (" + LWJGLUtil.toHexString(errcode) + ")");
}
}
\ No newline at end of file
Added: trunk/LWJGL/src/java/org/lwjgl/opencl/api/CLBufferRegion.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opencl/api/CLBufferRegion.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/opencl/api/CLBufferRegion.java 2010-09-30 17:21:50 UTC (rev 3419)
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2002-2010 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opencl.api;
+
+import org.lwjgl.PointerBuffer;
+
+/**
+ * Simple container for cl_buffer_region struct values.
+ *
+ * @author Spasi
+ */
+public final class CLBufferRegion {
+
+ /** The cl_buffer_region struct size in bytes. */
+ public static final int STRUCT_SIZE = 2 * PointerBuffer.getPointerSize();
+
+ private final int origin;
+ private final int size;
+
+ public CLBufferRegion(final int origin, final int size) {
+ this.origin = origin;
+ this.size = size;
+ }
+
+ public int getOrigin() {
+ return origin;
+ }
+
+ public int getSize() {
+ return size;
+ }
+
+}
\ No newline at end of file
Added: trunk/LWJGL/src/java/org/lwjgl/opencl/api/CLImageFormat.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opencl/api/CLImageFormat.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/opencl/api/CLImageFormat.java 2010-09-30 17:21:50 UTC (rev 3419)
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2002-2010 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opencl.api;
+
+/**
+ * Simple container for cl_image_format struct values.
+ *
+ * @author Spasi
+ */
+public final class CLImageFormat {
+
+ /** The cl_image_format struct size in bytes. */
+ public static final int STRUCT_SIZE = 2 * 4;
+
+ private final int channelOrder;
+ private final int channelType;
+
+ public CLImageFormat(final int channelOrder, final int channelType) {
+ this.channelOrder = channelOrder;
+ this.channelType = channelType;
+ }
+
+ public int getChannelOrder() {
+ return channelOrder;
+ }
+
+ public int getChannelType() {
+ return channelType;
+ }
+
+}
\ No newline at end of file
Modified: trunk/LWJGL/src/java/org/lwjgl/test/opencl/gl/DemoFractal.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/test/opencl/gl/DemoFractal.java 2010-09-28 21:11:35 UTC (rev 3418)
+++ trunk/LWJGL/src/java/org/lwjgl/test/opencl/gl/DemoFractal.java 2010-09-30 17:21:50 UTC (rev 3419)
@@ -43,18 +43,23 @@
import org.lwjgl.util.ReadableColor;
import java.io.*;
+import java.nio.ByteBuffer;
import java.nio.IntBuffer;
+import java.util.HashSet;
import java.util.List;
+import java.util.Set;
import static java.lang.Math.*;
import static org.lwjgl.opencl.CL10.*;
import static org.lwjgl.opencl.CL10GL.*;
import static org.lwjgl.opencl.KHRGLEvent.*;
+import static org.lwjgl.opengl.AMDDebugOutput.*;
import static org.lwjgl.opengl.ARBCLEvent.*;
+import static org.lwjgl.opengl.ARBDebugOutput.*;
import static org.lwjgl.opengl.ARBSync.*;
import static org.lwjgl.opengl.GL11.*;
-import static org.lwjgl.opengl.GL12.*;
import static org.lwjgl.opengl.GL15.*;
+import static org.lwjgl.opengl.GL20.*;
import static org.lwjgl.opengl.GL21.*;
/*
@@ -118,25 +123,36 @@
// max number of used GPUs
private static final int MAX_PARALLELISM_LEVEL = 8;
- // max per pixel iterations to compute the fractal
- private static final int MAX_ITERATIONS = 500;
+ private static final int COLOR_MAP_SIZE = 32 * 2 * 4;
+ private Set<String> params;
+
private CLContext clContext;
private CLCommandQueue[] queues;
private CLKernel[] kernels;
private CLProgram[] programs;
- private CLMem[] pboBuffers;
- private IntBuffer pboIDs;
+ private CLMem[] glBuffers;
+ private IntBuffer glIDs;
+ private boolean useTextures;
+
+ // Texture rendering
+ private int dlist;
+ private int vsh;
+ private int fsh;
+ private int program;
+
private CLMem[] colorMap;
- private IntBuffer[] colorMapBuffer;
private final PointerBuffer kernel2DGlobalWorkSize;
- private int width;
- private int height;
+ // max per pixel iterations to compute the fractal
+ private int maxIterations = 500;
+ private int width = 512;
+ private int height = 512;
+
private double minX = -2f;
private double minY = -1.2f;
private double maxX = 0.6f;
@@ -174,135 +190,55 @@
private GLSync glSync;
private CLEvent glEvent;
- public DemoFractal(int width, int height) {
- kernel2DGlobalWorkSize = BufferUtils.createPointerBuffer(2);
+ public DemoFractal(final String[] args) {
+ params = new HashSet<String>();
- this.width = width;
- this.height = height;
- }
+ for ( int i = 0; i < args.length; i++ ) {
+ final String arg = args[i];
- private void run() {
- long startTime = System.currentTimeMillis() + 5000;
- long fps = 0;
+ if ( arg.charAt(0) != '-' && arg.charAt(0) != '/' )
+ throw new IllegalArgumentException("Invalid command-line argument: " + args[i]);
- while ( run ) {
- if ( !Display.isVisible() )
- Thread.yield();
+ final String param = arg.substring(1);
- handleIO();
- display();
+ if ( "forcePBO".equalsIgnoreCase(param) )
+ params.add("forcePBO");
+ else if ( "forceCPU".equalsIgnoreCase(param) )
+ params.add("forceCPU");
+ else if ( "debugGL".equalsIgnoreCase(param) )
+ params.add("debugGL");
+ else if ( "iterations".equalsIgnoreCase(param) ) {
+ if ( args.length < i + 1 + 1 )
+ throw new IllegalArgumentException("Invalid iterations argument specified.");
- Display.update();
- if ( Display.isCloseRequested() )
- break;
+ try {
+ this.maxIterations = Integer.parseInt(args[++i]);
+ } catch (NumberFormatException e) {
+ throw new IllegalArgumentException("Invalid number of iterations specified.");
+ }
+ } else if ( "res".equalsIgnoreCase(param) ) {
+ if ( args.length < i + 2 + 1 )
+ throw new IllegalArgumentException("Invalid res argument specified.");
- if ( startTime > System.currentTimeMillis() ) {
- fps++;
- } else {
- long timeUsed = 5000 + (startTime - System.currentTimeMillis());
- startTime = System.currentTimeMillis() + 5000;
- System.out.println(fps + " frames in 5 seconds = " + (fps / (timeUsed / 1000f)));
- fps = 0;
- }
- }
+ try {
+ this.width = Integer.parseInt(args[++i]);
+ this.height = Integer.parseInt(args[++i]);
- CL.destroy();
- Display.destroy();
- }
-
- private void handleIO() {
- if ( Keyboard.getNumKeyboardEvents() != 0 ) {
- while ( Keyboard.next() ) {
- if ( Keyboard.getEventKeyState() )
- continue;
-
- final int key = Keyboard.getEventKey();
-
- if ( Keyboard.KEY_1 <= key && key <= Keyboard.KEY_8 ) {
- int number = key - Keyboard.KEY_1 + 1;
- slices = min(number, min(queues.length, MAX_PARALLELISM_LEVEL));
- System.out.println("NEW PARALLELISM LEVEL: " + slices);
- buffersInitialized = false;
- } else {
- switch ( Keyboard.getEventKey() ) {
- case Keyboard.KEY_SPACE:
- drawSeparator = !drawSeparator;
- System.out.println("SEPARATOR DRAWING IS NOW: " + (drawSeparator ? "ON" : "OFF"));
- break;
- case Keyboard.KEY_D:
- doublePrecision = !doublePrecision;
- System.out.println("DOUBLE PRECISION IS NOW: " + (doublePrecision ? "ON" : "OFF"));
- rebuild = true;
- break;
- case Keyboard.KEY_HOME:
- minX = -2f;
- minY = -1.2f;
- maxX = 0.6f;
- maxY = 1.3f;
- break;
- case Keyboard.KEY_ESCAPE:
- run = false;
- break;
- }
+ if ( width < 1 || height < 1 )
+ throw new IllegalArgumentException("Invalid res dimensions specified.");
+ } catch (NumberFormatException e) {
+ throw new IllegalArgumentException("Invalid res dimensions specified.");
}
}
}
- while ( Mouse.next() ) {
- final int eventBtn = Mouse.getEventButton();
+ kernel2DGlobalWorkSize = BufferUtils.createPointerBuffer(2);
+ }
- final int x = Mouse.getX();
- final int y = Mouse.getY();
-
- if ( Mouse.isButtonDown(0) && (x != mouseX || y != mouseY) ) {
- if ( !dragging ) {
- dragging = true;
-
- dragX = mouseX;
- dragY = mouseY;
-
- dragMinX = minX;
- dragMinY = minY;
- dragMaxX = maxX;
- dragMaxY = maxY;
- }
-
- double offsetX = (x - dragX) * (maxX - minX) / width;
- double offsetY = (y - dragY) * (maxY - minY) / height;
-
- minX = dragMinX - offsetX;
- minY = dragMinY - offsetY;
-
- maxX = dragMaxX - offsetX;
- maxY = dragMaxY - offsetY;
- } else {
- if ( dragging )
- dragging = false;
-
- if ( eventBtn == -1 ) {
- final int dwheel = Mouse.getEventDWheel();
- if ( dwheel != 0 ) {
- double scale = dwheel > 0 ? 0.05 : -0.05;
-
- double deltaX = scale * (maxX - minX);
- double deltaY = scale * (maxY - minY);
-
- // offset for "zoom to cursor"
- double offsetX = (x / (double)width - 0.5) * deltaX * 2.0;
- double offsetY = (y / (double)height - 0.5) * deltaY * 2.0;
-
- minX += deltaX + offsetX;
- minY += deltaY - offsetY;
-
- maxX += -deltaX + offsetX;
- maxY += -deltaY - offsetY;
- }
- }
- }
-
- mouseX = x;
- mouseY = y;
- }
+ public static void main(String args[]) {
+ DemoFractal demo = new DemoFractal(args);
+ demo.init();
+ demo.run();
}
public void init() {
@@ -310,7 +246,8 @@
CL.create();
Display.setDisplayMode(new DisplayMode(width, height));
Display.setTitle("OpenCL Fractal Demo");
- Display.create();
+ Display.setSwapInterval(0);
+ Display.create(new PixelFormat(), new ContextAttribs().withDebug(params.contains("debugGL")));
} catch (LWJGLException e) {
throw new RuntimeException(e);
}
@@ -324,13 +261,12 @@
throw new RuntimeException(e);
}
- Display.setSwapInterval(0);
glDisable(GL_DEPTH_TEST);
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
initView(Display.getDisplayMode().getWidth(), Display.getDisplayMode().getHeight());
- initPBO();
+ initGLObjects();
glFinish();
setKernelConstants();
@@ -351,48 +287,40 @@
return caps.CL_KHR_gl_sharing;
}
};
- List<CLDevice> devices = platform.getDevices(CL_DEVICE_TYPE_GPU, glSharingFilter);
+ int device_type = params.contains("forceCPU") ? CL_DEVICE_TYPE_CPU : CL_DEVICE_TYPE_GPU;
+ List<CLDevice> devices = platform.getDevices(device_type, glSharingFilter);
if ( devices == null ) {
- devices = platform.getDevices(CL_DEVICE_TYPE_CPU, glSharingFilter);
+ device_type = CL_DEVICE_TYPE_CPU;
+ devices = platform.getDevices(device_type, glSharingFilter);
if ( devices == null )
throw new RuntimeException("No OpenCL devices found with KHR_gl_sharing support.");
}
// Create the context
- final PointerBuffer deviceIDs = BufferUtils.createPointerBuffer(devices.size());
- for ( CLDevice device : devices )
- deviceIDs.put(device);
- deviceIDs.flip();
+ clContext = CLContext.create(platform, devices, new CLContextCallback() {
+ protected void handleMessage(final String errinfo, final ByteBuffer private_info) {
+ System.out.println("[CONTEXT MESSAGE] " + errinfo);
+ }
+ }, drawable, null);
- final PointerBuffer contextProps = BufferUtils.createPointerBuffer(2 + 4 + 1);
- contextProps.put(CL_CONTEXT_PLATFORM).put(platform);
-
- drawable.setCLSharingProperties(contextProps); // Enable GL sharing
-
- contextProps.put(0);
- contextProps.flip();
- clContext = clCreateContext(contextProps, deviceIDs, null, null);
-
slices = min(devices.size(), MAX_PARALLELISM_LEVEL);
// create command queues for every GPU, setup colormap and init kernels
queues = new CLCommandQueue[slices];
kernels = new CLKernel[slices];
colorMap = new CLMem[slices];
- colorMapBuffer = new IntBuffer[slices];
for ( int i = 0; i < slices; i++ ) {
- colorMapBuffer[i] = BufferUtils.createIntBuffer(32 * 2);
- colorMap[i] = clCreateBuffer(clContext, CL_MEM_READ_ONLY, colorMapBuffer[i].capacity() * 4, null);
+ colorMap[i] = clCreateBuffer(clContext, CL_MEM_READ_ONLY, COLOR_MAP_SIZE, null);
colorMap[i].checkValid();
- initColorMap(colorMapBuffer[i], 32, Color.BLUE, Color.GREEN, Color.RED);
-
// create command queue and upload color map buffer on each used device
queues[i] = clCreateCommandQueue(clContext, devices.get(i), CL_QUEUE_PROFILING_ENABLE, null);
queues[i].checkValid();
- clEnqueueWriteBuffer(queues[i], colorMap[i], CL_TRUE, 0, colorMapBuffer[i], null, null); // blocking upload
+ final ByteBuffer colorMapBuffer = clEnqueueMapBuffer(queues[i], colorMap[i], CL_TRUE, CL_MAP_WRITE, 0, COLOR_MAP_SIZE, null, null, null);
+ initColorMap(colorMapBuffer.asIntBuffer(), 32, Color.BLUE, Color.GREEN, Color.RED);
+ clEnqueueUnmapMemObject(queues[i], colorMap[i], colorMapBuffer, null, null);
}
// check if we have 64bit FP support on all devices
@@ -411,25 +339,51 @@
// load program(s)
programs = new CLProgram[all64bit ? 1 : slices];
- buildPrograms();
-
final ContextCapabilities caps = GLContext.getCapabilities();
- System.out.println("OpenGL caps.OpenGL32 = " + caps.OpenGL32);
- System.out.println("OpenGL caps.GL_ARB_sync = " + caps.GL_ARB_sync);
+ if ( !caps.OpenGL20 )
+ throw new RuntimeException("OpenGL 2.0 is required to run this demo.");
+ else if ( device_type == CL_DEVICE_TYPE_CPU && !caps.OpenGL21 )
+ throw new RuntimeException("OpenGL 2.1 is required to run this demo.");
+
+ if ( caps.GL_ARB_debug_output )
+ glDebugMessageCallbackARB(new ARBDebugOutputCallback());
+ else if ( caps.GL_AMD_debug_output )
+ glDebugMessageCallbackAMD(new AMDDebugOutputCallback());
+
+ if ( device_type == CL_DEVICE_TYPE_GPU )
+ System.out.println("OpenCL Device Type: GPU (Use -forceCPU to use CPU)");
+ else
+ System.out.println("OpenCL Device Type: CPU");
+ for ( int i = 0; i < devices.size(); i++ )
+ System.out.println("OpenCL Device #" + (i + 1) + " supports KHR_gl_event = " + CLCapabilities.getDeviceCapabilities(devices.get(i)).CL_KHR_gl_event);
+
+ System.out.println("\nMax Iterations: " + maxIterations + " (Use -iterations <count> to change)");
+ System.out.println("Display resolution: " + width + "x" + height + " (Use -res <width> <height> to change)");
+
+ System.out.println("\nOpenGL caps.GL_ARB_sync = " + caps.GL_ARB_sync);
System.out.println("OpenGL caps.GL_ARB_cl_event = " + caps.GL_ARB_cl_event);
- for ( int i = 0; i < devices.size(); i++ ) {
- System.out.println("Device #" + (i + 1) + " supports KHR_gl_event = " + CLCapabilities.getDeviceCapabilities(devices.get(i)).CL_KHR_gl_event);
+
+ // Use PBO if we're on a CPU implementation
+ useTextures = device_type == CL_DEVICE_TYPE_GPU && (!caps.OpenGL21 || !params.contains("forcePBO"));
+ if ( useTextures ) {
+ System.out.println("\nCL/GL Sharing method: TEXTURES (use -forcePBO to use PBO + DrawPixels)");
+ System.out.println("Rendering method: Shader on a fullscreen quad");
+ } else {
+ System.out.println("\nCL/GL Sharing method: PIXEL BUFFER OBJECTS");
+ System.out.println("Rendering method: DrawPixels");
}
+ buildPrograms();
+
// Detect GLtoCL synchronization method
syncGLtoCL = caps.GL_ARB_cl_event; // GL3.2 or ARB_sync implied
if ( syncGLtoCL ) {
clEvents = new CLEvent[slices];
clSyncs = new GLSync[slices];
- System.out.println("GL to CL sync: Using OpenCL events");
+ System.out.println("\nGL to CL sync: Using OpenCL events");
} else
- System.out.println("GL to CL sync: Using clFinish");
+ System.out.println("\nGL to CL sync: Using clFinish");
// Detect CLtoGL synchronization method
syncCLtoGL = caps.OpenGL32 || caps.GL_ARB_sync;
@@ -445,92 +399,57 @@
System.out.println("CL to GL sync: Using OpenGL sync objects");
} else
System.out.println("CL to GL sync: Using glFinish");
- }
- private void createPrograms() throws IOException {
- final String source = getProgramSource("Mandelbrot.cl");
- for ( int i = 0; i < programs.length; i++ )
- programs[i] = clCreateProgramWithSource(clContext, source, null);
- }
+ if ( useTextures ) {
+ dlist = glGenLists(1);
- private String getProgramSource(final String file) throws IOException {
- InputStream source = getClass().getResourceAsStream(file);
- if ( source == null ) // dev-mode
- source = new FileInputStream("...
[truncated message content] |
|
From: <sp...@us...> - 2010-09-28 21:11:47
|
Revision: 3418
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3418&view=rev
Author: spasi
Date: 2010-09-28 21:11:35 +0000 (Tue, 28 Sep 2010)
Log Message:
-----------
Ported codebase to Java 1.5.
Misc OpenCL fixes and API improvements.
Changed fractal demo to use events/sync objects instead of cl/glFinish for synchronization. (untested)
Modified Paths:
--------------
trunk/LWJGL/build.xml
trunk/LWJGL/platform_build/build-generator.xml
trunk/LWJGL/src/java/org/lwjgl/BufferChecks.java
trunk/LWJGL/src/java/org/lwjgl/LWJGLUtil.java
trunk/LWJGL/src/java/org/lwjgl/LinuxSysImplementation.java
trunk/LWJGL/src/java/org/lwjgl/MacOSXSysImplementation.java
trunk/LWJGL/src/java/org/lwjgl/NondirectBufferWrapper.java
trunk/LWJGL/src/java/org/lwjgl/PointerBuffer.java
trunk/LWJGL/src/java/org/lwjgl/PointerWrapperAbstract.java
trunk/LWJGL/src/java/org/lwjgl/Sys.java
trunk/LWJGL/src/java/org/lwjgl/WindowsSysImplementation.java
trunk/LWJGL/src/java/org/lwjgl/examples/Game.java
trunk/LWJGL/src/java/org/lwjgl/examples/spaceinvaders/Entity.java
trunk/LWJGL/src/java/org/lwjgl/examples/spaceinvaders/Game.java
trunk/LWJGL/src/java/org/lwjgl/examples/spaceinvaders/GameApplet.java
trunk/LWJGL/src/java/org/lwjgl/examples/spaceinvaders/ShotEntity.java
trunk/LWJGL/src/java/org/lwjgl/examples/spaceinvaders/SoundManager.java
trunk/LWJGL/src/java/org/lwjgl/examples/spaceinvaders/Sprite.java
trunk/LWJGL/src/java/org/lwjgl/examples/spaceinvaders/Texture.java
trunk/LWJGL/src/java/org/lwjgl/examples/spaceinvaders/TextureLoader.java
trunk/LWJGL/src/java/org/lwjgl/input/Controller.java
trunk/LWJGL/src/java/org/lwjgl/input/ControllerEvent.java
trunk/LWJGL/src/java/org/lwjgl/input/Controllers.java
trunk/LWJGL/src/java/org/lwjgl/input/Cursor.java
trunk/LWJGL/src/java/org/lwjgl/input/JInputController.java
trunk/LWJGL/src/java/org/lwjgl/input/Keyboard.java
trunk/LWJGL/src/java/org/lwjgl/input/Mouse.java
trunk/LWJGL/src/java/org/lwjgl/input/OpenGLPackageAccess.java
trunk/LWJGL/src/java/org/lwjgl/openal/AL.java
trunk/LWJGL/src/java/org/lwjgl/openal/ALC10.java
trunk/LWJGL/src/java/org/lwjgl/openal/ALC11.java
trunk/LWJGL/src/java/org/lwjgl/openal/ALCcontext.java
trunk/LWJGL/src/java/org/lwjgl/openal/ALCdevice.java
trunk/LWJGL/src/java/org/lwjgl/openal/EFXUtil.java
trunk/LWJGL/src/java/org/lwjgl/opencl/APIUtil.java
trunk/LWJGL/src/java/org/lwjgl/opencl/APPLEContextLoggingUtil.java
trunk/LWJGL/src/java/org/lwjgl/opencl/CL.java
trunk/LWJGL/src/java/org/lwjgl/opencl/CLBuildProgramCallback.java
trunk/LWJGL/src/java/org/lwjgl/opencl/CLChecks.java
trunk/LWJGL/src/java/org/lwjgl/opencl/CLCommandQueue.java
trunk/LWJGL/src/java/org/lwjgl/opencl/CLContext.java
trunk/LWJGL/src/java/org/lwjgl/opencl/CLDevice.java
trunk/LWJGL/src/java/org/lwjgl/opencl/CLEvent.java
trunk/LWJGL/src/java/org/lwjgl/opencl/CLKernel.java
trunk/LWJGL/src/java/org/lwjgl/opencl/CLMem.java
trunk/LWJGL/src/java/org/lwjgl/opencl/CLObject.java
trunk/LWJGL/src/java/org/lwjgl/opencl/CLObjectChild.java
trunk/LWJGL/src/java/org/lwjgl/opencl/CLObjectRegistry.java
trunk/LWJGL/src/java/org/lwjgl/opencl/CLPlatform.java
trunk/LWJGL/src/java/org/lwjgl/opencl/CLProgram.java
trunk/LWJGL/src/java/org/lwjgl/opencl/CLSampler.java
trunk/LWJGL/src/java/org/lwjgl/opencl/Util.java
trunk/LWJGL/src/java/org/lwjgl/opengl/AMDDebugOutputCallback.java
trunk/LWJGL/src/java/org/lwjgl/opengl/APIUtil.java
trunk/LWJGL/src/java/org/lwjgl/opengl/ARBDebugOutputCallback.java
trunk/LWJGL/src/java/org/lwjgl/opengl/AWTGLCanvas.java
trunk/LWJGL/src/java/org/lwjgl/opengl/AWTSurfaceLock.java
trunk/LWJGL/src/java/org/lwjgl/opengl/AWTUtil.java
trunk/LWJGL/src/java/org/lwjgl/opengl/BaseReferences.java
trunk/LWJGL/src/java/org/lwjgl/opengl/CallbackUtil.java
trunk/LWJGL/src/java/org/lwjgl/opengl/Context.java
trunk/LWJGL/src/java/org/lwjgl/opengl/ContextAttribs.java
trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java
trunk/LWJGL/src/java/org/lwjgl/opengl/DisplayMode.java
trunk/LWJGL/src/java/org/lwjgl/opengl/GLChecks.java
trunk/LWJGL/src/java/org/lwjgl/opengl/GLContext.java
trunk/LWJGL/src/java/org/lwjgl/opengl/GLUConstants.java
trunk/LWJGL/src/java/org/lwjgl/opengl/GlobalLock.java
trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxCanvasImplementation.java
trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java
trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxEvent.java
trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxKeycodes.java
trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxMouse.java
trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXDisplay.java
trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXDisplayPeerInfo.java
trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXFrame.java
trunk/LWJGL/src/java/org/lwjgl/opengl/PeerInfo.java
trunk/LWJGL/src/java/org/lwjgl/opengl/ReferencesStack.java
trunk/LWJGL/src/java/org/lwjgl/opengl/RenderTexture.java
trunk/LWJGL/src/java/org/lwjgl/opengl/StateTracker.java
trunk/LWJGL/src/java/org/lwjgl/opengl/Util.java
trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsAWTGLCanvasPeerInfo.java
trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsCanvasImplementation.java
trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java
trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsKeyboard.java
trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsKeycodes.java
trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsRegistry.java
trunk/LWJGL/src/java/org/lwjgl/opengl/XRandR.java
trunk/LWJGL/src/java/org/lwjgl/test/DisplayTest.java
trunk/LWJGL/src/java/org/lwjgl/test/WindowCreationTest.java
trunk/LWJGL/src/java/org/lwjgl/test/applet/AppletLoaderTest.java
trunk/LWJGL/src/java/org/lwjgl/test/applet/GearsApplet.java
trunk/LWJGL/src/java/org/lwjgl/test/applet/OpenAL.java
trunk/LWJGL/src/java/org/lwjgl/test/applet/OpenGL.java
trunk/LWJGL/src/java/org/lwjgl/test/applet/Speed.java
trunk/LWJGL/src/java/org/lwjgl/test/applet/Test.java
trunk/LWJGL/src/java/org/lwjgl/test/glu/tessellation/TessCallback.java
trunk/LWJGL/src/java/org/lwjgl/test/glu/tessellation/TessellationTest.java
trunk/LWJGL/src/java/org/lwjgl/test/input/HWCursorTest.java
trunk/LWJGL/src/java/org/lwjgl/test/input/KeyboardTest.java
trunk/LWJGL/src/java/org/lwjgl/test/input/MouseCreationTest.java
trunk/LWJGL/src/java/org/lwjgl/test/input/MouseTest.java
trunk/LWJGL/src/java/org/lwjgl/test/input/TestControllers.java
trunk/LWJGL/src/java/org/lwjgl/test/openal/BasicTest.java
trunk/LWJGL/src/java/org/lwjgl/test/openal/OpenALInfo.java
trunk/LWJGL/src/java/org/lwjgl/test/openal/PositionTest.java
trunk/LWJGL/src/java/org/lwjgl/test/opencl/HelloOpenCL.java
trunk/LWJGL/src/java/org/lwjgl/test/opencl/gl/DemoFractal.java
trunk/LWJGL/src/java/org/lwjgl/test/opengl/FullScreenWindowedTest.java
trunk/LWJGL/src/java/org/lwjgl/test/opengl/Gears.java
trunk/LWJGL/src/java/org/lwjgl/test/opengl/PbufferTest.java
trunk/LWJGL/src/java/org/lwjgl/test/opengl/SyncTest.java
trunk/LWJGL/src/java/org/lwjgl/test/opengl/VBOIndexTest.java
trunk/LWJGL/src/java/org/lwjgl/test/opengl/VBOTest.java
trunk/LWJGL/src/java/org/lwjgl/test/opengl/VersionTest.java
trunk/LWJGL/src/java/org/lwjgl/test/opengl/awt/AWTGears.java
trunk/LWJGL/src/java/org/lwjgl/test/opengl/awt/AWTGearsCanvas.java
trunk/LWJGL/src/java/org/lwjgl/test/opengl/awt/AWTTest.java
trunk/LWJGL/src/java/org/lwjgl/test/opengl/awt/DemoBox.java
trunk/LWJGL/src/java/org/lwjgl/test/opengl/awt/DisplayParentTest.java
trunk/LWJGL/src/java/org/lwjgl/test/opengl/multithread/BackgroundLoadTest.java
trunk/LWJGL/src/java/org/lwjgl/test/opengl/multithread/BackgroundLoader.java
trunk/LWJGL/src/java/org/lwjgl/test/opengl/pbuffers/PbufferTest.java
trunk/LWJGL/src/java/org/lwjgl/test/opengl/pbuffers/UniqueRenderer.java
trunk/LWJGL/src/java/org/lwjgl/test/opengl/pbuffers/UniqueRendererRTT.java
trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/Shader.java
trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShaderFP.java
trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShaderFSH.java
trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShaderUNI.java
trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShaderVP.java
trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShaderVSH.java
trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShadersTest.java
trunk/LWJGL/src/java/org/lwjgl/util/Display.java
trunk/LWJGL/src/java/org/lwjgl/util/ReadableColor.java
trunk/LWJGL/src/java/org/lwjgl/util/ReadableDimension.java
trunk/LWJGL/src/java/org/lwjgl/util/ReadablePoint.java
trunk/LWJGL/src/java/org/lwjgl/util/ReadableRectangle.java
trunk/LWJGL/src/java/org/lwjgl/util/Renderable.java
trunk/LWJGL/src/java/org/lwjgl/util/Timer.java
trunk/LWJGL/src/java/org/lwjgl/util/WritableColor.java
trunk/LWJGL/src/java/org/lwjgl/util/WritableDimension.java
trunk/LWJGL/src/java/org/lwjgl/util/WritablePoint.java
trunk/LWJGL/src/java/org/lwjgl/util/WritableRectangle.java
trunk/LWJGL/src/java/org/lwjgl/util/XPMFile.java
trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorVisitor.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/Helper.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/NativeMethodStubsGenerator.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/RegisterStubsGenerator.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/Utils.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/opencl/CLCapabilitiesGenerator.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/opencl/CLGeneratorProcessorFactory.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/opencl/CLPDCapabilitiesGenerator.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/opengl/GLCapabilitiesGenerator.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/opengl/GLGeneratorProcessorFactory.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/opengl/GLReferencesGeneratorProcessorFactory.java
trunk/LWJGL/src/java/org/lwjgl/util/glu/Cylinder.java
trunk/LWJGL/src/java/org/lwjgl/util/glu/Disk.java
trunk/LWJGL/src/java/org/lwjgl/util/glu/GLU.java
trunk/LWJGL/src/java/org/lwjgl/util/glu/GLUtessellator.java
trunk/LWJGL/src/java/org/lwjgl/util/glu/GLUtessellatorCallback.java
trunk/LWJGL/src/java/org/lwjgl/util/glu/MipMap.java
trunk/LWJGL/src/java/org/lwjgl/util/glu/PartialDisk.java
trunk/LWJGL/src/java/org/lwjgl/util/glu/PixelStoreState.java
trunk/LWJGL/src/java/org/lwjgl/util/glu/Project.java
trunk/LWJGL/src/java/org/lwjgl/util/glu/Quadric.java
trunk/LWJGL/src/java/org/lwjgl/util/glu/Registry.java
trunk/LWJGL/src/java/org/lwjgl/util/glu/Sphere.java
trunk/LWJGL/src/java/org/lwjgl/util/glu/Util.java
trunk/LWJGL/src/java/org/lwjgl/util/glu/tessellation/GLUhalfEdge.java
trunk/LWJGL/src/java/org/lwjgl/util/glu/tessellation/GLUtessellatorImpl.java
trunk/LWJGL/src/java/org/lwjgl/util/glu/tessellation/Normal.java
trunk/LWJGL/src/java/org/lwjgl/util/glu/tessellation/PriorityQ.java
trunk/LWJGL/src/java/org/lwjgl/util/glu/tessellation/PriorityQHeap.java
trunk/LWJGL/src/java/org/lwjgl/util/glu/tessellation/PriorityQSort.java
trunk/LWJGL/src/java/org/lwjgl/util/glu/tessellation/Render.java
trunk/LWJGL/src/java/org/lwjgl/util/glu/tessellation/Sweep.java
trunk/LWJGL/src/java/org/lwjgl/util/jinput/KeyMap.java
trunk/LWJGL/src/java/org/lwjgl/util/jinput/LWJGLKeyboard.java
trunk/LWJGL/src/java/org/lwjgl/util/jinput/LWJGLMouse.java
trunk/LWJGL/src/java/org/lwjgl/util/vector/Matrix.java
trunk/LWJGL/src/java/org/lwjgl/util/vector/Matrix2f.java
trunk/LWJGL/src/java/org/lwjgl/util/vector/Matrix3f.java
trunk/LWJGL/src/java/org/lwjgl/util/vector/Matrix4f.java
trunk/LWJGL/src/java/org/lwjgl/util/vector/Quaternion.java
trunk/LWJGL/src/java/org/lwjgl/util/vector/ReadableVector.java
trunk/LWJGL/src/java/org/lwjgl/util/vector/ReadableVector2f.java
trunk/LWJGL/src/java/org/lwjgl/util/vector/ReadableVector3f.java
trunk/LWJGL/src/java/org/lwjgl/util/vector/ReadableVector4f.java
trunk/LWJGL/src/java/org/lwjgl/util/vector/Vector.java
trunk/LWJGL/src/java/org/lwjgl/util/vector/Vector2f.java
trunk/LWJGL/src/java/org/lwjgl/util/vector/Vector3f.java
trunk/LWJGL/src/java/org/lwjgl/util/vector/WritableVector2f.java
trunk/LWJGL/src/java/org/lwjgl/util/vector/WritableVector3f.java
trunk/LWJGL/src/java/org/lwjgl/util/vector/WritableVector4f.java
trunk/LWJGL/src/native/common/extcl_types.h
trunk/LWJGL/src/native/common/org_lwjgl_opencl_CL.c
trunk/LWJGL/src/native/common/org_lwjgl_opencl_CL.h
trunk/LWJGL/src/templates/org/lwjgl/opencl/CL10.java
trunk/LWJGL/src/templates/org/lwjgl/opencl/KHR_icd.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_sync.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/GL32.java
Added Paths:
-----------
trunk/LWJGL/src/java/org/lwjgl/opencl/CLObjectRetainable.java
trunk/LWJGL/src/java/org/lwjgl/opencl/InfoUtil.java
trunk/LWJGL/src/java/org/lwjgl/opencl/InfoUtilAbstract.java
trunk/LWJGL/src/java/org/lwjgl/opencl/InfoUtilFactory.java
trunk/LWJGL/src/templates/org/lwjgl/opencl/AMD_event_callback.java
trunk/LWJGL/src/templates/org/lwjgl/opencl/KHR_d3d10_sharing.java
Removed Paths:
-------------
trunk/LWJGL/src/java/org/lwjgl/opencl/CLDeviceImpl.java
trunk/LWJGL/src/java/org/lwjgl/opencl/CLKernelImpl.java
trunk/LWJGL/src/java/org/lwjgl/opencl/CLPlatformImpl.java
Modified: trunk/LWJGL/build.xml
===================================================================
--- trunk/LWJGL/build.xml 2010-09-27 12:09:52 UTC (rev 3417)
+++ trunk/LWJGL/build.xml 2010-09-28 21:11:35 UTC (rev 3418)
@@ -16,74 +16,88 @@
<!-- Initialize build -->
<!-- ================================================================== -->
<target name="-initialize">
- <mkdir dir="${lwjgl.bin}" taskname="initialiazing bin folder" />
- <mkdir dir="${lwjgl.bin}/lwjgl" taskname="initialiazing bin folder" />
- <mkdir dir="${lwjgl.lib}" taskname="initialiazing lib folder" />
- <mkdir dir="${lwjgl.dist}" taskname="initialiazing dist folder" />
- <mkdir dir="${lwjgl.docs}/javadoc" taskname="initialiazing docs folder" />
- <mkdir dir="${lwjgl.res}" taskname="initialiazing res folder" />
- <mkdir dir="${lwjgl.temp}" taskname="initialiazing temp folder" />
- <mkdir dir="${lwjgl.temp}/jar" taskname="initialiazing temp/jar folder" />
- <mkdir dir="${lwjgl.temp}/doc" taskname="initialiazing temp/doc folder" />
- <mkdir dir="${lwjgl.temp}/res" taskname="initialiazing temp/res folder" />
- <mkdir dir="${lwjgl.temp}/native" taskname="initialiazing temp/native folder" />
- <mkdir dir="${lwjgl.temp}/native/windows" taskname="initialiazing temp/windows folder" />
- <mkdir dir="${lwjgl.temp}/native/linux" taskname="initialiazing temp/linux folder" />
- <mkdir dir="${lwjgl.temp}/native/macosx" taskname="initialiazing temp/macosx folder" />
- <mkdir dir="${lwjgl.temp}/native/solaris" taskname="initialiazing temp/solaris folder" />
+ <mkdir dir="${lwjgl.bin}" taskname="initialiazing bin folder" />
+ <mkdir dir="${lwjgl.bin}/lwjgl" taskname="initialiazing native bin folder" />
+ <mkdir dir="${lwjgl.lib}" taskname="initialiazing lib folder" />
+ <mkdir dir="${lwjgl.dist}" taskname="initialiazing dist folder" />
+ <mkdir dir="${lwjgl.docs}/javadoc" taskname="initialiazing docs folder" />
+ <mkdir dir="${lwjgl.res}" taskname="initialiazing res folder" />
+ <mkdir dir="${lwjgl.temp}" taskname="initialiazing temp folder" />
+ <mkdir dir="${lwjgl.temp}/jar" taskname="initialiazing temp/jar folder" />
+ <mkdir dir="${lwjgl.temp}/doc" taskname="initialiazing temp/doc folder" />
+ <mkdir dir="${lwjgl.temp}/res" taskname="initialiazing temp/res folder" />
+ <mkdir dir="${lwjgl.temp}/native" taskname="initialiazing temp/native folder" />
+ <mkdir dir="${lwjgl.temp}/native/windows" taskname="initialiazing temp/windows folder" />
+ <mkdir dir="${lwjgl.temp}/native/linux" taskname="initialiazing temp/linux folder" />
+ <mkdir dir="${lwjgl.temp}/native/macosx" taskname="initialiazing temp/macosx folder" />
+ <mkdir dir="${lwjgl.temp}/native/solaris" taskname="initialiazing temp/solaris folder" />
</target>
<!-- Cleans up any files created during the execution of this script -->
<target name="clean" description="Cleans the directories controlled by this ant script" depends="clean-generated">
<delete dir="${lwjgl.temp}" quiet="true" failonerror="false" taskname="cleaning temp folder" />
<delete dir="${lwjgl.docs}/javadoc" quiet="true" failonerror="false" taskname="cleaning javadoc folder" />
- <delete dir="${lwjgl.bin}" quiet="true" failonerror="false" taskname="cleaning bin folder" />
+ <!-- Delete java classes only to avoid unnecessary native recompilation -->
+ <delete dir="${lwjgl.bin}/org" quiet="true" failonerror="false" taskname="cleaning bin folder" />
</target>
+ <!-- Useful when we need to force native recompilation -->
+ <target name="clean-native" description="Cleans bin folder's native directory" depends="clean-generated-native">
+ <delete dir="${lwjgl.bin}/lwjgl" quiet="true" failonerror="false" taskname="cleaning native bin folder" />
+ <mkdir dir="${lwjgl.bin}/lwjgl" taskname="initialiazing native bin folder" />
+ </target>
+
+ <target name="clean-all" depends="clean, clean-generated-native" description="Cleans all directories controlled by this ant script">
+ <delete dir="${lwjgl.bin}/lwjgl" quiet="true" failonerror="false" taskname="cleaning native bin folder" />
+ </target>
+
<!-- Creates a distribution of LWJGL -->
<target name="release" description="Creates a distribution of LWJGL using supplied native binaries">
<!-- Warn user -->
<echo message="Before running the release target, please manually compile all platforms and place required files in ${lwjgl.lib}/windows, ${lwjgl.lib}/linux and ${lwjgl.lib}/macosx${line.separator}Missing files will result in a successfull built, but with incomplete release zips"/>
- <input
- message="All data in the ${lwjgl.dist} folder will be deleted. Continue? "
- validargs="yes,no"
- addproperty="do.delete"
- />
- <condition property="do.abort">
- <equals arg1="no" arg2="${do.delete}"/>
- </condition>
- <fail if="do.abort">Build aborted by user.</fail>
+ <input
+ message="All data in the ${lwjgl.dist} folder will be deleted. Continue? "
+ validargs="yes,no"
+ addproperty="do.delete"
+ />
+ <condition property="do.abort">
+ <equals arg1="no" arg2="${do.delete}"/>
+ </condition>
+ <fail if="do.abort">Build aborted by user.</fail>
- <!-- prepare -->
- <delete dir="${lwjgl.dist}" quiet="true" failonerror="false" />
- <antcall target="clean" />
- <antcall target="-initialize" />
+ <!-- prepare -->
+ <delete dir="${lwjgl.dist}" quiet="true" failonerror="false" />
+ <antcall target="clean" />
+ <antcall target="-initialize" />
- <!-- compile and create jars -->
- <antcall target="generate-debug"/>
- <antcall target="compile" />
- <antcall target="-createdebugjars" />
+ <!-- compile and create debug jars -->
+ <antcall target="generate-debug" />
+ <antcall target="compile" />
+ <antcall target="-createdebugjars" />
+
<!-- Generator will skip all templates if we don't clean -->
- <delete dir="${lwjgl.bin}" quiet="true" failonerror="false" taskname="cleaning bin folder" />
- <mkdir dir="${lwjgl.bin}" taskname="initialiazing bin folder" />
- <antcall target="generate-all"/>
- <antcall target="compile" />
- <antcall target="-createjars" />
- <antcall target="-jars_NoDEP" />
- <antcall target="javadoc" />
- <antcall target="applet-release" />
+ <delete dir="${lwjgl.bin}/org" quiet="true" failonerror="false" taskname="cleaning bin folder" />
- <!-- copy resources to res folder -->
- <copy todir="${lwjgl.temp}/res">
- <fileset dir="res"/>
- </copy>
+ <!-- compile and create jars -->
+ <antcall target="generate-all" />
+ <antcall target="compile" />
+ <antcall target="-createjars" />
- <!-- copy docs -->
+ <antcall target="-jars_NoDEP" />
+ <antcall target="javadoc" />
+ <antcall target="applet-release" />
+
+ <!-- copy resources to res folder -->
+ <copy todir="${lwjgl.temp}/res">
+ <fileset dir="res"/>
+ </copy>
+
+ <!-- copy docs -->
<copy todir="${lwjgl.temp}/doc">
<fileset dir="${lwjgl.docs}">
<patternset refid="lwjgl-docs.fileset" />
</fileset>
- </copy>
+ </copy>
<!-- create distribution from files in libs/ and temp/ -->
<antcall target="-distribution_javadoc" />
@@ -219,7 +233,7 @@
<class name="org.lwjgl.opengl.LinuxContextImplementation" />
<class name="org.lwjgl.opengl.LinuxCanvasImplementation" />
</javah>
-
+
<javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.native}/windows" force="yes">
<class name="org.lwjgl.opengl.WindowsKeyboard" />
<class name="org.lwjgl.opengl.WindowsPbufferPeerInfo" />
@@ -231,7 +245,7 @@
<class name="org.lwjgl.opengl.WindowsDisplayPeerInfo" />
<class name="org.lwjgl.opengl.WindowsContextImplementation" />
</javah>
-
+
<javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.native}/macosx" force="yes">
<class name="org.lwjgl.MacOSXSysImplementation" />
<class name="org.lwjgl.opengl.MacOSXMouseEventQueue" />
@@ -241,7 +255,7 @@
<class name="org.lwjgl.opengl.MacOSXDisplay" />
<class name="org.lwjgl.opengl.MacOSXContextImplementation" />
</javah>
-
+
<javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.headers}" force="yes">
<class name="org.lwjgl.opengl.AWTSurfaceLock" />
<class name="org.lwjgl.DefaultSysImplementation" />
@@ -342,6 +356,7 @@
<!-- Compiles the Java source code -->
<target name="compile" description="Compiles the java source code" depends="-initialize">
<javac debug="yes" destdir="${lwjgl.bin}" source="1.5" target="1.5" classpath="${lwjgl.lib}/jinput.jar:${lwjgl.lib}/AppleJavaExtensions.jar" taskname="core">
+ <!--<compilerarg value="-Xlint:unchecked"/>-->
<src path="${lwjgl.src}/java/"/>
<src path="${lwjgl.src}/generated/"/>
<include name="org/lwjgl/*.java"/>
@@ -493,7 +508,7 @@
<!-- Creates the Javadoc -->
<target name="javadoc" description="Creates javadoc from java source code">
- <javadoc destdir="${lwjgl.docs}/javadoc" classpath="${lwjgl.lib}/jinput.jar" author="true" version="true" use="true" source="1.4" windowtitle="LWJGL API" useexternalfile="true">
+ <javadoc destdir="${lwjgl.docs}/javadoc" classpath="${lwjgl.lib}/jinput.jar" author="true" version="true" use="true" source="1.5" windowtitle="LWJGL API" useexternalfile="true">
<fileset refid="lwjgl.javadoc.fileset" />
<doctitle><![CDATA[<h1>Lightweight Java Game Toolkit</h1>]]></doctitle>
<bottom><![CDATA[<i>Copyright © 2002-2009 lwjgl.org. All Rights Reserved.</i>]]></bottom>
Modified: trunk/LWJGL/platform_build/build-generator.xml
===================================================================
--- trunk/LWJGL/platform_build/build-generator.xml 2010-09-27 12:09:52 UTC (rev 3417)
+++ trunk/LWJGL/platform_build/build-generator.xml 2010-09-28 21:11:35 UTC (rev 3418)
@@ -1,13 +1,18 @@
<project name="generator">
<!-- clean the generated files -->
- <target name="clean-generated" description="Deletes the generated java and native source">
+ <target name="clean-generated" description="Deletes the generated java source">
<delete quiet="true" failonerror="false">
<fileset dir="${lwjgl.src}/generated" includes="**"/>
- <fileset dir="${lwjgl.src.native}/generated" includes="**"/>
</delete>
</target>
+ <target name="clean-generated-native" description="Deletes the generated native source">
+ <delete quiet="true" failonerror="false">
+ <fileset dir="${lwjgl.src.native}/generated" includes="**"/>
+ </delete>
+ </target>
+
<!-- Compiles the Java generator source code -->
<target name="generators" description="Compiles the native method generators">
<javac debug="yes" srcdir="${lwjgl.src}/java/" destdir="${lwjgl.bin}" includes="org/lwjgl/util/generator/**.java" source="1.5" target="1.5" taskname="generator">
Modified: trunk/LWJGL/src/java/org/lwjgl/BufferChecks.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/BufferChecks.java 2010-09-27 12:09:52 UTC (rev 3417)
+++ trunk/LWJGL/src/java/org/lwjgl/BufferChecks.java 2010-09-28 21:11:35 UTC (rev 3418)
@@ -157,7 +157,7 @@
}
public static void checkArray(Object[] array) {
- if ( LWJGLUtil.CHECKS && array == null )
+ if ( LWJGLUtil.CHECKS && (array == null || array.length == 0) )
throw new IllegalArgumentException("Invalid array");
}
Modified: trunk/LWJGL/src/java/org/lwjgl/LWJGLUtil.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/LWJGLUtil.java 2010-09-27 12:09:52 UTC (rev 3417)
+++ trunk/LWJGL/src/java/org/lwjgl/LWJGLUtil.java 2010-09-28 21:11:35 UTC (rev 3418)
@@ -338,7 +338,7 @@
*/
public static String[] getLibraryPaths(String libname, String[] platform_lib_names, ClassLoader classloader) {
// need to pass path of possible locations of library to native side
- List possible_paths = new ArrayList();
+ List<String> possible_paths = new ArrayList<String>();
String classloader_path = getPathFromClassLoader(libname, classloader);
if (classloader_path != null) {
@@ -346,18 +346,17 @@
possible_paths.add(classloader_path);
}
- for (int i = 0; i < platform_lib_names.length; i++) {
- String platform_lib_name = platform_lib_names[i];
+ for ( String platform_lib_name : platform_lib_names ) {
String lwjgl_classloader_path = getPathFromClassLoader("lwjgl", classloader);
- if (lwjgl_classloader_path != null) {
+ if ( lwjgl_classloader_path != null ) {
log("getPathFromClassLoader: Path found: " + lwjgl_classloader_path);
possible_paths.add(lwjgl_classloader_path.substring(0, lwjgl_classloader_path.lastIndexOf(File.separator))
- + File.separator + platform_lib_name);
+ + File.separator + platform_lib_name);
}
// add Installer path
String alternative_path = getPrivilegedProperty("org.lwjgl.librarypath");
- if (alternative_path != null) {
+ if ( alternative_path != null ) {
possible_paths.add(alternative_path + File.separator + platform_lib_name);
}
@@ -365,7 +364,7 @@
String java_library_path = getPrivilegedProperty("java.library.path");
StringTokenizer st = new StringTokenizer(java_library_path, File.pathSeparator);
- while (st.hasMoreTokens()) {
+ while ( st.hasMoreTokens() ) {
String path = st.nextToken();
possible_paths.add(path + File.separator + platform_lib_name);
}
@@ -379,15 +378,13 @@
}
//create needed string array
- String[] paths = new String[possible_paths.size()];
- possible_paths.toArray(paths);
- return paths;
+ return possible_paths.toArray(new String[possible_paths.size()]);
}
static void execPrivileged(final String[] cmd_array) throws Exception {
try {
- Process process = (Process)AccessController.doPrivileged(new PrivilegedExceptionAction() {
- public Object run() throws Exception {
+ Process process = AccessController.doPrivileged(new PrivilegedExceptionAction<Process>() {
+ public Process run() throws Exception {
return Runtime.getRuntime().exec(cmd_array);
}
});
@@ -401,8 +398,8 @@
}
private static String getPrivilegedProperty(final String property_name) {
- return (String)AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
+ return AccessController.doPrivileged(new PrivilegedAction<String>() {
+ public String run() {
return System.getProperty(property_name);
}
});
@@ -422,16 +419,15 @@
private static String getPathFromClassLoader(final String libname, final ClassLoader classloader) {
try {
log("getPathFromClassLoader: searching for: " + libname);
- Class c = classloader.getClass();
+ Class<?> c = classloader.getClass();
while (c != null) {
- final Class clazz = c;
+ final Class<?> clazz = c;
try {
- return (String)AccessController.doPrivileged(new PrivilegedExceptionAction() {
- public Object run() throws Exception {
- Method findLibrary = clazz.getDeclaredMethod("findLibrary", new Class[]{String.class});
+ return AccessController.doPrivileged(new PrivilegedExceptionAction<String>() {
+ public String run() throws Exception {
+ Method findLibrary = clazz.getDeclaredMethod("findLibrary", String.class);
findLibrary.setAccessible(true);
- Object[] arguments = new Object[] {libname};
- String path = (String)findLibrary.invoke(classloader, arguments);
+ String path = (String)findLibrary.invoke(classloader, libname);
return path;
}
});
@@ -450,12 +446,12 @@
* Gets a boolean property as a privileged action.
*/
private static boolean getPrivilegedBoolean(final String property_name) {
- Boolean value = (Boolean)AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- return new Boolean(Boolean.getBoolean(property_name));
+ Boolean value = AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
+ public Boolean run() {
+ return Boolean.getBoolean(property_name);
}
});
- return value.booleanValue();
+ return value;
}
/**
Modified: trunk/LWJGL/src/java/org/lwjgl/LinuxSysImplementation.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/LinuxSysImplementation.java 2010-09-27 12:09:52 UTC (rev 3417)
+++ trunk/LWJGL/src/java/org/lwjgl/LinuxSysImplementation.java 2010-09-28 21:11:35 UTC (rev 3418)
@@ -39,7 +39,7 @@
* $Id$
*/
final class LinuxSysImplementation extends J2SESysImplementation {
- private final static int JNI_VERSION = 19;
+ private static final int JNI_VERSION = 19;
static {
java.awt.Toolkit.getDefaultToolkit(); // This will make sure libjawt.so is loaded
@@ -55,8 +55,7 @@
String[] browsers = {"xdg-open", "firefox", "mozilla", "opera", "konqueror", "nautilus", "galeon", "netscape"};
- for (int i = 0; i < browsers.length; i ++) {
- final String browser = browsers[i];
+ for ( final String browser : browsers ) {
try {
LWJGLUtil.execPrivileged(new String[] { browser, url });
return true;
Modified: trunk/LWJGL/src/java/org/lwjgl/MacOSXSysImplementation.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/MacOSXSysImplementation.java 2010-09-27 12:09:52 UTC (rev 3417)
+++ trunk/LWJGL/src/java/org/lwjgl/MacOSXSysImplementation.java 2010-09-28 21:11:35 UTC (rev 3418)
@@ -42,7 +42,7 @@
* $Id$
*/
final class MacOSXSysImplementation extends J2SESysImplementation {
- private final static int JNI_VERSION = 19;
+ private static final int JNI_VERSION = 19;
static {
// Make sure AWT is properly initialized. This avoids hangs on Mac OS X 10.3
Modified: trunk/LWJGL/src/java/org/lwjgl/NondirectBufferWrapper.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/NondirectBufferWrapper.java 2010-09-27 12:09:52 UTC (rev 3417)
+++ trunk/LWJGL/src/java/org/lwjgl/NondirectBufferWrapper.java 2010-09-28 21:11:35 UTC (rev 3418)
@@ -49,16 +49,16 @@
* $Id: BufferChecks.java 2762 2007-04-11 16:13:05Z elias_naur $
*/
public final class NondirectBufferWrapper {
- private final static int INITIAL_BUFFER_SIZE = 1;
+ private static final int INITIAL_BUFFER_SIZE = 1;
- private final static ThreadLocal thread_buffer = new ThreadLocal() {
- protected Object initialValue() {
+ private static final ThreadLocal<CachedBuffers> thread_buffer = new ThreadLocal<CachedBuffers>() {
+ protected CachedBuffers initialValue() {
return new CachedBuffers(INITIAL_BUFFER_SIZE);
}
};
private static CachedBuffers getCachedBuffers(int minimum_byte_size) {
- CachedBuffers buffers = (CachedBuffers)thread_buffer.get();
+ CachedBuffers buffers = thread_buffer.get();
int current_byte_size = buffers.byte_buffer.capacity();
if (minimum_byte_size > current_byte_size) {
buffers = new CachedBuffers(minimum_byte_size);
@@ -378,7 +378,7 @@
return direct_buffer;
}
- private final static class CachedBuffers {
+ private static final class CachedBuffers {
private final ByteBuffer byte_buffer;
private final ShortBuffer short_buffer_big;
private final IntBuffer int_buffer_big;
Modified: trunk/LWJGL/src/java/org/lwjgl/PointerBuffer.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/PointerBuffer.java 2010-09-27 12:09:52 UTC (rev 3417)
+++ trunk/LWJGL/src/java/org/lwjgl/PointerBuffer.java 2010-09-28 21:11:35 UTC (rev 3418)
@@ -49,7 +49,7 @@
boolean is64 = false;
try {
Method m = Class.forName("org.lwjgl.Sys").getDeclaredMethod("is64Bit", (Class[])null);
- is64 = ((Boolean)m.invoke(null, (Object[])null)).booleanValue();
+ is64 = (Boolean)m.invoke(null, (Object[])null);
} catch (Throwable t) {
// ignore
} finally {
@@ -63,10 +63,22 @@
protected final IntBuffer view32;
protected final LongBuffer view64;
+ /**
+ * Creates a new PointerBuffer with the specified capacity.
+ *
+ * @param capacity the PointerBuffer size, in number of pointers
+ */
public PointerBuffer(final int capacity) {
this(BufferUtils.createByteBuffer(capacity * getPointerSize()));
}
+ /**
+ * Creates a new PointerBuffer using the specified ByteBuffer as its pointer
+ * data source. This is useful for users that do their own memory management
+ * over a big ByteBuffer, instead of allocating many small ones.
+ *
+ * @param source the source buffer
+ */
public PointerBuffer(final ByteBuffer source) {
if ( !source.isDirect() )
throw new IllegalArgumentException("ByteBuffer is not direct");
@@ -91,6 +103,11 @@
return pointers;
}
+ /** Returns true if the underlying architecture is 64bit. */
+ public static boolean is64Bit() {
+ return is64Bit;
+ }
+
/**
* Returns the pointer size in bytes, based on the underlying architecture.
*
@@ -769,7 +786,7 @@
* @return A summary string
*/
public String toString() {
- StringBuffer sb = new StringBuffer(48);
+ StringBuilder sb = new StringBuilder(48);
sb.append(getClass().getName());
sb.append("[pos=");
sb.append(position());
Modified: trunk/LWJGL/src/java/org/lwjgl/PointerWrapperAbstract.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/PointerWrapperAbstract.java 2010-09-27 12:09:52 UTC (rev 3417)
+++ trunk/LWJGL/src/java/org/lwjgl/PointerWrapperAbstract.java 2010-09-28 21:11:35 UTC (rev 3418)
@@ -44,16 +44,30 @@
this.pointer = pointer;
}
- public final boolean isNull() {
- return pointer == 0;
+ /**
+ * Returns true if this object represents a valid pointer.
+ * The pointer might be invalid because it is NULL or because
+ * some other action has deleted the object that this pointer
+ * represents.
+ *
+ * @return true if the pointer is valid
+ */
+ public boolean isValid() {
+ return pointer != 0;
}
- public final void checkNull() {
- if ( LWJGLUtil.DEBUG && pointer == 0 )
- throw new IllegalStateException("This pointer is null.");
+ /**
+ * Checks if the pointer is valid and throws an IllegalStateException if
+ * it is not. This method is a NO-OP, unless the org.lwjgl.util.Debug
+ * property has been set to true.
+ */
+ public final void checkValid() {
+ if ( LWJGLUtil.DEBUG && !isValid() )
+ throw new IllegalStateException("This pointer is not valid.");
}
- public long getPointer() {
+ public final long getPointer() {
+ checkValid();
return pointer;
}
@@ -72,4 +86,7 @@
return (int)(pointer ^ (pointer >>> 32));
}
+ public String toString() {
+ return getClass().getSimpleName() + " pointer (0x" + Long.toHexString(pointer) + ")";
+ }
}
\ No newline at end of file
Modified: trunk/LWJGL/src/java/org/lwjgl/Sys.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/Sys.java 2010-09-27 12:09:52 UTC (rev 3417)
+++ trunk/LWJGL/src/java/org/lwjgl/Sys.java 2010-09-28 21:11:35 UTC (rev 3418)
@@ -63,7 +63,7 @@
private static final boolean is64Bit;
private static void doLoadLibrary(final String lib_name) {
- AccessController.doPrivileged(new PrivilegedAction() {
+ AccessController.doPrivileged(new PrivilegedAction<Object>() {
public Object run() {
String library_path = System.getProperty("org.lwjgl.librarypath");
if (library_path != null) {
@@ -215,22 +215,22 @@
// Attempt to use Webstart if we have it available
try {
// Lookup the javax.jnlp.BasicService object
- final Class serviceManagerClass = Class.forName("javax.jnlp.ServiceManager");
- Method lookupMethod = (Method)AccessController.doPrivileged(new PrivilegedExceptionAction() {
- public Object run() throws Exception {
- return serviceManagerClass.getMethod("lookup", new Class[] {String.class});
+ final Class<?> serviceManagerClass = Class.forName("javax.jnlp.ServiceManager");
+ Method lookupMethod = AccessController.doPrivileged(new PrivilegedExceptionAction<Method>() {
+ public Method run() throws Exception {
+ return serviceManagerClass.getMethod("lookup", String.class);
}
});
Object basicService = lookupMethod.invoke(serviceManagerClass, new Object[] {"javax.jnlp.BasicService"});
- final Class basicServiceClass = Class.forName("javax.jnlp.BasicService");
- Method showDocumentMethod = (Method)AccessController.doPrivileged(new PrivilegedExceptionAction() {
- public Object run() throws Exception {
- return basicServiceClass.getMethod("showDocument", new Class[] {URL.class});
+ final Class<?> basicServiceClass = Class.forName("javax.jnlp.BasicService");
+ Method showDocumentMethod = AccessController.doPrivileged(new PrivilegedExceptionAction<Method>() {
+ public Method run() throws Exception {
+ return basicServiceClass.getMethod("showDocument", URL.class);
}
});
try {
- Boolean ret = (Boolean) showDocumentMethod.invoke(basicService, new Object[] {new URL(url)});
- return ret.booleanValue();
+ Boolean ret = (Boolean)showDocumentMethod.invoke(basicService, new URL(url));
+ return ret;
} catch (MalformedURLException e) {
e.printStackTrace(System.err);
return false;
Modified: trunk/LWJGL/src/java/org/lwjgl/WindowsSysImplementation.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/WindowsSysImplementation.java 2010-09-27 12:09:52 UTC (rev 3417)
+++ trunk/LWJGL/src/java/org/lwjgl/WindowsSysImplementation.java 2010-09-28 21:11:35 UTC (rev 3418)
@@ -45,12 +45,12 @@
* $Id$
*/
final class WindowsSysImplementation extends DefaultSysImplementation {
- private final static int JNI_VERSION = 23;
+ private static final int JNI_VERSION = 23;
static {
Sys.initialize();
}
-
+
public int getRequiredJNIVersion() {
return JNI_VERSION;
}
@@ -64,7 +64,7 @@
}
private static native long nGetTime();
- public final boolean has64Bit() {
+ public boolean has64Bit() {
return true;
}
@@ -75,19 +75,17 @@
* public
*/
try {
- Long hwnd_obj = (Long)AccessController.doPrivileged(new PrivilegedExceptionAction() {
- public Object run() throws Exception {
- Method getImplementation_method = Display.class.getDeclaredMethod("getImplementation", null);
+ return AccessController.doPrivileged(new PrivilegedExceptionAction<Long>() {
+ public Long run() throws Exception {
+ Method getImplementation_method = Display.class.getDeclaredMethod("getImplementation");
getImplementation_method.setAccessible(true);
- Object display_impl = getImplementation_method.invoke(null, null);
- Class WindowsDisplay_class = Class.forName("org.lwjgl.opengl.WindowsDisplay");
- Method getHwnd_method = WindowsDisplay_class.getDeclaredMethod("getHwnd", null);
+ Object display_impl = getImplementation_method.invoke(null);
+ Class<?> WindowsDisplay_class = Class.forName("org.lwjgl.opengl.WindowsDisplay");
+ Method getHwnd_method = WindowsDisplay_class.getDeclaredMethod("getHwnd");
getHwnd_method.setAccessible(true);
- Long hwnd = (Long)getHwnd_method.invoke(display_impl, null);
- return hwnd;
+ return (Long)getHwnd_method.invoke(display_impl);
}
});
- return hwnd_obj.longValue();
} catch (PrivilegedActionException e) {
throw new Error(e);
}
Modified: trunk/LWJGL/src/java/org/lwjgl/examples/Game.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/examples/Game.java 2010-09-27 12:09:52 UTC (rev 3417)
+++ trunk/LWJGL/src/java/org/lwjgl/examples/Game.java 2010-09-28 21:11:35 UTC (rev 3418)
@@ -1,31 +1,31 @@
-/*
+/*
* Copyright (c) 2002-2008 LWJGL Project
* All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
+ * modification, are permitted provided that the following conditions are
* met:
- *
- * * Redistributions of source code must retain the above copyright
+ *
+ * * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * * Neither the name of 'LWJGL' nor the names of
- * its contributors may be used to endorse or promote products derived
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
@@ -35,8 +35,9 @@
import org.lwjgl.input.Keyboard;
import org.lwjgl.openal.AL;
import org.lwjgl.opengl.Display;
-import org.lwjgl.opengl.GL11;
+import static org.lwjgl.opengl.GL11.*;
+
/**
*
* This is a <em>very basic</em> skeleton to init a game and run it.
@@ -46,24 +47,24 @@
* $Id$
*/
public class Game {
-
+
/** Game title */
public static final String GAME_TITLE = "My Game";
-
+
/** Desired frame time */
private static final int FRAMERATE = 60;
-
+
/** Exit the game */
private static boolean finished;
-
+
/** A rotating square! */
private static float angle;
-
+
/**
* No constructor needed - this class is static
*/
private Game() {}
-
+
/**
* Application init
* @param args Commandline args
@@ -78,10 +79,10 @@
} finally {
cleanup();
}
-
+
System.exit(0);
}
-
+
/**
* Initialise the game
* @throws Exception if init fails
@@ -94,25 +95,25 @@
// Enable vsync if we can
Display.setVSyncEnabled(true);
-
+
Display.create();
-
+
// Start up the sound system
AL.create();
-
+
// TODO: Load in your textures etc here
-
+
// Put the window into orthographic projection mode with 1:1 pixel ratio.
// We haven't used GLU here to do this to avoid an unnecessary dependency.
- GL11.glMatrixMode(GL11.GL_PROJECTION);
- GL11.glLoadIdentity();
- GL11.glOrtho(0.0, Display.getDisplayMode().getWidth(), 0.0, Display.getDisplayMode().getHeight(), -1.0, 1.0);
- GL11.glMatrixMode(GL11.GL_MODELVIEW);
- GL11.glLoadIdentity();
- GL11.glViewport(0, 0, Display.getDisplayMode().getWidth(), Display.getDisplayMode().getHeight());
-
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ glOrtho(0.0, Display.getDisplayMode().getWidth(), 0.0, Display.getDisplayMode().getHeight(), -1.0, 1.0);
+ glMatrixMode(GL_MODELVIEW);
+ glLoadIdentity();
+ glViewport(0, 0, Display.getDisplayMode().getWidth(), Display.getDisplayMode().getHeight());
+
}
-
+
/**
* Runs the game (the "main loop")
*/
@@ -120,7 +121,7 @@
while (!finished) {
// Always call Window.update(), all the time
Display.update();
-
+
if (Display.isCloseRequested()) {
// Check for O/S close requests
finished = true;
@@ -144,7 +145,7 @@
}
}
}
-
+
/**
* Do any game-specific cleanup
*/
@@ -153,11 +154,11 @@
// Stop the sound
AL.destroy();
-
+
// Close the window
Display.destroy();
}
-
+
/**
* Do all calculations, handle input, etc.
*/
@@ -170,24 +171,24 @@
// TODO: all your game logic goes here.
angle += 2.0f % 360;
}
-
+
/**
* Render the current frame
*/
private static void render() {
- GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_STENCIL_BUFFER_BIT);
+ glClear(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
// TODO: all your rendering goes here
- GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
- GL11.glPushMatrix();
- GL11.glTranslatef(Display.getDisplayMode().getWidth() / 2, Display.getDisplayMode().getHeight() / 2, 0.0f);
- GL11.glRotatef(angle, 0, 0, 1.0f);
- GL11.glBegin(GL11.GL_QUADS);
- GL11.glVertex2i(-50, -50);
- GL11.glVertex2i(50, -50);
- GL11.glVertex2i(50, 50);
- GL11.glVertex2i(-50, 50);
- GL11.glEnd();
- GL11.glPopMatrix();
+ glClear(GL_COLOR_BUFFER_BIT);
+ glPushMatrix();
+ glTranslatef(Display.getDisplayMode().getWidth() / 2, Display.getDisplayMode().getHeight() / 2, 0.0f);
+ glRotatef(angle, 0, 0, 1.0f);
+ glBegin(GL_QUADS);
+ glVertex2i(-50, -50);
+ glVertex2i(50, -50);
+ glVertex2i(50, 50);
+ glVertex2i(-50, 50);
+ glEnd();
+ glPopMatrix();
}
}
Modified: trunk/LWJGL/src/java/org/lwjgl/examples/spaceinvaders/Entity.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/examples/spaceinvaders/Entity.java 2010-09-27 12:09:52 UTC (rev 3417)
+++ trunk/LWJGL/src/java/org/lwjgl/examples/spaceinvaders/Entity.java 2010-09-28 21:11:35 UTC (rev 3418)
@@ -1,31 +1,31 @@
-/*
+/*
* Copyright (c) 2002-2008 LWJGL Project
* All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
+ * modification, are permitted provided that the following conditions are
* met:
- *
- * * Redistributions of source code must retain the above copyright
+ *
+ * * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * * Neither the name of 'LWJGL' nor the names of
- * its contributors may be used to endorse or promote products derived
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
@@ -37,13 +37,13 @@
* An entity represents any element that appears in the game. The
* entity is responsible for resolving collisions and movement
* based on a set of properties defined either by subclass or externally.
- *
+ *
* Note that doubles are used for positions. This may seem strange
* given that pixels locations are integers. However, using double means
* that an entity can move a partial pixel. It doesn't of course mean that
* they will be display half way through a pixel but allows us not lose
* accuracy as we move.
- *
+ *
* @author Kevin Glass
*/
public abstract class Entity {
@@ -71,12 +71,12 @@
/**
* Construct a entity based on a sprite image and a location.
- *
- * @param ref The reference to the image to be displayed for this entity
+ *
+ * @param sprite The reference to the image to be displayed for this entity
* @param x The initial x location of this entity
* @param y The initial y location of this entity
*/
- public Entity(Sprite sprite, int x, int y) {
+ protected Entity(Sprite sprite, int x, int y) {
this.sprite = sprite;
this.x = x;
this.y = y;
@@ -85,7 +85,7 @@
/**
* Request that this entity move itself based on a certain ammount
* of time passing.
- *
+ *
* @param delta The ammount of time that has passed in milliseconds
*/
public void move(long delta) {
@@ -96,7 +96,7 @@
/**
* Set the horizontal speed of this entity
- *
+ *
* @param dx The horizontal speed of this entity (pixels/sec)
*/
public void setHorizontalMovement(float dx) {
@@ -105,7 +105,7 @@
/**
* Set the vertical speed of this entity
- *
+ *
* @param dy The vertical speed of this entity (pixels/sec)
*/
public void setVerticalMovement(float dy) {
@@ -114,7 +114,7 @@
/**
* Get the horizontal speed of this entity
- *
+ *
* @return The horizontal speed of this entity (pixels/sec)
*/
public float getHorizontalMovement() {
@@ -123,7 +123,7 @@
/**
* Get the vertical speed of this entity
- *
+ *
* @return The vertical speed of this entity (pixels/sec)
*/
public float getVerticalMovement() {
@@ -146,7 +146,7 @@
/**
* Get the x location of this entity
- *
+ *
* @return The x location of this entity
*/
public int getX() {
@@ -155,7 +155,7 @@
/**
* Get the y location of this entity
- *
+ *
* @return The y location of this entity
*/
public int getY() {
@@ -164,7 +164,7 @@
/**
* Check if this entity collised with another.
- *
+ *
* @param other The other entity to check collision against
* @return True if the entities collide with each other
*/
@@ -177,7 +177,7 @@
/**
* Notification that this entity collided with another.
- *
+ *
* @param other The entity with which this entity collided.
*/
public abstract void collidedWith(Entity other);
Modified: trunk/LWJGL/src/java/org/lwjgl/examples/spaceinvaders/Game.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/examples/spaceinvaders/Game.java 2010-09-27 12:09:52 UTC (rev 3417)
+++ trunk/LWJGL/src/java/org/lwjgl/examples/spaceinvaders/Game.java 2010-09-28 21:11:35 UTC (rev 3418)
@@ -1,31 +1,31 @@
-/*
+/*
* Copyright (c) 2002-2008 LWJGL Project
* All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
+ * modification, are permitted provided that the following conditions are
* met:
- *
- * * Redistributions of source code must retain the above copyright
+ *
+ * * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * * Neither the name of 'LWJGL' nor the names of
- * its contributors may be used to endorse or promote products derived
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
@@ -39,32 +39,33 @@
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.DisplayMode;
-import org.lwjgl.opengl.GL11;
+import static org.lwjgl.opengl.GL11.*;
+
/**
* The main hook of our game. This class with both act as a manager
- * for the display and central mediator for the game logic.
- *
+ * for the display and central mediator for the game logic.
+ *
* Display management will consist of a loop that cycles round all
* entities in the game asking them to move and then drawing them
* in the appropriate place. With the help of an inner class it
* will also allow the player to control the main ship.
- *
+ *
* As a mediator it will be informed when entities within our game
* detect events (e.g. alient killed, played died) and will take
* appropriate game actions.
- *
+ *
* <p>
* NOTE:<br>
* This game is a LWJGLized implementation of the Space Invaders game by Kevin
- * Glass. The original implementation is renderer agnostic and supports other
+ * Glass. The original implementation is renderer agnostic and supports other
* OpenGL implementations as well as Java2D. This version has been made specific
- * for LWJGL, and has added input control as well as sound (which the original doesn't,
+ * for LWJGL, and has added input control as well as sound (which the original doesn't,
* at the time of writing).
* You can find the original article here:<br>
* <a href="http://www.cokeandcode.com/" target="_blank">http://www.cokeandcode.com</a>
* </p>
- *
+ *
* @author Kevin Glass
* @author Brian Matzon
*/
@@ -83,10 +84,10 @@
private TextureLoader textureLoader;
/** The list of all the entities that exist in our game */
- private ArrayList entities = new ArrayList();
+ private ArrayList<Entity> entities = new ArrayList<Entity>();
/** The list of entities that need to be removed from the game this loop */
- private ArrayList removeList = new ArrayList();
+ private ArrayList<Entity> removeList = new ArrayList<Entity>();
/** The entity representing the player */
private ShipEntity ship;
@@ -113,7 +114,7 @@
private float moveSpeed = 300;
/** The time at which last fired a shot */
- private long lastFire = 0;
+ private long lastFire;
/** The interval between our players shot (ms) */
private long firingInterval = 500;
@@ -125,16 +126,16 @@
private boolean waitingForKeyPress = true;
/** True if game logic needs to be applied this loop, normally as a result of a game event */
- private boolean logicRequiredThisLoop = false;
+ private boolean logicRequiredThisLoop;
/** The time at which the last rendering looped started from the point of view of the game logic */
private long lastLoopTime = getTime();
/** True if the fire key has been released */
- private boolean fireHasBeenReleased = false;
+ private boolean fireHasBeenReleased;
/** The time since the last record of fps */
- private long lastFpsTime = 0;
+ private long lastFpsTime;
/** The recorded fps */
private int fps;
@@ -167,15 +168,14 @@
/** Mouse movement on x axis */
private int mouseX;
-
+
/** Is this an application or applet */
- private static boolean isApplication = false;
+ private static boolean isApplication;
/**
* Construct our game and set it running.
* @param fullscreen
- *
- * @param renderingType The type of rendering to use (should be one of the contansts from ResourceFactory)
+ *
*/
public Game(boolean fullscreen) {
this.fullscreen = fullscreen;
@@ -184,7 +184,7 @@
/**
* Get the high resolution time in milliseconds
- *
+ *
* @return The high resolution time in milliseconds
*/
public static long getTime() {
@@ -196,8 +196,8 @@
}
/**
- * Sleep for a fixed number of milliseconds.
- *
+ * Sleep for a fixed number of milliseconds.
+ *
* @param duration The amount of time in milliseconds to sleep for
*/
public static void sleep(long duration) {
@@ -217,25 +217,25 @@
Display.setTitle(WINDOW_TITLE);
Display.setFullscreen(fullscreen);
Display.create();
-
+
// grab the mouse, dont want that hideous cursor when we're playing!
- if (isApplication) {
+ if (isApplication) {
Mouse.setGrabbed(true);
}
// enable textures since we're going to use these for our sprites
- GL11.glEnable(GL11.GL_TEXTURE_2D);
+ glEnable(GL_TEXTURE_2D);
// disable the OpenGL depth test since we're rendering 2D graphics
- GL11.glDisable(GL11.GL_DEPTH_TEST);
+ glDisable(GL_DEPTH_TEST);
- GL11.glMatrixMode(GL11.GL_PROJECTION);
- GL11.glLoadIdentity();
+ glMatrixMode(GL_PROJECTION);
+ glLoad...
[truncated message content] |