diff options
author | Sven Gothel <[email protected]> | 2011-08-01 15:14:39 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-08-01 15:14:39 +0200 |
commit | 2dbd16fc3edf29b39ba37a11b9fbf1b2aad75c45 (patch) | |
tree | 70367f094a969e9387b506cef79ee846b0bd6d3b /src/jogl/classes/jogamp/opengl/GLBufferSizeTracker.java | |
parent | 0f0f6162cfbce1ad7db86e7e627721c4c918933c (diff) |
StateTracker: Map's KeyNotFound value -1 -> 0xffffffff... allowing unusual values. Impl -> final.
Map's KeyNotFound value -1 -> 0xffffffff
Turns out some GL impl. use VBO names like 0xa2d67443, which is (int) < 0.
This is now handled in GLBufferStateTracker as well as for the others.
Make methods final to restrict 'em.
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/GLBufferSizeTracker.java')
-rw-r--r-- | src/jogl/classes/jogamp/opengl/GLBufferSizeTracker.java | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/jogl/classes/jogamp/opengl/GLBufferSizeTracker.java b/src/jogl/classes/jogamp/opengl/GLBufferSizeTracker.java index fc8be95e9..dc121323e 100644 --- a/src/jogl/classes/jogamp/opengl/GLBufferSizeTracker.java +++ b/src/jogl/classes/jogamp/opengl/GLBufferSizeTracker.java @@ -100,11 +100,11 @@ public class GLBufferSizeTracker { public GLBufferSizeTracker() { bufferSizeMap = new IntLongHashMap(); - bufferSizeMap.setKeyNotFoundValue(-1); + bufferSizeMap.setKeyNotFoundValue(0xFFFFFFFFFFFFFFFFL); } - public void setBufferSize(GLBufferStateTracker bufferStateTracker, - int target, GL caller, long size) { + public final void setBufferSize(GLBufferStateTracker bufferStateTracker, + int target, GL caller, long size) { // Need to do some similar queries to getBufferSize below int buffer = bufferStateTracker.getBoundBufferObject(target, caller); if (buffer != 0) { @@ -116,11 +116,11 @@ public class GLBufferSizeTracker { // left to do except drop this piece of information on the floor. } - public void setDirectStateBufferSize(int buffer, GL caller, long size) { + public final void setDirectStateBufferSize(int buffer, GL caller, long size) { bufferSizeMap.put(buffer, size); } - public long getBufferSize(GLBufferStateTracker bufferStateTracker, + public final long getBufferSize(GLBufferStateTracker bufferStateTracker, int target, GL caller) { // See whether we know what buffer is currently bound to the given @@ -140,16 +140,16 @@ public class GLBufferSizeTracker { return (long) tmp[0]; } - public long getDirectStateBufferSize(int buffer, GL caller) { + public final long getDirectStateBufferSize(int buffer, GL caller) { return getBufferSizeImpl(0, buffer, caller); } - private long getBufferSizeImpl(int target, int buffer, GL caller) { + private final long getBufferSizeImpl(int target, int buffer, GL caller) { // See whether we know the size of this buffer object; at this // point we almost certainly should if the application is // written correctly long sz = bufferSizeMap.get(buffer); - if (0 > sz) { + if (0xFFFFFFFFFFFFFFFFL == sz) { // For robustness, try to query this value from the GL as we used to // FIXME: both functions return 'int' types, which is not suitable, // since buffer lenght is 64bit ? @@ -188,7 +188,7 @@ public class GLBufferSizeTracker { // destruction if we don't know whether there are other currently- // created contexts that might be keeping the buffer objects alive // that we're dealing with - public void clearCachedBufferSizes() { + public final void clearCachedBufferSizes() { bufferSizeMap.clear(); } } |