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.
This commit is contained in:
parent
fa31e0f9cb
commit
e174bf3bc8
|
@ -117,6 +117,19 @@ public class MappedObjectTests1 {
|
|||
} 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
|
||||
|
|
|
@ -60,7 +60,7 @@ public class MappedHelper {
|
|||
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");
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ public class MappedObjectTransformer {
|
|||
|
||||
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.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue