|
From: <sp...@us...> - 2011-07-12 14:21:36
|
Revision: 3573
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3573&view=rev
Author: spasi
Date: 2011-07-12 14:21:29 +0000 (Tue, 12 Jul 2011)
Log Message:
-----------
Changed mapping behavior to be consistent with the LWJGL API; it now starts at the buffer's current .position().
Reverted client JVM warning to use serr instead of LWJGLUtil.log, for extra visibility when Debug is disabled.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/test/mapped/MappedObjectTests1.java
trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedHelper.java
trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedObjectTransformer.java
Modified: trunk/LWJGL/src/java/org/lwjgl/test/mapped/MappedObjectTests1.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/test/mapped/MappedObjectTests1.java 2011-07-12 13:44:13 UTC (rev 3572)
+++ trunk/LWJGL/src/java/org/lwjgl/test/mapped/MappedObjectTests1.java 2011-07-12 14:21:29 UTC (rev 3573)
@@ -117,6 +117,19 @@
} catch (IndexOutOfBoundsException e) {
// expected, ignore
}
+
+ try {
+ ByteBuffer posTest = ByteBuffer.allocateDirect(200);
+ posTest.position(10 * MappedFloat.SIZEOF); // position > 0
+
+ MappedFloat vecs2 = MappedFloat.map(posTest);
+ vecs2.view = 39;
+ assert vecs2.view == 39;
+ vecs2.view = 40;
+ System.out.println("org.lwjgl.util.mapped.Checks is false or there is a bug in bounds checking.");
+ } catch (IndexOutOfBoundsException e) {
+ // expected, ignore
+ }
}
// test dup
Modified: trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedHelper.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedHelper.java 2011-07-12 13:44:13 UTC (rev 3572)
+++ trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedHelper.java 2011-07-12 14:21:29 UTC (rev 3573)
@@ -60,7 +60,7 @@
throw new IllegalStateException("sizeof not a multiple of alignment");
mo.stride = sizeof;
- long addr = MappedObjectUnsafe.getBufferBaseAddress(buffer);
+ long addr = MappedObjectUnsafe.getBufferBaseAddress(buffer) + buffer.position();
if ( addr % align != 0 )
throw new IllegalStateException("buffer address not aligned on " + align + " bytes");
Modified: trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedObjectTransformer.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedObjectTransformer.java 2011-07-12 13:44:13 UTC (rev 3572)
+++ trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedObjectTransformer.java 2011-07-12 14:21:29 UTC (rev 3573)
@@ -62,7 +62,7 @@
String vmName = System.getProperty("java.vm.name");
if ( vmName != null && !vmName.contains("Server") ) {
- LWJGLUtil.log("Warning: " + MappedObject.class.getSimpleName() + "s have inferiour performance on Client VMs, please consider switching to a Server VM.");
+ System.err.println("Warning: " + MappedObject.class.getSimpleName() + "s have inferiour performance on Client VMs, please consider switching to a Server VM.");
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|