diff options
author | Sven Gothel <[email protected]> | 2023-03-20 14:22:15 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-03-20 14:22:15 +0100 |
commit | af201b19064d2526743c89c218a51b0a3ee837c2 (patch) | |
tree | f169cd12db944f119be2b7002741428f65bc5b21 /src/jogl/classes | |
parent | 16139461033dff906ab4dfcecb7b6da06174f222 (diff) |
GLArrayDataClient: Allow null buffer @ growIfNeeded(), removed from commit 90a95e6f689b479f3c3ae3caf4e30447030c7682
A null buffer is possible in case initialElementCount at ctor is <= 0
Diffstat (limited to 'src/jogl/classes')
-rw-r--r-- | src/jogl/classes/com/jogamp/opengl/util/GLArrayDataClient.java | 21 |
1 files changed, 1 insertions, 20 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataClient.java b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataClient.java index e5f9e5336..687eb8a4c 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataClient.java +++ b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataClient.java @@ -437,23 +437,7 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData * @return true if buffer size has changed, i.e. grown. Otherwise false. */ public final boolean growIfNeeded(final int spareComponents) { - if( buffer.remaining() < spareComponents ) { - if( 0 != mappedElemCount ) { - throw new GLException("Mapped buffer can't grow. Insufficient storage size: Needed "+spareComponents+" components, "+ - "mappedElementCount "+mappedElemCount+ - ", has mapped buffer "+buffer+"; "+this); - } - final int has_comps = buffer.capacity(); - final int required_elems = compsToElemCount(has_comps + spareComponents); - final int new_elems = compsToElemCount( (int)( has_comps * growthFactor + 0.5f ) ); - final int elementCount = Math.max( new_elems, required_elems ); - return reserve( elementCount ); - } - return false; - } - - public final boolean growIfNeeded0(final int spareComponents) { - if( buffer==null || buffer.remaining()<spareComponents ) { + if( null == buffer || buffer.remaining() < spareComponents ) { if( 0 != mappedElemCount ) { throw new GLException("Mapped buffer can't grow. Insufficient storage size: Needed "+spareComponents+" components, "+ "mappedElementCount "+mappedElemCount+ @@ -467,9 +451,6 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData final int required_elems = compsToElemCount(has_comps + spareComponents); final int new_elems = compsToElemCount( (int)( has_comps * growthFactor + 0.5f ) ); final int elementCount = Math.max( new_elems, required_elems ); - if( DEBUG ) { - System.err.println("*** Size: Grow: elems "+compsToElemCount(has_comps)+" -> max("+new_elems+", "+required_elems+") -> "+elementCount); - } return reserve( elementCount ); } } |