aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2019-12-27 03:50:32 +0100
committerSven Gothel <[email protected]>2019-12-27 03:50:32 +0100
commit50f9c9e113b09ab54ba40abba6b2face27c9a139 (patch)
treee4e3089ea225c68d59c695d5f9460eae779aa668 /src/jogl
parent95ca88ba975c7296098bbd34bec2d922aeb2b563 (diff)
Bug 1287 - Complete Immutable glNamedBufferStorage support in GLBufferObjectTracker
As of the time of implementation, named immutable buffers were not fully supported within GL 4.4. This has changed, i.e. GL 4.5 supports glNamedBufferStorage. This patch adds support for the immutable named buffer storage case. jogl commit 09fc7aa5539731bb0fba835caee61f6eb837ecff, added GLBufferObjectTracker allowing to keep required references to NIO object. This tracker complements the NIO buffer lifecycle with the GL semantics.
Diffstat (limited to 'src/jogl')
-rw-r--r--src/jogl/classes/jogamp/opengl/GLBufferObjectTracker.java17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/jogl/classes/jogamp/opengl/GLBufferObjectTracker.java b/src/jogl/classes/jogamp/opengl/GLBufferObjectTracker.java
index 717ee2cab..fb8b14697 100644
--- a/src/jogl/classes/jogamp/opengl/GLBufferObjectTracker.java
+++ b/src/jogl/classes/jogamp/opengl/GLBufferObjectTracker.java
@@ -167,7 +167,8 @@ public class GLBufferObjectTracker {
final boolean invalidSize = ( mutableBuffer && 0 > size ) // glBufferData, glNamedBufferData
|| ( !mutableBuffer && 0 >= size ); // glBufferStorage
if( invalidSize ) {
- throw new GLException(String.format("%s: Invalid size %d for buffer %d on target 0x%X", GL_INVALID_VALUE, size, bufferName, target));
+ throw new GLException(String.format("%s: Invalid size %d for %s buffer %d on target 0x%X",
+ GL_INVALID_VALUE, size, mutableBuffer ? "mutable" : "immutable", bufferName, target));
}
dispatch.create(target, size, data, mutableBuffer ? mutableUsage : immutableFlags);
@@ -211,18 +212,18 @@ public class GLBufferObjectTracker {
if (DEBUG && GL.GL_NO_ERROR != glerrPre) {
System.err.printf("%s.%s glerr-pre 0x%X%n", msgClazzName, msgCreateNamed, glerrPre);
}
- if ( 0 > size ) { // glBufferData, glNamedBufferData
- throw new GLException(String.format("%s: Invalid size %d for buffer %d", GL_INVALID_VALUE, size, bufferName));
- }
final boolean mutableBuffer = 0 != mutableUsage;
- if( !mutableBuffer ) {
- throw new InternalError("Immutable glNamedBufferStorage not supported yet");
+ final boolean invalidSize = ( mutableBuffer && 0 > size ) // glBufferData, glNamedBufferData
+ || ( !mutableBuffer && 0 >= size ); // glBufferStorage
+ if( invalidSize ) {
+ throw new GLException(String.format("%s: Invalid size %d for %s buffer %d",
+ GL_INVALID_VALUE, size, mutableBuffer ? "mutable" : "immutable", bufferName));
}
- dispatch.create(bufferName, size, data, mutableUsage);
+ dispatch.create(bufferName, size, data, mutableBuffer ? mutableUsage : immutableFlags);
final int glerrPost = caller.glGetError(); // be safe, catch failure!
if(GL.GL_NO_ERROR != glerrPost) {
throw new GLException(String.format("GL-Error 0x%X while creating %s storage for buffer %d of size %d with data %s",
- glerrPost, "mutable", bufferName, size, data));
+ glerrPost, mutableBuffer ? "mutable" : "immutable", bufferName, size, data));
}
final GLBufferStorageImpl objOld = (GLBufferStorageImpl) bufferName2StorageMap.get(bufferName);
if( null != objOld ) {