From 2dbd16fc3edf29b39ba37a11b9fbf1b2aad75c45 Mon Sep 17 00:00:00 2001
From: Sven Gothel <sgothel@jausoft.com>
Date: Mon, 1 Aug 2011 15:14:39 +0200
Subject: 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.
---
 .../classes/jogamp/opengl/GLBufferSizeTracker.java     | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

(limited to 'src/jogl/classes/jogamp/opengl/GLBufferSizeTracker.java')

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();
   }
 }
-- 
cgit v1.2.3