diff options
author | Sven Gothel <[email protected]> | 2015-03-11 15:33:10 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2015-03-11 15:33:10 +0100 |
commit | 68391b118e93170c568edc21edad7f6b0c1f97a3 (patch) | |
tree | c0fd4e18d0bca4f1ca0875bf2d1d0df430afd09d | |
parent | cd92c17175db0c3a3a04b5b327cfcb887bf8a7d7 (diff) |
Bug 1135: Complete GLBufferObjectTracker for GL 4.5 using GlueGen's DelegateImplementation/ReturnsOpaque (Bug 1144)
Using GlueGen's new DelegateImplementation/ReturnsOpaque feature (Bug 1144)
allows us to drop manually C implementation stubs, while simply delegating
into the renamed private generated variant using the manual stub.
Completed glBufferStorage and glNamedBufferStorage for GL 4.4
while subsuming DSA's of GL 4.5 and GL_EXT_direct_state_access
(only the single functions, otherwise extension is not compatible).
-rw-r--r-- | make/config/jogl/gl-common-extensions.cfg | 1 | ||||
-rw-r--r-- | make/config/jogl/gl-common.cfg | 66 | ||||
-rw-r--r-- | make/config/jogl/gl-gl4bc.cfg | 105 | ||||
-rw-r--r-- | make/config/jogl/gl-impl-CustomCCode-gl4bc.c | 136 | ||||
-rw-r--r-- | make/config/jogl/gl-impl-CustomCCode-gles1.c | 68 | ||||
-rw-r--r-- | make/config/jogl/gl-impl-CustomCCode-gles3.c | 69 | ||||
-rw-r--r-- | make/config/jogl/gl-impl-CustomJavaCode-common.java | 49 | ||||
-rw-r--r-- | make/config/jogl/gl-impl-CustomJavaCode-gl4bc.java | 124 | ||||
-rw-r--r-- | make/config/jogl/gl-impl-CustomJavaCode-gles1.java | 41 | ||||
-rw-r--r-- | make/config/jogl/gl-impl-CustomJavaCode-gles3.java | 42 | ||||
-rw-r--r-- | make/scripts/gluegen-gl.sh | 8 | ||||
-rw-r--r-- | make/scripts/tests.sh | 6 | ||||
-rw-r--r-- | src/jogl/classes/com/jogamp/gluegen/opengl/GLConfiguration.java | 11 | ||||
-rw-r--r-- | src/jogl/classes/com/jogamp/gluegen/opengl/nativesig/NativeSignatureEmitter.java | 5 | ||||
-rw-r--r-- | src/jogl/classes/com/jogamp/opengl/GLBufferStorage.java | 14 | ||||
-rw-r--r-- | src/jogl/classes/jogamp/opengl/GLBufferObjectTracker.java | 82 |
16 files changed, 230 insertions, 597 deletions
diff --git a/make/config/jogl/gl-common-extensions.cfg b/make/config/jogl/gl-common-extensions.cfg index 9818949fb..f3bd08fe7 100644 --- a/make/config/jogl/gl-common-extensions.cfg +++ b/make/config/jogl/gl-common-extensions.cfg @@ -101,7 +101,6 @@ RenameExtensionIntoCore GL_OES_single_precision RenameExtensionIntoCore GL_OES_texture_view RenameExtensionIntoCore GL_OES_copy_image RenameExtensionIntoCore GL_OES_texture_border_clamp -RenameExtensionIntoCore GL_OES_mapbuffer RenameExtensionIntoCore GL_APPLE_framebuffer_multisample RenameExtensionIntoCore GL_ANGLE_framebuffer_multisample RenameExtensionIntoCore GL_NV_fbo_color_attachments diff --git a/make/config/jogl/gl-common.cfg b/make/config/jogl/gl-common.cfg index 84919e5e2..2993b4bb2 100644 --- a/make/config/jogl/gl-common.cfg +++ b/make/config/jogl/gl-common.cfg @@ -71,8 +71,13 @@ Ignore glDebugMessageCallback # Manually implement following GL functions to be redirected # to GLBufferObjectTracker. # -ManuallyImplement glBufferData -ForceProcAddressGen glBufferData +# Common for all profiles: +# glBufferData +# glUnmapBuffer +# mapBuffer +# mapBufferRange +# +DelegateImplementation glBufferData glBufferDataDelegate MethodJavadoc glBufferData * <p> MethodJavadoc glBufferData * Throws a {@link GLException} if GL-function constraints are not met or the native GL-function fails. MethodJavadoc glBufferData * </p> @@ -82,21 +87,11 @@ MethodJavadoc glBufferData * @throws GLException if size is less-than zero MethodJavadoc glBufferData * @throws GLException if a native GL-Error occurs MethodJavadoc glBufferData * </p> -# FIXME: Add for OpenGL 4.4 -#Ignore glBufferStorage -#ManuallyImplement glBufferStorage -#ForceProcAddressGen glBufferStorage -#MethodJavadoc glBufferStorage * <p> -#MethodJavadoc glBufferStorage * Throws a {@link GLException} if GL-function constraints are not met or the native GL-function fails. -#MethodJavadoc glBufferStorage * </p> -#MethodJavadoc glBufferStorage * <p> -#MethodJavadoc glBufferStorage * @throws GLException if buffer is not bound to target -#MethodJavadoc glBufferStorage * @throws GLException if size is less-or-equal zero -#MethodJavadoc glBufferStorage * @throws GLException if a native GL-Error occurs -#MethodJavadoc glBufferStorage * </p> - -ManuallyImplement glMapBuffer -ForceProcAddressGen glMapBuffer +# +# GL_OES_mapbuffer: subsumed +# +DelegateImplementation glMapBuffer glMapBufferDelegate +ReturnsOpaque long glMapBufferDelegate MethodJavadoc glMapBuffer * <p> MethodJavadoc glMapBuffer * Throws a {@link GLException} if GL-function constraints are not met. MethodJavadoc glMapBuffer * </p> @@ -109,8 +104,11 @@ MethodJavadoc glMapBuffer * @throws GLException if buffer is already mapped MethodJavadoc glMapBuffer * @throws GLException if buffer has invalid store size, i.e. less-than zero MethodJavadoc glMapBuffer * </p> -ManuallyImplement glMapBufferRange -ForceProcAddressGen glMapBufferRange +# +# GL_EXT_map_buffer_range: individual method +RenameJavaSymbol glMapBufferRangeEXT glMapBufferRange +DelegateImplementation glMapBufferRange glMapBufferRangeDelegate +ReturnsOpaque long glMapBufferRangeDelegate MethodJavadoc glMapBufferRange * <p> MethodJavadoc glMapBufferRange * Throws a {@link GLException} if GL-function constraints are not met. MethodJavadoc glMapBufferRange * </p> @@ -125,8 +123,18 @@ MethodJavadoc glMapBufferRange * @throws GLException if buffer has invalid store MethodJavadoc glMapBufferRange * @throws GLException if buffer mapping range does not fit, incl. offset MethodJavadoc glMapBufferRange * </p> -ManuallyImplement glUnmapBuffer -ForceProcAddressGen glUnmapBuffer +DelegateImplementation glUnmapBuffer glUnmapBufferDelegate + +# +# Manually implement following GL 4 functions to be redirected +# to GLBufferObjectTracker. +# RenameJavaSymbol: GL_EXT_direct_state_access -> GL 4.5 ! +# +RenameJavaSymbol glNamedBufferDataEXT glNamedBufferData +RenameJavaSymbol glNamedBufferStorageEXT glNamedBufferStorage +RenameJavaSymbol glMapNamedBufferEXT glMapNamedBuffer +RenameJavaSymbol glMapNamedBufferRangeEXT glMapNamedBufferRange +RenameJavaSymbol glUnmapNamedBufferEXT glUnmapNamedBuffer # Ignore the ATI_map_object_buffer extension for now unless someone # claims they need it, as it will undoubtedly require a similar @@ -906,7 +914,7 @@ ClassJavadoc GL2ES2 */ ClassJavadoc GL2ES3 /** ClassJavadoc GL2ES3 * <p> -ClassJavadoc GL2ES3 * Interface containing the common subset of core GL2 and GLES3 (OpenGL ES 3.0+).<br/> +ClassJavadoc GL2ES3 * Interface containing the common subset of core GL2 and GLES3 (OpenGL ES 3.0).<br/> ClassJavadoc GL2ES3 * This interface reflects only the programmable shader functionality of desktop and embedded OpenGL<br/> ClassJavadoc GL2ES3 * This interface is not GLES3 complete and merely exist to avoid duplicated definitions.<br/> ClassJavadoc GL2ES3 * </p> @@ -914,7 +922,7 @@ ClassJavadoc GL2ES3 */ ClassJavadoc GL3ES3 /** ClassJavadoc GL3ES3 * <p> -ClassJavadoc GL3ES3 * Interface containing the common subset of core GL3 (OpenGL 3.1+) and GLES3 (OpenGL ES 3.0+).<br/> +ClassJavadoc GL3ES3 * Interface containing the common subset of core GL3 (OpenGL 3.1+) and GLES3 (OpenGL ES 3.0).<br/> ClassJavadoc GL3ES3 * This interface reflects only the programmable shader functionality of desktop and embedded OpenGL<br/> ClassJavadoc GL3ES3 * This interface is almost GLES3 complete, lacking <code>GL_ARB_ES3_compatibility</code> extension.<br/> ClassJavadoc GL3ES3 * </p> @@ -922,7 +930,7 @@ ClassJavadoc GL3ES3 */ ClassJavadoc GL4ES3 /** ClassJavadoc GL4ES3 * <p> -ClassJavadoc GL4ES3 * Interface containing the common subset of core GL4 (OpenGL 4.0+) and GLES3 (OpenGL ES 3.0+).<br/> +ClassJavadoc GL4ES3 * Interface containing the common subset of core GL4 (OpenGL 4.0+) and GLES3 (OpenGL ES 3.0).<br/> ClassJavadoc GL4ES3 * This interface reflects only the programmable shader functionality of desktop and embedded OpenGL<br/> ClassJavadoc GL4ES3 * This interface is GLES3 complete w/o vendor extensions.<br/> ClassJavadoc GL4ES3 * </p> @@ -960,15 +968,15 @@ ClassJavadoc GL3bc * <p>Note: OpenGL [ 3.1 .. 3.3 ] compatibility profile does ClassJavadoc GL3bc */ ClassJavadoc GL4 /** -ClassJavadoc GL4 * <p>This interface contains all OpenGL [ 4.0 .. 4.5 ] <i>core</i> methods, +ClassJavadoc GL4 * <p>This interface contains all OpenGL [ 4.0 .. 4.3 ] <i>core</i> methods, ClassJavadoc GL4 * as well as most of it's extensions defined at the time of this specification.</p> -ClassJavadoc GL4 * <p>Note: OpenGL [ 4.0 .. 4.5 ] core profile does not includes fixed point functionality.</p> +ClassJavadoc GL4 * <p>Note: OpenGL [ 4.0 .. 4.3 ] core profile does not includes fixed point functionality.</p> ClassJavadoc GL4 */ ClassJavadoc GL4bc /** -ClassJavadoc GL4bc * <p>This interface contains all OpenGL [ 4.0 .. 4.5 ] <i>compatibility</i> profile, +ClassJavadoc GL4bc * <p>This interface contains all OpenGL [ 4.0 .. 4.3 ] <i>compatibility</i> profile, ClassJavadoc GL4bc * as well as most of it's extensions defined at the time of this specification.</p> -ClassJavadoc GL4bc * <p>Note: OpenGL [ 4.0 .. 4.5 ] compatibility profile does includes fixed point functionality.</p> +ClassJavadoc GL4bc * <p>Note: OpenGL [ 4.0 .. 4.3 ] compatibility profile does includes fixed point functionality.</p> ClassJavadoc GL4bc */ ClassJavadoc GLES1 /** @@ -982,7 +990,7 @@ ClassJavadoc GLES2 * as well as most of it's extensions defined at the time of ClassJavadoc GLES2 */ ClassJavadoc GLES3 /** -ClassJavadoc GLES3 * <p>This interface contains all OpenGL ES [ 3.0 .. 3.1 ] methods, +ClassJavadoc GLES3 * <p>This interface contains all OpenGL ES 3.0 methods, ClassJavadoc GLES3 * as well as most of it's extensions defined at the time of this specification.</p> ClassJavadoc GLES3 */ diff --git a/make/config/jogl/gl-gl4bc.cfg b/make/config/jogl/gl-gl4bc.cfg index ae3ebb22f..0b92d78b9 100644 --- a/make/config/jogl/gl-gl4bc.cfg +++ b/make/config/jogl/gl-gl4bc.cfg @@ -67,50 +67,71 @@ Include gl3-common.cfg Include gl2_es2-CustomJavaCode.cfg # -# Manually implement following GL functions to be redirected +# Manually implement following GL 4 functions to be redirected # to GLBufferObjectTracker. # -ManuallyImplement glNamedBufferDataEXT -ForceProcAddressGen glNamedBufferDataEXT -MethodJavadoc glNamedBufferDataEXT * <p> -MethodJavadoc glNamedBufferDataEXT * Throws a {@link GLException} if GL-function constraints are not met or the native GL-function fails. -MethodJavadoc glNamedBufferDataEXT * </p> -MethodJavadoc glNamedBufferDataEXT * <p> -MethodJavadoc glNamedBufferDataEXT * @throws GLException if size is less-than zero -MethodJavadoc glNamedBufferDataEXT * @throws GLException if a native GL-Error occurs -MethodJavadoc glNamedBufferDataEXT * </p> - -ManuallyImplement glMapNamedBufferEXT -ForceProcAddressGen glMapNamedBufferEXT -MethodJavadoc glMapNamedBufferEXT * <p> -MethodJavadoc glMapNamedBufferEXT * Throws a {@link GLException} if GL-function constraints are not met. -MethodJavadoc glMapNamedBufferEXT * </p> -MethodJavadoc glMapNamedBufferEXT * <p> -MethodJavadoc glMapNamedBufferEXT * Returns {@link GL2#mapNamedBuffer(int, int)}'s {@link GLBufferStorage#getMappedBuffer()}. -MethodJavadoc glMapNamedBufferEXT * </p> -MethodJavadoc glMapNamedBufferEXT * <p> -MethodJavadoc glMapNamedBufferEXT * @throws GLException if buffer is not tracked -MethodJavadoc glMapNamedBufferEXT * @throws GLException if buffer is already mapped -MethodJavadoc glMapNamedBufferEXT * @throws GLException if buffer has invalid store size, i.e. less-than zero -MethodJavadoc glMapNamedBufferEXT * </p> - -ManuallyImplement glMapNamedBufferRangeEXT -ForceProcAddressGen glMapNamedBufferRangeEXT -MethodJavadoc glMapNamedBufferRangeEXT * <p> -MethodJavadoc glMapNamedBufferRangeEXT * Throws a {@link GLException} if GL-function constraints are not met. -MethodJavadoc glMapNamedBufferRangeEXT * </p> -MethodJavadoc glMapNamedBufferRangeEXT * <p> -MethodJavadoc glMapNamedBufferRangeEXT * Returns {@link GL2#mapNamedBufferRange(int, long, long, int)}'s {@link GLBufferStorage#getMappedBuffer()}. -MethodJavadoc glMapNamedBufferRangeEXT * </p> -MethodJavadoc glMapNamedBufferRangeEXT * <p> -MethodJavadoc glMapNamedBufferRangeEXT * @throws GLException if buffer is not tracked -MethodJavadoc glMapNamedBufferRangeEXT * @throws GLException if buffer is already mapped -MethodJavadoc glMapNamedBufferRangeEXT * @throws GLException if buffer has invalid store size, i.e. less-than zero -MethodJavadoc glMapNamedBufferRangeEXT * @throws GLException if buffer mapping range does not fit, incl. offset -MethodJavadoc glMapNamedBufferRangeEXT * </p> - -ManuallyImplement glUnmapNamedBufferEXT -ForceProcAddressGen glUnmapNamedBufferEXT +# RenameJavaSymbol: GL_EXT_direct_state_access -> GL 4.5 ! +# see gl-common.cfg +# +DelegateImplementation glNamedBufferData glNamedBufferDataDelegate +MethodJavadoc glNamedBufferData * <p> +MethodJavadoc glNamedBufferData * Throws a {@link GLException} if GL-function constraints are not met or the native GL-function fails. +MethodJavadoc glNamedBufferData * </p> +MethodJavadoc glNamedBufferData * <p> +MethodJavadoc glNamedBufferData * @throws GLException if size is less-than zero +MethodJavadoc glNamedBufferData * @throws GLException if a native GL-Error occurs +MethodJavadoc glNamedBufferData * </p> + +DelegateImplementation glBufferStorage glBufferStorageDelegate +MethodJavadoc glBufferStorage * <p> +MethodJavadoc glBufferStorage * Throws a {@link GLException} if GL-function constraints are not met or the native GL-function fails. +MethodJavadoc glBufferStorage * </p> +MethodJavadoc glBufferStorage * <p> +MethodJavadoc glBufferStorage * @throws GLException if buffer is not bound to target +MethodJavadoc glBufferStorage * @throws GLException if size is less-or-equal zero +MethodJavadoc glBufferStorage * @throws GLException if a native GL-Error occurs +MethodJavadoc glBufferStorage * </p> + +DelegateImplementation glNamedBufferStorage glNamedBufferStorageDelegate +MethodJavadoc glNamedBufferStorage * <p> +MethodJavadoc glNamedBufferStorage * Throws a {@link GLException} if GL-function constraints are not met or the native GL-function fails. +MethodJavadoc glNamedBufferStorage * </p> +MethodJavadoc glNamedBufferStorage * <p> +MethodJavadoc glNamedBufferStorage * @throws GLException if buffer is not bound to target +MethodJavadoc glNamedBufferStorage * @throws GLException if size is less-or-equal zero +MethodJavadoc glNamedBufferStorage * @throws GLException if a native GL-Error occurs +MethodJavadoc glNamedBufferStorage * </p> + +DelegateImplementation glMapNamedBuffer glMapNamedBufferDelegate +ReturnsOpaque long glMapNamedBufferDelegate +MethodJavadoc glMapNamedBuffer * <p> +MethodJavadoc glMapNamedBuffer * Throws a {@link GLException} if GL-function constraints are not met. +MethodJavadoc glMapNamedBuffer * </p> +MethodJavadoc glMapNamedBuffer * <p> +MethodJavadoc glMapNamedBuffer * Returns {@link GL2#mapNamedBuffer(int, int)}'s {@link GLBufferStorage#getMappedBuffer()}. +MethodJavadoc glMapNamedBuffer * </p> +MethodJavadoc glMapNamedBuffer * <p> +MethodJavadoc glMapNamedBuffer * @throws GLException if buffer is not tracked +MethodJavadoc glMapNamedBuffer * @throws GLException if buffer is already mapped +MethodJavadoc glMapNamedBuffer * @throws GLException if buffer has invalid store size, i.e. less-than zero +MethodJavadoc glMapNamedBuffer * </p> + +DelegateImplementation glMapNamedBufferRange glMapNamedBufferRangeDelegate +ReturnsOpaque long glMapNamedBufferRangeDelegate +MethodJavadoc glMapNamedBufferRange * <p> +MethodJavadoc glMapNamedBufferRange * Throws a {@link GLException} if GL-function constraints are not met. +MethodJavadoc glMapNamedBufferRange * </p> +MethodJavadoc glMapNamedBufferRange * <p> +MethodJavadoc glMapNamedBufferRange * Returns {@link GL2#mapNamedBufferRange(int, long, long, int)}'s {@link GLBufferStorage#getMappedBuffer()}. +MethodJavadoc glMapNamedBufferRange * </p> +MethodJavadoc glMapNamedBufferRange * <p> +MethodJavadoc glMapNamedBufferRange * @throws GLException if buffer is not tracked +MethodJavadoc glMapNamedBufferRange * @throws GLException if buffer is already mapped +MethodJavadoc glMapNamedBufferRange * @throws GLException if buffer has invalid store size, i.e. less-than zero +MethodJavadoc glMapNamedBufferRange * @throws GLException if buffer mapping range does not fit, incl. offset +MethodJavadoc glMapNamedBufferRange * </p> + +DelegateImplementation glUnmapNamedBuffer glUnmapNamedBufferDelegate # Manuall implement glDebugMessageCallback* using the proc address resolver ForceProcAddressGen glDebugMessageCallback diff --git a/make/config/jogl/gl-impl-CustomCCode-gl4bc.c b/make/config/jogl/gl-impl-CustomCCode-gl4bc.c index 8da179fde..9fbbba9e2 100644 --- a/make/config/jogl/gl-impl-CustomCCode-gl4bc.c +++ b/make/config/jogl/gl-impl-CustomCCode-gl4bc.c @@ -1,138 +1,3 @@ -/* Java->C glue code: - * Java package: jogamp.opengl.gl4.GL4bcImpl - * Java method: void dispatch_glBufferData(int target, long size, java.nio.Buffer data, int usage) - * C function: void glBufferData(GLenum target, GLsizeiptr size, const GLvoid * data, GLenum usage); - */ -JNIEXPORT void JNICALL -Java_jogamp_opengl_gl4_GL4bcImpl_dispatch_1glBufferData(JNIEnv *env, jobject _unused, jint target, jlong size, jobject data, jint data_byte_offset, jboolean data_is_nio, jint usage, jlong procAddress) { - typedef void (APIENTRY*_local_PFNGLBUFFERDATAPROC)(GLenum target, GLsizeiptr size, const GLvoid * data, GLenum usage); - _local_PFNGLBUFFERDATAPROC ptr_glBufferData; - GLvoid * _data_ptr = NULL; - if ( NULL != data ) { - _data_ptr = (GLvoid *) ( JNI_TRUE == data_is_nio ? (*env)->GetDirectBufferAddress(env, data) : (*env)->GetPrimitiveArrayCritical(env, data, NULL) ); } - ptr_glBufferData = (_local_PFNGLBUFFERDATAPROC) (intptr_t) procAddress; - assert(ptr_glBufferData != NULL); - (* ptr_glBufferData) ((GLenum) target, (GLsizeiptr) size, (GLvoid *) (((char *) _data_ptr) + data_byte_offset), (GLenum) usage); - if ( JNI_FALSE == data_is_nio && NULL != data ) { - (*env)->ReleasePrimitiveArrayCritical(env, data, _data_ptr, JNI_ABORT); } -} - -/** FIXME Add for OpenGL 4.4: glBufferStorage */ - -/* Java->C glue code: - * Java package: jogamp.opengl.gl4.GL4bcImpl - * Java method: void dispatch_glNamedBufferDataEXT(int buffer, long size, java.nio.Buffer data, int usage) - * C function: void glNamedBufferDataEXT(GLuint buffer, GLsizeiptr size, const GLvoid * data, GLenum usage); - */ -JNIEXPORT void JNICALL -Java_jogamp_opengl_gl4_GL4bcImpl_dispatch_1glNamedBufferDataEXT(JNIEnv *env, jobject _unused, jint buffer, jlong size, jobject data, jint data_byte_offset, jboolean data_is_nio, jint usage, jlong procAddress) { - typedef void (APIENTRY*_local_PFNGLNAMEDBUFFERDATAEXTPROC)(GLuint buffer, GLsizeiptr size, const GLvoid * data, GLenum usage); - _local_PFNGLNAMEDBUFFERDATAEXTPROC ptr_glNamedBufferDataEXT; - GLvoid * _data_ptr = NULL; - if ( NULL != data ) { - _data_ptr = (GLvoid *) ( JNI_TRUE == data_is_nio ? (*env)->GetDirectBufferAddress(env, data) : (*env)->GetPrimitiveArrayCritical(env, data, NULL) ); } - ptr_glNamedBufferDataEXT = (_local_PFNGLNAMEDBUFFERDATAEXTPROC) (intptr_t) procAddress; - assert(ptr_glNamedBufferDataEXT != NULL); - (* ptr_glNamedBufferDataEXT) ((GLuint) buffer, (GLsizeiptr) size, (GLvoid *) (((char *) _data_ptr) + data_byte_offset), (GLenum) usage); - if ( JNI_FALSE == data_is_nio && NULL != data ) { - (*env)->ReleasePrimitiveArrayCritical(env, data, _data_ptr, JNI_ABORT); } -} - -/* Java->C glue code: - * Java package: jogamp.opengl.gl4.GL4bcImpl - * Java method: boolean dispatch_glUnmapBuffer(int target) - * C function: GLboolean glUnmapBuffer(GLenum target); - */ -JNIEXPORT jboolean JNICALL -Java_jogamp_opengl_gl4_GL4bcImpl_dispatch_1glUnmapBuffer(JNIEnv *env, jobject _unused, jint target, jlong procAddress) { - typedef GLboolean (APIENTRY*_local_PFNGLUNMAPBUFFERPROC)(GLenum target); - _local_PFNGLUNMAPBUFFERPROC ptr_glUnmapBuffer; - GLboolean _res; - ptr_glUnmapBuffer = (_local_PFNGLUNMAPBUFFERPROC) (intptr_t) procAddress; - assert(ptr_glUnmapBuffer != NULL); - _res = (* ptr_glUnmapBuffer) ((GLenum) target); - return _res; -} - -/* Java->C glue code: - * Java package: jogamp.opengl.gl4.GL4bcImpl - * Java method: boolean dispatch_glUnmapNamedBufferEXT(int buffer) - * C function: GLboolean glUnmapNamedBufferEXT(GLuint buffer); - */ -JNIEXPORT jboolean JNICALL -Java_jogamp_opengl_gl4_GL4bcImpl_dispatch_1glUnmapNamedBufferEXT(JNIEnv *env, jobject _unused, jint buffer, jlong procAddress) { - typedef GLboolean (APIENTRY*_local_PFNGLUNMAPNAMEDBUFFEREXTPROC)(GLuint buffer); - _local_PFNGLUNMAPNAMEDBUFFEREXTPROC ptr_glUnmapNamedBufferEXT; - GLboolean _res; - ptr_glUnmapNamedBufferEXT = (_local_PFNGLUNMAPNAMEDBUFFEREXTPROC) (intptr_t) procAddress; - assert(ptr_glUnmapNamedBufferEXT != NULL); - _res = (* ptr_glUnmapNamedBufferEXT) ((GLuint) buffer); - return _res; -} - -/* Java->C glue code: - * Java package: jogamp.opengl.gl4.GL4bcImpl * Java method: long dispatch_glMapBuffer(int target, int access) - * C function: void * glMapBuffer(GLenum target, GLenum access); - */ -JNIEXPORT jlong JNICALL -Java_jogamp_opengl_gl4_GL4bcImpl_dispatch_1glMapBuffer(JNIEnv *env, jobject _unused, jint target, jint access, jlong glProcAddress) { - typedef void *(APIENTRY*_local_PFNGLMAPBUFFERPROC) (GLenum target, GLenum access); - _local_PFNGLMAPBUFFERPROC ptr_glMapBuffer; - void * _res; - ptr_glMapBuffer = (_local_PFNGLMAPBUFFERPROC) (intptr_t) glProcAddress; - assert(ptr_glMapBuffer != NULL); - _res = (* ptr_glMapBuffer) ((GLenum) target, (GLenum) access); - return (jlong) (intptr_t) _res; -} - -/* Java->C glue code: - * Java package: jogamp.opengl.gl4.GL4bcImpl - * Java method: java.nio.ByteBuffer dispatch_glMapBufferRange(int target, long offset, long length, int access) - * C function: void * glMapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); - */ -JNIEXPORT jlong JNICALL -Java_jogamp_opengl_gl4_GL4bcImpl_dispatch_1glMapBufferRange(JNIEnv *env, jobject _unused, jint target, jlong offset, jlong length, jint access, jlong procAddress) { - typedef void * (APIENTRY*_local_PFNGLMAPBUFFERRANGEPROC)(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); - _local_PFNGLMAPBUFFERRANGEPROC ptr_glMapBufferRange; - void * _res; - ptr_glMapBufferRange = (_local_PFNGLMAPBUFFERRANGEPROC) (intptr_t) procAddress; - assert(ptr_glMapBufferRange != NULL); - _res = (* ptr_glMapBufferRange) ((GLenum) target, (GLintptr) offset, (GLsizeiptr) length, (GLbitfield) access); - return (jlong) (intptr_t) _res; -} - -/* Java->C glue code: - * Java package: jogamp.opengl.gl4.GL4bcImpl - * Java method: long dispatch_glMapNamedBufferEXT(int target, int access) - * C function: void * glMapNamedBufferEXT(GLenum target, GLenum access); - */ -JNIEXPORT jlong JNICALL -Java_jogamp_opengl_gl4_GL4bcImpl_dispatch_1glMapNamedBufferEXT(JNIEnv *env, jobject _unused, jint target, jint access, jlong glProcAddress) { - typedef void *(APIENTRY*_local_PFNGLMAPNAMEDBUFFEREXTPROC) (GLuint buffer, GLenum access); - _local_PFNGLMAPNAMEDBUFFEREXTPROC ptr_glMapNamedBufferEXT; - void * _res; - ptr_glMapNamedBufferEXT = (_local_PFNGLMAPNAMEDBUFFEREXTPROC) (intptr_t) glProcAddress; - assert(ptr_glMapNamedBufferEXT != NULL); - _res = (* ptr_glMapNamedBufferEXT) ((GLuint) target, (GLenum) access); - return (jlong) (intptr_t) _res; -} - -/* Java->C glue code: - * Java package: jogamp.opengl.gl4.GL4bcImpl - * Java method: java.nio.ByteBuffer dispatch_glMapNamedBufferRangeEXT(int buffer, long offset, long length, int access) - * C function: void * glMapNamedBufferRangeEXT(GLuint buffer, GLintptr offset, GLsizeiptr length, GLbitfield access); - */ -JNIEXPORT jlong JNICALL -Java_jogamp_opengl_gl4_GL4bcImpl_dispatch_1glMapNamedBufferRangeEXT(JNIEnv *env, jobject _unused, jint buffer, jlong offset, jlong length, jint access, jlong procAddress) { - typedef void *(APIENTRY*_local_PFNGLMAPNAMEDBUFFERRANGEEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length, GLbitfield access); - _local_PFNGLMAPNAMEDBUFFERRANGEEXTPROC ptr_glMapNamedBufferRangeEXT; - void * _res; - ptr_glMapNamedBufferRangeEXT = (_local_PFNGLMAPNAMEDBUFFERRANGEEXTPROC) (intptr_t) procAddress; - assert(ptr_glMapNamedBufferRangeEXT != NULL); - _res = (* ptr_glMapNamedBufferRangeEXT) ((GLuint) buffer, (GLintptr) offset, (GLsizeiptr) length, (GLbitfield) access); - return (jlong) (intptr_t) _res; -} - /* Java->C glue code: * Java package: jogamp.opengl.gl4.GL4bcImpl @@ -143,3 +8,4 @@ JNIEXPORT jobject JNICALL Java_jogamp_opengl_gl4_GL4bcImpl_newDirectByteBuffer(JNIEnv *env, jobject _unused, jlong addr, jlong capacity) { return (*env)->NewDirectByteBuffer(env, (void*) (intptr_t) addr, capacity); } + diff --git a/make/config/jogl/gl-impl-CustomCCode-gles1.c b/make/config/jogl/gl-impl-CustomCCode-gles1.c index e7bb21a34..3b85e1466 100644 --- a/make/config/jogl/gl-impl-CustomCCode-gles1.c +++ b/make/config/jogl/gl-impl-CustomCCode-gles1.c @@ -1,70 +1,3 @@ -/* Java->C glue code: - * Java package: jogamp.opengl.es1.GLES1Impl - * Java method: void dispatch_glBufferData(int target, long size, java.nio.Buffer data, int usage) - * C function: void glBufferData(GLenum target, GLsizeiptr size, const GLvoid * data, GLenum usage); - */ -JNIEXPORT void JNICALL -Java_jogamp_opengl_es1_GLES1Impl_dispatch_1glBufferData(JNIEnv *env, jobject _unused, jint target, jlong size, jobject data, jint data_byte_offset, jboolean data_is_nio, jint usage, jlong procAddress) { - typedef void (GL_APIENTRY*_local_PFNGLBUFFERDATAPROC)(GLenum target, GLsizeiptr size, const GLvoid * data, GLenum usage); - _local_PFNGLBUFFERDATAPROC ptr_glBufferData; - GLvoid * _data_ptr = NULL; - if ( NULL != data ) { - _data_ptr = (GLvoid *) ( JNI_TRUE == data_is_nio ? (*env)->GetDirectBufferAddress(env, data) : (*env)->GetPrimitiveArrayCritical(env, data, NULL) ); } - ptr_glBufferData = (_local_PFNGLBUFFERDATAPROC) (intptr_t) procAddress; - assert(ptr_glBufferData != NULL); - (* ptr_glBufferData) ((GLenum) target, (GLsizeiptr) size, (GLvoid *) (((char *) _data_ptr) + data_byte_offset), (GLenum) usage); - if ( JNI_FALSE == data_is_nio && NULL != data ) { - (*env)->ReleasePrimitiveArrayCritical(env, data, _data_ptr, JNI_ABORT); } -} - -/* Java->C glue code: - * Java package: jogamp.opengl.es1.GLES1Impl - * Java method: boolean dispatch_glUnmapBuffer(int target) - * C function: GLboolean glUnmapBufferOES(GLenum target); - */ -JNIEXPORT jboolean JNICALL -Java_jogamp_opengl_es1_GLES1Impl_dispatch_1glUnmapBuffer(JNIEnv *env, jobject _unused, jint target, jlong procAddress) { - typedef GLboolean (GL_APIENTRY*_local_PFNGLUNMAPBUFFEROESPROC)(GLenum target); - _local_PFNGLUNMAPBUFFEROESPROC ptr_glUnmapBufferOES; - GLboolean _res; - ptr_glUnmapBufferOES = (_local_PFNGLUNMAPBUFFEROESPROC) (intptr_t) procAddress; - assert(ptr_glUnmapBufferOES != NULL); - _res = (* ptr_glUnmapBufferOES) ((GLenum) target); - return _res; -} - -typedef GLvoid* (GL_APIENTRY* PFNGLMAPBUFFERPROC) (GLenum target, GLenum access); -/* Java->C glue code: - * Java package: jogamp.opengl.es1.GLES1Impl - * Java method: long dispatch_glMapBuffer(int target, int access) - * C function: void * glMapBuffer(GLenum target, GLenum access); - */ -JNIEXPORT jlong JNICALL -Java_jogamp_opengl_es1_GLES1Impl_dispatch_1glMapBuffer(JNIEnv *env, jobject _unused, jint target, jint access, jlong glProcAddress) { - typedef void *(GL_APIENTRY*_local_PFNGLMAPBUFFERPROC) (GLenum target, GLenum access); - _local_PFNGLMAPBUFFERPROC ptr_glMapBuffer; - void * _res; - ptr_glMapBuffer = (_local_PFNGLMAPBUFFERPROC) (intptr_t) glProcAddress; - assert(ptr_glMapBuffer != NULL); - _res = (* ptr_glMapBuffer) ((GLenum) target, (GLenum) access); - return (jlong) (intptr_t) _res; -} - -/* Java->C glue code: - * Java package: jogamp.opengl.es1.GLES1Impl - * Java method: java.nio.ByteBuffer dispatch_glMapBufferRange(int target, long offset, long length, int access) - * C function: void * glMapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); - */ -JNIEXPORT jlong JNICALL -Java_jogamp_opengl_es1_GLES1Impl_dispatch_1glMapBufferRange(JNIEnv *env, jobject _unused, jint target, jlong offset, jlong length, jint access, jlong procAddress) { - typedef void * (GL_APIENTRY*_local_PFNGLMAPBUFFERRANGEPROC)(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); - _local_PFNGLMAPBUFFERRANGEPROC ptr_glMapBufferRange; - void * _res; - ptr_glMapBufferRange = (_local_PFNGLMAPBUFFERRANGEPROC) (intptr_t) procAddress; - assert(ptr_glMapBufferRange != NULL); - _res = (* ptr_glMapBufferRange) ((GLenum) target, (GLintptr) offset, (GLsizeiptr) length, (GLbitfield) access); - return (jlong) (intptr_t) _res; -} /* Java->C glue code: * Java package: jogamp.opengl.es1.GLES1Impl @@ -75,3 +8,4 @@ JNIEXPORT jobject JNICALL Java_jogamp_opengl_es1_GLES1Impl_newDirectByteBuffer(JNIEnv *env, jobject _unused, jlong addr, jlong capacity) { return (*env)->NewDirectByteBuffer(env, (void*) (intptr_t) addr, capacity); } + diff --git a/make/config/jogl/gl-impl-CustomCCode-gles3.c b/make/config/jogl/gl-impl-CustomCCode-gles3.c index f459bc865..d04a90efa 100644 --- a/make/config/jogl/gl-impl-CustomCCode-gles3.c +++ b/make/config/jogl/gl-impl-CustomCCode-gles3.c @@ -1,71 +1,3 @@ -/* Java->C glue code: - * Java package: jogamp.opengl.es3.GLES3Impl - * Java method: void dispatch_glBufferData(int target, long size, java.nio.Buffer data, int usage) - * C function: void glBufferData(GLenum target, GLsizeiptr size, const GLvoid * data, GLenum usage); - */ -JNIEXPORT void JNICALL -Java_jogamp_opengl_es3_GLES3Impl_dispatch_1glBufferData(JNIEnv *env, jobject _unused, jint target, jlong size, jobject data, jint data_byte_offset, jboolean data_is_nio, jint usage, jlong procAddress) { - typedef void (GL_APIENTRY*_local_PFNGLBUFFERDATAPROC)(GLenum target, GLsizeiptr size, const GLvoid * data, GLenum usage); - _local_PFNGLBUFFERDATAPROC ptr_glBufferData; - GLvoid * _data_ptr = NULL; - if ( NULL != data ) { - _data_ptr = (GLvoid *) ( JNI_TRUE == data_is_nio ? (*env)->GetDirectBufferAddress(env, data) : (*env)->GetPrimitiveArrayCritical(env, data, NULL) ); } - ptr_glBufferData = (_local_PFNGLBUFFERDATAPROC) (intptr_t) procAddress; - assert(ptr_glBufferData != NULL); - (* ptr_glBufferData) ((GLenum) target, (GLsizeiptr) size, (GLvoid *) (((char *) _data_ptr) + data_byte_offset), (GLenum) usage); - if ( JNI_FALSE == data_is_nio && NULL != data ) { - (*env)->ReleasePrimitiveArrayCritical(env, data, _data_ptr, JNI_ABORT); } -} - -/* Java->C glue code: - * Java package: jogamp.opengl.es3.GLES3Impl - * Java method: boolean dispatch_glUnmapBuffer(int target) - * C function: GLboolean glUnmapBuffer(GLenum target); - */ -JNIEXPORT jboolean JNICALL -Java_jogamp_opengl_es3_GLES3Impl_dispatch_1glUnmapBuffer(JNIEnv *env, jobject _unused, jint target, jlong procAddress) { - typedef GLboolean (GL_APIENTRY*_local_PFNGLUNMAPBUFFERPROC)(GLenum target); - _local_PFNGLUNMAPBUFFERPROC ptr_glUnmapBuffer; - GLboolean _res; - ptr_glUnmapBuffer = (_local_PFNGLUNMAPBUFFERPROC) (intptr_t) procAddress; - assert(ptr_glUnmapBuffer != NULL); - _res = (* ptr_glUnmapBuffer) ((GLenum) target); - return _res; -} - -typedef GLvoid* (GL_APIENTRY* PFNGLMAPBUFFERPROC) (GLenum target, GLenum access); - -/* Java->C glue code: - * Java package: jogamp.opengl.es3.GLES3Impl - * Java method: long dispatch_glMapBuffer(int target, int access) - * C function: void * glMapBuffer(GLenum target, GLenum access); - */ -JNIEXPORT jlong JNICALL -Java_jogamp_opengl_es3_GLES3Impl_dispatch_1glMapBuffer(JNIEnv *env, jobject _unused, jint target, jint access, jlong glProcAddress) { - typedef void *(GL_APIENTRY*_local_PFNGLMAPBUFFERPROC) (GLenum target, GLenum access); - _local_PFNGLMAPBUFFERPROC ptr_glMapBuffer; - void * _res; - ptr_glMapBuffer = (_local_PFNGLMAPBUFFERPROC) (intptr_t) glProcAddress; - assert(ptr_glMapBuffer != NULL); - _res = (* ptr_glMapBuffer) ((GLenum) target, (GLenum) access); - return (jlong) (intptr_t) _res; -} - -/* Java->C glue code: - * Java package: jogamp.opengl.es3.GLES3Impl - * Java method: java.nio.ByteBuffer dispatch_glMapBufferRange(int target, long offset, long length, int access) - * C function: void * glMapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); - */ -JNIEXPORT jlong JNICALL -Java_jogamp_opengl_es3_GLES3Impl_dispatch_1glMapBufferRange(JNIEnv *env, jobject _unused, jint target, jlong offset, jlong length, jint access, jlong procAddress) { - typedef void * (GL_APIENTRY*_local_PFNGLMAPBUFFERRANGEPROC)(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); - _local_PFNGLMAPBUFFERRANGEPROC ptr_glMapBufferRange; - void * _res; - ptr_glMapBufferRange = (_local_PFNGLMAPBUFFERRANGEPROC) (intptr_t) procAddress; - assert(ptr_glMapBufferRange != NULL); - _res = (* ptr_glMapBufferRange) ((GLenum) target, (GLintptr) offset, (GLsizeiptr) length, (GLbitfield) access); - return (jlong) (intptr_t) _res; -} /* Java->C glue code: * Java package: jogamp.opengl.es3.GLES3Impl @@ -76,3 +8,4 @@ JNIEXPORT jobject JNICALL Java_jogamp_opengl_es3_GLES3Impl_newDirectByteBuffer(JNIEnv *env, jobject _unused, jlong addr, jlong capacity) { return (*env)->NewDirectByteBuffer(env, (void*) (intptr_t) addr, capacity); } + diff --git a/make/config/jogl/gl-impl-CustomJavaCode-common.java b/make/config/jogl/gl-impl-CustomJavaCode-common.java index 503c125f0..6ecb886b7 100644 --- a/make/config/jogl/gl-impl-CustomJavaCode-common.java +++ b/make/config/jogl/gl-impl-CustomJavaCode-common.java @@ -136,52 +136,61 @@ private final GLBufferObjectTracker bufferObjectTracker; private final GLBufferStateTracker bufferStateTracker; + @Override + public final void glBufferData(int target, long size, Buffer data, int usage) { + bufferObjectTracker.createBufferStorage(bufferStateTracker, this, + target, size, data, usage, 0 /* immutableFlags */, + createBoundMutableStorageDispatch); + } private final jogamp.opengl.GLBufferObjectTracker.CreateStorageDispatch createBoundMutableStorageDispatch = new jogamp.opengl.GLBufferObjectTracker.CreateStorageDispatch() { - public final void create(final int target, final long size, final Buffer data, final int mutableUsage, final long glProcAddress) { - final boolean data_is_direct = Buffers.isDirect(data); - dispatch_glBufferData(target, size, - data_is_direct ? data : Buffers.getArray(data), - data_is_direct ? Buffers.getDirectBufferByteOffset(data) : Buffers.getIndirectBufferByteOffset(data), - data_is_direct, mutableUsage, glProcAddress); + public final void create(final int target, final long size, final Buffer data, final int mutableUsage) { + glBufferDataDelegate(target, size, data, mutableUsage); } }; - private native void dispatch_glBufferData(int target, long size, Object data, int data_byte_offset, boolean data_is_direct, int usage, long procAddress); + @Override + public boolean glUnmapBuffer(int target) { + return bufferObjectTracker.unmapBuffer(bufferStateTracker, this, target, unmapBoundBufferDispatch); + } private final jogamp.opengl.GLBufferObjectTracker.UnmapBufferDispatch unmapBoundBufferDispatch = new jogamp.opengl.GLBufferObjectTracker.UnmapBufferDispatch() { - public final boolean unmap(final int target, final long glProcAddress) { - return dispatch_glUnmapBuffer(target, glProcAddress); + public final boolean unmap(final int target) { + return glUnmapBufferDelegate(target); } }; - private native boolean dispatch_glUnmapBuffer(int target, long procAddress); @Override public final java.nio.ByteBuffer glMapBuffer(int target, int access) { return mapBuffer(target, access).getMappedBuffer(); } - @Override - public final ByteBuffer glMapBufferRange(int target, long offset, long length, int access) { - return mapBufferRange(target, offset, length, access).getMappedBuffer(); + public final GLBufferStorage mapBuffer(final int target, final int access) { + return bufferObjectTracker.mapBuffer(bufferStateTracker, this, target, access, mapBoundBufferAllDispatch); } - private final jogamp.opengl.GLBufferObjectTracker.MapBufferAllDispatch mapBoundBufferAllDispatch = new jogamp.opengl.GLBufferObjectTracker.MapBufferAllDispatch() { public final ByteBuffer allocNioByteBuffer(final long addr, final long length) { return newDirectByteBuffer(addr, length); } - public final long mapBuffer(final int target, final int access, final long glProcAddress) { - return dispatch_glMapBuffer(target, access, glProcAddress); + public final long mapBuffer(final int target, final int access) { + return glMapBufferDelegate(target, access); } }; - private native long dispatch_glMapBuffer(int target, int access, long glProcAddress); + @Override + public final ByteBuffer glMapBufferRange(int target, long offset, long length, int access) { + return mapBufferRange(target, offset, length, access).getMappedBuffer(); + } + @Override + public final GLBufferStorage mapBufferRange(final int target, final long offset, final long length, final int access) { + return bufferObjectTracker.mapBuffer(bufferStateTracker, this, target, offset, length, access, mapBoundBufferRangeDispatch); + } private final jogamp.opengl.GLBufferObjectTracker.MapBufferRangeDispatch mapBoundBufferRangeDispatch = new jogamp.opengl.GLBufferObjectTracker.MapBufferRangeDispatch() { public final ByteBuffer allocNioByteBuffer(final long addr, final long length) { return newDirectByteBuffer(addr, length); } - public final long mapBuffer(final int target, final long offset, final long length, final int access, final long glProcAddress) { - return dispatch_glMapBufferRange(target, offset, length, access, glProcAddress); + public final long mapBuffer(final int target, final long offset, final long length, final int access) { + return glMapBufferRangeDelegate(target, offset, length, access); } }; - private native long dispatch_glMapBufferRange(int target, long offset, long length, int access, long glProcAddress); private native ByteBuffer newDirectByteBuffer(long addr, long capacity); + diff --git a/make/config/jogl/gl-impl-CustomJavaCode-gl4bc.java b/make/config/jogl/gl-impl-CustomJavaCode-gl4bc.java index 09edaaf7d..72f4707a2 100644 --- a/make/config/jogl/gl-impl-CustomJavaCode-gl4bc.java +++ b/make/config/jogl/gl-impl-CustomJavaCode-gl4bc.java @@ -465,144 +465,86 @@ public final void glTexCoordPointer(GLArrayData array) { // @Override -public final void glBufferData(int target, long size, Buffer data, int usage) { - final long glProcAddress = _pat._addressof_glBufferData; - if ( 0 == glProcAddress ) { - throw new GLException(String.format("Method \"%s\" not available", "glBufferData")); - } - bufferObjectTracker.createBufferStorage(bufferStateTracker, this, - target, size, data, usage, 0 /* immutableFlags */, - createBoundMutableStorageDispatch, glProcAddress); +public final void glNamedBufferData(int buffer, long size, Buffer data, int usage) { + bufferObjectTracker.createBufferStorage(this, + buffer, size, data, usage, 0 /* immutableFlags */, + createNamedMutableStorageDispatch); } -/** FIXME Add for OpenGL 4.4 +private final jogamp.opengl.GLBufferObjectTracker.CreateStorageDispatch createNamedMutableStorageDispatch = + new jogamp.opengl.GLBufferObjectTracker.CreateStorageDispatch() { + public final void create(final int buffer, final long size, final Buffer data, final int mutableUsage) { + glNamedBufferDataDelegate(buffer, size, data, mutableUsage); + } + }; + @Override public final void glBufferStorage(int target, long size, Buffer data, int flags) { - final long glProcAddress = _pat._addressof_glBufferStorage; - if ( 0 == glProcAddress ) { - throw new GLException(String.format("Method \"%s\" not available", "glBufferStorage")); - } bufferObjectTracker.createBufferStorage(bufferStateTracker, this, - target, size, data, 0 * mutableUsage *, flags, - createBoundImmutableStorageDispatch, glProcAddress); + target, size, data, 0 /* mutableUsage */, flags, + createBoundImmutableStorageDispatch); } private final jogamp.opengl.GLBufferObjectTracker.CreateStorageDispatch createBoundImmutableStorageDispatch = new jogamp.opengl.GLBufferObjectTracker.CreateStorageDispatch() { - public final void create(final int target, final long size, final Buffer data, final int immutableFlags, final long glProcAddress) { - final boolean data_is_direct = Buffers.isDirect(data); - dispatch_glBufferStorage(target, size, - data_is_direct ? data : Buffers.getArray(data), - data_is_direct ? Buffers.getDirectBufferByteOffset(data) : Buffers.getIndirectBufferByteOffset(data), - data_is_direct, immutableFlags, glProcAddress); + public final void create(final int target, final long size, final Buffer data, final int immutableFlags) { + glBufferStorageDelegate(target, size, data, immutableFlags); } }; -private native void dispatch_glBufferStorage(int target, long size, Object data, int data_byte_offset, boolean data_is_direct, int flags, long procAddress); - */ @Override -public final void glNamedBufferDataEXT(int buffer, long size, Buffer data, int usage) { - final long glProcAddress = _pat._addressof_glNamedBufferDataEXT; - if ( 0 == glProcAddress ) { - throw new GLException(String.format("Method \"%s\" not available", "glNamedBufferDataEXT")); - } +public final void glNamedBufferStorage(int buffer, long size, Buffer data, int flags) { bufferObjectTracker.createBufferStorage(this, - buffer, size, data, usage, 0 /* immutableFlags */, - createNamedStorageDispatch, glProcAddress); + buffer, size, data, 0 /* mutableUsage */, flags, + createNamedImmutableStorageDispatch); } -private final jogamp.opengl.GLBufferObjectTracker.CreateStorageDispatch createNamedStorageDispatch = +private final jogamp.opengl.GLBufferObjectTracker.CreateStorageDispatch createNamedImmutableStorageDispatch = new jogamp.opengl.GLBufferObjectTracker.CreateStorageDispatch() { - public final void create(final int buffer, final long size, final Buffer data, final int mutableUsage, final long glProcAddress) { - final boolean data_is_direct = Buffers.isDirect(data); - dispatch_glNamedBufferDataEXT(buffer, size, - data_is_direct ? data : Buffers.getArray(data), - data_is_direct ? Buffers.getDirectBufferByteOffset(data) : Buffers.getIndirectBufferByteOffset(data), - data_is_direct, mutableUsage, glProcAddress); + public final void create(final int buffer, final long size, final Buffer data, final int immutableFlags) { + glNamedBufferStorageDelegate(buffer, size, data, immutableFlags); } }; -private native void dispatch_glNamedBufferDataEXT(int buffer, long size, Object data, int data_byte_offset, boolean data_is_direct, int usage, long procAddress); @Override -public boolean glUnmapBuffer(int target) { - final long glProcAddress = _pat._addressof_glUnmapBuffer; - if ( 0 == glProcAddress ) { - throw new GLException(String.format("Method \"%s\" not available", "glUnmapBuffer")); - } - return bufferObjectTracker.unmapBuffer(bufferStateTracker, this, target, unmapBoundBufferDispatch, glProcAddress); -} - -@Override -public boolean glUnmapNamedBufferEXT(int buffer) { - final long glProcAddress = _pat._addressof_glUnmapNamedBufferEXT; - if ( 0 == glProcAddress ) { - throw new GLException(String.format("Method \"%s\" not available", "glUnmapNamedBufferEXT")); - } - return bufferObjectTracker.unmapBuffer(buffer, unmapNamedBufferDispatch, glProcAddress); +public boolean glUnmapNamedBuffer(int buffer) { + return bufferObjectTracker.unmapBuffer(buffer, unmapNamedBufferDispatch); } private final jogamp.opengl.GLBufferObjectTracker.UnmapBufferDispatch unmapNamedBufferDispatch = new jogamp.opengl.GLBufferObjectTracker.UnmapBufferDispatch() { - public final boolean unmap(final int buffer, final long glProcAddress) { - return dispatch_glUnmapNamedBufferEXT(buffer, glProcAddress); + public final boolean unmap(final int buffer) { + return glUnmapNamedBufferDelegate(buffer); } }; -private native boolean dispatch_glUnmapNamedBufferEXT(int buffer, long procAddress); - -@Override -public final GLBufferStorage mapBuffer(final int target, final int access) { - final long glProcAddress = _pat._addressof_glMapBuffer; - if ( 0 == glProcAddress ) { - throw new GLException("Method \"glMapBuffer\" not available"); - } - return bufferObjectTracker.mapBuffer(bufferStateTracker, this, target, access, mapBoundBufferAllDispatch, glProcAddress); -} -@Override -public final GLBufferStorage mapBufferRange(final int target, final long offset, final long length, final int access) { - final long glProcAddress = _pat._addressof_glMapBufferRange; - if ( 0 == glProcAddress ) { - throw new GLException("Method \"glMapBufferRange\" not available"); - } - return bufferObjectTracker.mapBuffer(bufferStateTracker, this, target, offset, length, access, mapBoundBufferRangeDispatch, glProcAddress); -} @Override public final GLBufferStorage mapNamedBuffer(final int bufferName, final int access) { - final long glProcAddress = _pat._addressof_glMapNamedBufferEXT; - if ( 0 == glProcAddress ) { - throw new GLException("Method \"glMapNamedBufferEXT\" not available"); - } - return bufferObjectTracker.mapBuffer(bufferName, access, mapNamedBufferAllDispatch, glProcAddress); + return bufferObjectTracker.mapBuffer(bufferName, access, mapNamedBufferAllDispatch); } private final jogamp.opengl.GLBufferObjectTracker.MapBufferAllDispatch mapNamedBufferAllDispatch = new jogamp.opengl.GLBufferObjectTracker.MapBufferAllDispatch() { public final ByteBuffer allocNioByteBuffer(final long addr, final long length) { return newDirectByteBuffer(addr, length); } - public final long mapBuffer(final int bufferName, final int access, final long glProcAddress) { - return dispatch_glMapNamedBufferEXT(bufferName, access, glProcAddress); + public final long mapBuffer(final int bufferName, final int access) { + return glMapNamedBufferDelegate(bufferName, access); } }; -private native long dispatch_glMapNamedBufferEXT(int buffer, int access, long glProcAddress); @Override public final GLBufferStorage mapNamedBufferRange(final int bufferName, final long offset, final long length, final int access) { - final long glProcAddress = _pat._addressof_glMapNamedBufferRangeEXT; - if ( 0 == glProcAddress ) { - throw new GLException("Method \"glMapNamedBufferRangeEXT\" not available"); - } - return bufferObjectTracker.mapBuffer(bufferName, offset, length, access, mapNamedBufferRangeDispatch, glProcAddress); + return bufferObjectTracker.mapBuffer(bufferName, offset, length, access, mapNamedBufferRangeDispatch); } private final jogamp.opengl.GLBufferObjectTracker.MapBufferRangeDispatch mapNamedBufferRangeDispatch = new jogamp.opengl.GLBufferObjectTracker.MapBufferRangeDispatch() { public final ByteBuffer allocNioByteBuffer(final long addr, final long length) { return newDirectByteBuffer(addr, length); } - public final long mapBuffer(final int bufferName, final long offset, final long length, final int access, final long glProcAddress) { - return dispatch_glMapNamedBufferRangeEXT(bufferName, offset, length, access, glProcAddress); + public final long mapBuffer(final int bufferName, final long offset, final long length, final int access) { + return glMapNamedBufferRangeDelegate(bufferName, offset, length, access); } }; -private native long dispatch_glMapNamedBufferRangeEXT(int buffer, long offset, long length, int access, long procAddress); @Override -public final java.nio.ByteBuffer glMapNamedBufferEXT(int bufferName, int access) { +public final java.nio.ByteBuffer glMapNamedBuffer(int bufferName, int access) { return mapNamedBuffer(bufferName, access).getMappedBuffer(); } @Override -public final ByteBuffer glMapNamedBufferRangeEXT(int bufferName, long offset, long length, int access) { +public final ByteBuffer glMapNamedBufferRange(int bufferName, long offset, long length, int access) { return mapNamedBufferRange(bufferName, offset, length, access).getMappedBuffer(); } diff --git a/make/config/jogl/gl-impl-CustomJavaCode-gles1.java b/make/config/jogl/gl-impl-CustomJavaCode-gles1.java index ecc30e11b..5300a1e3b 100644 --- a/make/config/jogl/gl-impl-CustomJavaCode-gles1.java +++ b/make/config/jogl/gl-impl-CustomJavaCode-gles1.java @@ -314,44 +314,3 @@ public final void glTexCoordPointer(GLArrayData array) { } } -// -// GLBufferObjectTracker Redirects -// - -@Override -public final void glBufferData(int target, long size, Buffer data, int usage) { - final long glProcAddress = _pat._addressof_glBufferData; - if ( 0 == glProcAddress ) { - throw new GLException(String.format("Method \"%s\" not available", "glBufferData")); - } - bufferObjectTracker.createBufferStorage(bufferStateTracker, this, - target, size, data, usage, 0 /* immutableFlags */, - createBoundMutableStorageDispatch, glProcAddress); -} - -@Override -public boolean glUnmapBuffer(int target) { - final long glProcAddress = _pat._addressof_glUnmapBuffer; - if ( 0 == glProcAddress ) { - throw new GLException(String.format("Method \"%s\" not available", "glUnmapBuffer")); - } - return bufferObjectTracker.unmapBuffer(bufferStateTracker, this, target, unmapBoundBufferDispatch, glProcAddress); -} - -@Override -public final GLBufferStorage mapBuffer(final int target, final int access) { - final long glProcAddress = _pat._addressof_glMapBuffer; - if ( 0 == glProcAddress ) { - throw new GLException("Method \"glMapBuffer\" not available"); - } - return bufferObjectTracker.mapBuffer(bufferStateTracker, this, target, access, mapBoundBufferAllDispatch, glProcAddress); -} -@Override -public final GLBufferStorage mapBufferRange(final int target, final long offset, final long length, final int access) { - final long glProcAddress = _pat._addressof_glMapBufferRange; - if ( 0 == glProcAddress ) { - throw new GLException("Method \"glMapBufferRange\" not available"); - } - return bufferObjectTracker.mapBuffer(bufferStateTracker, this, target, offset, length, access, mapBoundBufferRangeDispatch, glProcAddress); -} - diff --git a/make/config/jogl/gl-impl-CustomJavaCode-gles3.java b/make/config/jogl/gl-impl-CustomJavaCode-gles3.java index 3e0585e96..1e9082330 100644 --- a/make/config/jogl/gl-impl-CustomJavaCode-gles3.java +++ b/make/config/jogl/gl-impl-CustomJavaCode-gles3.java @@ -374,45 +374,3 @@ public final void glDepthRange(double zNear, double zFar) { glDepthRangef((float)zNear, (float)zFar); } -// -// GLBufferObjectTracker Redirects -// - -@Override -public final void glBufferData(int target, long size, Buffer data, int usage) { - final long glProcAddress = _pat._addressof_glBufferData; - if ( 0 == glProcAddress ) { - throw new GLException(String.format("Method \"%s\" not available", "glBufferData")); - } - bufferObjectTracker.createBufferStorage(bufferStateTracker, this, - target, size, data, usage, 0 /* immutableFlags */, - createBoundMutableStorageDispatch, glProcAddress); -} - -@Override -public boolean glUnmapBuffer(int target) { - final long glProcAddress = _pat._addressof_glUnmapBuffer; - if ( 0 == glProcAddress ) { - throw new GLException(String.format("Method \"%s\" not available", "glUnmapBuffer")); - } - return bufferObjectTracker.unmapBuffer(bufferStateTracker, this, target, unmapBoundBufferDispatch, glProcAddress); -} - -@Override -public final GLBufferStorage mapBuffer(final int target, final int access) { - final long glProcAddress = _pat._addressof_glMapBuffer; - if ( 0 == glProcAddress ) { - throw new GLException("Method \"glMapBuffer\" not available"); - } - return bufferObjectTracker.mapBuffer(bufferStateTracker, this, target, access, mapBoundBufferAllDispatch, glProcAddress); -} -@Override -public final GLBufferStorage mapBufferRange(final int target, final long offset, final long length, final int access) { - final long glProcAddress = _pat._addressof_glMapBufferRange; - if ( 0 == glProcAddress ) { - throw new GLException("Method \"glMapBufferRange\" not available"); - } - return bufferObjectTracker.mapBuffer(bufferStateTracker, this, target, offset, length, access, mapBoundBufferRangeDispatch, glProcAddress); -} - - diff --git a/make/scripts/gluegen-gl.sh b/make/scripts/gluegen-gl.sh index d337689ca..6b978c16a 100644 --- a/make/scripts/gluegen-gl.sh +++ b/make/scripts/gluegen-gl.sh @@ -1,7 +1,7 @@ #! /bin/bash -#rootrel=build-x86_64 -rootrel=build-x86_64-clang +rootrel=build-x86_64 +#rootrel=build-x86_64-clang builddir=../$rootrel buildtmp=../build-temp @@ -885,10 +885,10 @@ function gluegen_all() { # # gluegen_if_gl # gluegen_gl2es1 -# gluegen_es1 + gluegen_es1 # gluegen_gl2es2 # gluegen_es2 - gluegen_gl2es3 +# gluegen_gl2es3 # gluegen_gl3es3 # gluegen_es3 # gluegen_es3_impl diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh index 2bf1414f6..16bd57c1f 100644 --- a/make/scripts/tests.sh +++ b/make/scripts/tests.sh @@ -182,7 +182,7 @@ function jrun() { #D_ARGS="-Djogl.debug.GLArrayData" #D_ARGS="-Dnewt.debug.Screen -Dnewt.debug.Window" #D_ARGS="-Dnewt.debug.Window" - D_ARGS="-Dnewt.debug.Screen" + #D_ARGS="-Dnewt.debug.Screen" #D_ARGS="-Dnewt.test.Screen.disableRandR13" #D_ARGS="-Dnewt.test.Screen.disableScreenMode -Dnewt.debug.Screen" #D_ARGS="-Dnewt.debug.Screen -Djogl.debug.Animator" @@ -505,7 +505,7 @@ function testawtswt() { #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGPUMemSec01NEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLException01NEWT $* -#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestMapBufferRead01NEWT $* +testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestMapBufferRead01NEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestRedSquareES2NEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT $* @@ -613,7 +613,7 @@ function testawtswt() { #testnoawt com.jogamp.opengl.test.junit.newt.TestDisplayLifecycle01NEWT #testnoawt com.jogamp.opengl.test.junit.newt.TestDisplayLifecycle02NEWT #testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT $* -testnoawt com.jogamp.opengl.test.junit.newt.mm.TestScreenMode00aNEWT $* +#testnoawt com.jogamp.opengl.test.junit.newt.mm.TestScreenMode00aNEWT $* #testnoawt com.jogamp.opengl.test.junit.newt.mm.TestScreenMode00bNEWT $* #testnoawt com.jogamp.opengl.test.junit.newt.mm.TestScreenMode00cNEWT $* #testnoawt com.jogamp.opengl.test.junit.newt.mm.TestScreenMode01aNEWT $* diff --git a/src/jogl/classes/com/jogamp/gluegen/opengl/GLConfiguration.java b/src/jogl/classes/com/jogamp/gluegen/opengl/GLConfiguration.java index 878d7da37..d6f72ee29 100644 --- a/src/jogl/classes/com/jogamp/gluegen/opengl/GLConfiguration.java +++ b/src/jogl/classes/com/jogamp/gluegen/opengl/GLConfiguration.java @@ -290,10 +290,10 @@ public class GLConfiguration extends ProcAddressConfiguration { } } if( ignoreExtension ) { - LOG.log(INFO, getASTLocusTag(symbol), "Ignored symbol {0} of all extensions <{1}>", symbol.getAliasedString(), symExtensionNames); + LOG.log(INFO, getASTLocusTag(symbol), "Ignored symbol {0} of all extensions <{1}>", symbol, symExtensionNames); } else if( ignoredSymExtensionNames.size() > 0 ) { LOG.log(INFO, getASTLocusTag(symbol), "Not ignored symbol {0}; Ignored in <{1}>, but active in <{2}>", - symbol.getAliasedString(), ignoredSymExtensionNames, notIgnoredSymExtensionNames); + symbol, ignoredSymExtensionNames, notIgnoredSymExtensionNames); } } if( !ignoreExtension ) { @@ -307,14 +307,14 @@ public class GLConfiguration extends ProcAddressConfiguration { extSuffix = GLNameResolver.getExtensionSuffix(name, isGLFunc); if (getDropUniqVendorExtensions(extSuffix)) { LOG.log(INFO, getASTLocusTag(symbol), "Ignore UniqVendorEXT: {0}, vendor {1}, isGLFunc {2}, isGLEnum {3}", - symbol.getAliasedString(), extSuffix, isGLFunc, isGLEnum); + symbol, extSuffix, isGLFunc, isGLEnum); ignoreExtension = true; } } } if (!ignoreExtension) { LOG.log(INFO, getASTLocusTag(symbol), "Not ignored UniqVendorEXT: {0}, vendor {1}, isGLFunc {2}, isGLEnum {3}", - symbol.getAliasedString(), extSuffix, isGLFunc, isGLEnum); + symbol, extSuffix, isGLFunc, isGLEnum); } } if( ignoreExtension ) { @@ -326,8 +326,7 @@ public class GLConfiguration extends ProcAddressConfiguration { for(final Iterator<String> i=symExtensionNames.iterator(); i.hasNext(); ) { final String extensionName = i.next(); if ( extensionName != null && forcedExtensions.contains(extensionName) ) { - LOG.log(INFO, getASTLocusTag(symbol), "Not ignored symbol {0} of extension <{1}>", - symbol.getAliasedString(), extensionName); + LOG.log(INFO, getASTLocusTag(symbol), "Not ignored symbol {0} of extension <{1}>", symbol, extensionName); return true; } } diff --git a/src/jogl/classes/com/jogamp/gluegen/opengl/nativesig/NativeSignatureEmitter.java b/src/jogl/classes/com/jogamp/gluegen/opengl/nativesig/NativeSignatureEmitter.java index 44e52e2fa..c1c2aa12b 100644 --- a/src/jogl/classes/com/jogamp/gluegen/opengl/nativesig/NativeSignatureEmitter.java +++ b/src/jogl/classes/com/jogamp/gluegen/opengl/nativesig/NativeSignatureEmitter.java @@ -51,7 +51,6 @@ import java.io.PrintWriter; import java.util.ArrayList; import java.util.Iterator; import java.util.List; -import java.util.Set; /** * Emitter producing NativeSignature attributes. @@ -61,10 +60,10 @@ import java.util.Set; public class NativeSignatureEmitter extends GLEmitter { @Override - protected List<? extends FunctionEmitter> generateMethodBindingEmitters(final Set<MethodBinding> methodBindingSet, final FunctionSymbol sym) throws Exception { + protected List<? extends FunctionEmitter> generateMethodBindingEmitters(final FunctionSymbol sym) throws Exception { // Allow superclass to do most of the work for us - final List<? extends FunctionEmitter> res = super.generateMethodBindingEmitters(methodBindingSet, sym); + final List<? extends FunctionEmitter> res = super.generateMethodBindingEmitters(sym); // Filter out all non-JavaMethodBindingEmitters for (final Iterator<? extends FunctionEmitter> iter = res.iterator(); iter.hasNext();) { diff --git a/src/jogl/classes/com/jogamp/opengl/GLBufferStorage.java b/src/jogl/classes/com/jogamp/opengl/GLBufferStorage.java index 5db97d42f..35ecf8799 100644 --- a/src/jogl/classes/com/jogamp/opengl/GLBufferStorage.java +++ b/src/jogl/classes/com/jogamp/opengl/GLBufferStorage.java @@ -27,6 +27,7 @@ */ package com.jogamp.opengl; +import java.nio.Buffer; import java.nio.ByteBuffer; import java.nio.IntBuffer; @@ -40,9 +41,10 @@ import java.nio.IntBuffer; * <p> * Buffer storage is created via: * <ul> - * <li><code>glBufferStorage</code> - storage creation with target</li> - * <li>{@link GL#glBufferData(int, long, java.nio.Buffer, int)} - storage recreation with target</li> - * <li>{@link GL2#glNamedBufferDataEXT(int, long, java.nio.Buffer, int)} - storage recreation, direct</li> + * <li>{@link GL#glBufferData(int, long, java.nio.Buffer, int)} - storage creation via target</li> + * <li>{@link GL2#glNamedBufferData(int, long, java.nio.Buffer, int)} - storage creation, direct</li> + * <li>{@link GL4#glBufferStorage(int, long, Buffer, int)} - storage creation via target</li> + * <li>{@link GL4#glNamedBufferStorage(int, long, Buffer, int)} - storage creation, direct</li> * </ul> * Note that storage <i>recreation</i> as mentioned above also invalidate a previous storage instance, * i.e. disposed the buffer's current storage if exist and attaches a new storage instance. @@ -52,7 +54,9 @@ import java.nio.IntBuffer; * <ul> * <li>{@link GL#glDeleteBuffers(int, IntBuffer)} - explicit, direct, via {@link #notifyBuffersDeleted(int, IntBuffer)} or {@link #notifyBuffersDeleted(int, int[], int)}</li> * <li>{@link GL#glBufferData(int, long, java.nio.Buffer, int)} - storage recreation via target</li> - * <li>{@link GL2#glNamedBufferDataEXT(int, long, java.nio.Buffer, int)} - storage recreation, direct</li> + * <li>{@link GL2#glNamedBufferData(int, long, java.nio.Buffer, int)} - storage recreation, direct</li> + * <li>{@link GL4#glBufferStorage(int, long, Buffer, int)} - storage recreation via target</li> + * <li>{@link GL4#glNamedBufferStorage(int, long, Buffer, int)} - storage recreation, direct</li> * </ul> * </p> * <p> @@ -112,7 +116,7 @@ public abstract class GLBufferStorage { * created via {@link GL#glBufferData(int, long, java.nio.Buffer, int)}. * <p> * Returns <code>false</code> if buffer's storage is immutable, i.e. - * created via <code>glBufferStorage</code>. FIXME: Add GL 4.4 support! + * created via {@link GL4#glBufferStorage(int, long, Buffer, int)}. * </p> * @return */ diff --git a/src/jogl/classes/jogamp/opengl/GLBufferObjectTracker.java b/src/jogl/classes/jogamp/opengl/GLBufferObjectTracker.java index 2fa282d6e..89b23139f 100644 --- a/src/jogl/classes/jogamp/opengl/GLBufferObjectTracker.java +++ b/src/jogl/classes/jogamp/opengl/GLBufferObjectTracker.java @@ -47,9 +47,10 @@ import com.jogamp.common.util.PropertyAccess; * <p> * Buffer storage is created via * <ul> - * <li><code>glBufferStorage</code> - storage creation with target via {@link #createBufferStorage(GLBufferStateTracker, GL, int, long, Buffer, int, int, CreateStorageDispatch, long)}</li> * <li>{@link GL#glBufferData(int, long, java.nio.Buffer, int)} - storage recreation with target via {@link #createBufferStorage(GLBufferStateTracker, GL, int, long, Buffer, int, int, CreateStorageDispatch, long)}</li> - * <li>{@link GL2#glNamedBufferDataEXT(int, long, java.nio.Buffer, int)} - storage recreation, direct, via {@link #createBufferStorage(GL, int, long, Buffer, int, CreateStorageDispatch, long)}</li> + * <li>{@link GL2#glNamedBufferData(int, long, java.nio.Buffer, int)} - storage recreation, direct, via {@link #createBufferStorage(GL, int, long, Buffer, int, CreateStorageDispatch, long)}</li> + * <li>{@link GL4#glBufferStorage(int, long, Buffer, int)} - storage creation with target via {@link #createBufferStorage(GLBufferStateTracker, GL, int, long, Buffer, int, int, CreateStorageDispatch, long)}</li> + * <li>{@link GL4#glNamedBufferStorage(int, long, Buffer, int)} - storage recreation, direct, via {@link #createBufferStorage(GL, int, long, Buffer, int, CreateStorageDispatch, long)}</li> * </ul> * Note that storage <i>recreation</i> as mentioned above also invalidate a previous storage instance, * i.e. disposed the buffer's current storage if exist and attaches a new storage instance. @@ -59,7 +60,9 @@ import com.jogamp.common.util.PropertyAccess; * <ul> * <li>{@link GL#glDeleteBuffers(int, IntBuffer)} - explicit, direct, via {@link #notifyBuffersDeleted(int, IntBuffer)} or {@link #notifyBuffersDeleted(int, int[], int)}</li> * <li>{@link GL#glBufferData(int, long, java.nio.Buffer, int)} - storage recreation via target</li> - * <li>{@link GL2#glNamedBufferDataEXT(int, long, java.nio.Buffer, int)} - storage recreation, direct</li> + * <li>{@link GL2#glNamedBufferData(int, long, java.nio.Buffer, int)} - storage recreation, direct</li> + * <li>{@link GL4#glBufferStorage(int, long, Buffer, int)} - storage recreation via target</li> + * <li>{@link GL4#glNamedBufferStorage(int, long, Buffer, int)} - storage recreation, direct</li> * </ul> * </p> * @@ -130,18 +133,19 @@ public class GLBufferObjectTracker { } public static interface CreateStorageDispatch { - void create(final int targetOrBufferName, final long size, final Buffer data, final int mutableUsageOrImmutableFlags, final long glProcAddress); + void create(final int targetOrBufferName, final long size, final Buffer data, final int mutableUsageOrImmutableFlags); } /** - * Must be called when [re]creating the GL buffer object via <code>glBufferStorage</code> and {@link GL#glBufferData(int, long, java.nio.Buffer, int)}, + * Must be called when [re]creating the GL buffer object via {@link GL#glBufferData(int, long, java.nio.Buffer, int)} + * and {@link GL4#glBufferStorage(int, long, Buffer, int)}, * i.e. implies destruction of the buffer. * * @param bufferStateTracker * @param caller * @param target * @param size - * @param mutableUsage <code>glBufferData</code>, <code>glNamedBufferDataEXT</code> usage + * @param mutableUsage <code>glBufferData</code>, <code>glNamedBufferData</code> usage * @param immutableFlags <code>glBufferStorage</code> flags * @throws GLException if buffer is not bound to target * @throws GLException if size is less-or-eqaul zero for <code>glBufferStorage</code>, or size is less-than zero otherwise @@ -149,7 +153,7 @@ public class GLBufferObjectTracker { */ public synchronized final void createBufferStorage(final GLBufferStateTracker bufferStateTracker, final GL caller, final int target, final long size, final Buffer data, final int mutableUsage, final int immutableFlags, - final CreateStorageDispatch dispatch, final long glProcAddress) throws GLException { + final CreateStorageDispatch dispatch) throws GLException { final int glerrPre = caller.glGetError(); // clear if (DEBUG && GL.GL_NO_ERROR != glerrPre) { System.err.printf("%s.%s glerr-pre 0x%X%n", msgClazzName, msgCreateBound, glerrPre); @@ -159,13 +163,13 @@ public class GLBufferObjectTracker { throw new GLException(String.format("%s: Buffer for target 0x%X not bound", GL_INVALID_OPERATION, target)); } final boolean mutableBuffer = 0 != mutableUsage; - final boolean invalidSize = ( mutableBuffer && 0 > size ) // glBufferData, glNamedBufferDataEXT + 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)); } - dispatch.create(target, size, data, mutableBuffer ? mutableUsage : immutableFlags, glProcAddress); + dispatch.create(target, 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 target 0x%X -> buffer %d of size %d with data %s", @@ -187,7 +191,8 @@ public class GLBufferObjectTracker { } /** - * Must be called when [re]creating the GL buffer object via {@link GL2#glNamedBufferDataEXT(int, long, java.nio.Buffer, int)}, + * Must be called when [re]creating the GL buffer object via {@link GL2#glNamedBufferData(int, long, java.nio.Buffer, int)} + * and {@link GL4#glNamedBufferStorage(int, long, Buffer, int)}, * i.e. implies destruction of the buffer. * * @param bufferName @@ -198,19 +203,19 @@ public class GLBufferObjectTracker { */ public synchronized final void createBufferStorage(final GL caller, final int bufferName, final long size, final Buffer data, final int mutableUsage, final int immutableFlags, - final CreateStorageDispatch dispatch, final long glProcAddress) throws GLException { + final CreateStorageDispatch dispatch) throws GLException { final int glerrPre = caller.glGetError(); // clear if (DEBUG && GL.GL_NO_ERROR != glerrPre) { System.err.printf("%s.%s glerr-pre 0x%X%n", msgClazzName, msgCreateNamed, glerrPre); } - if ( 0 > size ) { // glBufferData, glNamedBufferDataEXT + 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 glNamedBufferStorageEXT not supported yet"); + throw new InternalError("Immutable glNamedBufferStorage not supported yet"); } - dispatch.create(bufferName, size, data, mutableUsage, glProcAddress); + dispatch.create(bufferName, size, data, mutableUsage); 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", @@ -278,10 +283,10 @@ public class GLBufferObjectTracker { ByteBuffer allocNioByteBuffer(final long addr, final long length); } public static interface MapBufferRangeDispatch extends MapBufferDispatch { - long mapBuffer(final int targetOrBufferName, final long offset, final long length, final int access, final long glProcAddress); + long mapBuffer(final int targetOrBufferName, final long offset, final long length, final int access); } public static interface MapBufferAllDispatch extends MapBufferDispatch { - long mapBuffer(final int targetOrBufferName, final int access, final long glProcAddress); + long mapBuffer(final int targetOrBufferName, final int access); } private static final String GL_INVALID_OPERATION = "GL_INVALID_OPERATION"; @@ -296,8 +301,8 @@ public class GLBufferObjectTracker { */ public synchronized final GLBufferStorage mapBuffer(final GLBufferStateTracker bufferStateTracker, final GL caller, final int target, final int access, - final MapBufferAllDispatch dispatch, final long glProcAddress) throws GLException { - return this.mapBufferImpl(bufferStateTracker, caller, target, false /* useRange */, 0 /* offset */, 0 /* length */, access, dispatch, glProcAddress); + final MapBufferAllDispatch dispatch) throws GLException { + return this.mapBufferImpl(bufferStateTracker, caller, target, false /* useRange */, 0 /* offset */, 0 /* length */, access, dispatch); } /** * Must be called when mapping GL buffer objects via {@link GL#mapBufferRange(int, long, long, int)}. @@ -309,8 +314,8 @@ public class GLBufferObjectTracker { */ public synchronized final GLBufferStorage mapBuffer(final GLBufferStateTracker bufferStateTracker, final GL caller, final int target, final long offset, final long length, final int access, - final MapBufferRangeDispatch dispatch, final long glProcAddress) throws GLException { - return this.mapBufferImpl(bufferStateTracker, caller, target, true /* useRange */, offset, length, access, dispatch, glProcAddress); + final MapBufferRangeDispatch dispatch) throws GLException { + return this.mapBufferImpl(bufferStateTracker, caller, target, true /* useRange */, offset, length, access, dispatch); } /** * Must be called when mapping GL buffer objects via {@link GL2#mapNamedBuffer(int, int)}. @@ -318,9 +323,8 @@ public class GLBufferObjectTracker { * @throws GLException if buffer is already mapped * @throws GLException if buffer has invalid store size, i.e. less-than zero */ - public synchronized final GLBufferStorage mapBuffer(final int bufferName, final int access, final MapBufferAllDispatch dispatch, - final long glProcAddress) throws GLException { - return this.mapBufferImpl(0 /* target */, bufferName, true /* isNamedBuffer */, false /* useRange */, 0 /* offset */, 0 /* length */, access, dispatch, glProcAddress); + public synchronized final GLBufferStorage mapBuffer(final int bufferName, final int access, final MapBufferAllDispatch dispatch) throws GLException { + return this.mapBufferImpl(0 /* target */, bufferName, true /* isNamedBuffer */, false /* useRange */, 0 /* offset */, 0 /* length */, access, dispatch); } /** * Must be called when mapping GL buffer objects via {@link GL2#mapNamedBufferRange(int, long, long, int)}. @@ -329,9 +333,8 @@ public class GLBufferObjectTracker { * @throws GLException if buffer has invalid store size, i.e. less-than zero * @throws GLException if buffer mapping range does not fit, incl. offset */ - public synchronized final GLBufferStorage mapBuffer(final int bufferName, final long offset, final long length, final int access, final MapBufferRangeDispatch dispatch, - final long glProcAddress) throws GLException { - return this.mapBufferImpl(0 /* target */, bufferName, true /* isNamedBuffer */, true /* useRange */, offset, length, access, dispatch, glProcAddress); + public synchronized final GLBufferStorage mapBuffer(final int bufferName, final long offset, final long length, final int access, final MapBufferRangeDispatch dispatch) throws GLException { + return this.mapBufferImpl(0 /* target */, bufferName, true /* isNamedBuffer */, true /* useRange */, offset, length, access, dispatch); } /** * @throws GLException if buffer is not bound to target @@ -343,12 +346,12 @@ public class GLBufferObjectTracker { private synchronized final GLBufferStorage mapBufferImpl(final GLBufferStateTracker bufferStateTracker, final GL caller, final int target, final boolean useRange, final long offset, final long length, final int access, - final MapBufferDispatch dispatch, final long glProcAddress) throws GLException { + final MapBufferDispatch dispatch) throws GLException { final int bufferName = bufferStateTracker.getBoundBufferObject(target, caller); if( 0 == bufferName ) { throw new GLException(String.format("%s.%s: %s Buffer for target 0x%X not bound", msgClazzName, msgMapBuffer, GL_INVALID_OPERATION, target)); } - return this.mapBufferImpl(target, bufferName, false /* isNamedBuffer */, useRange, offset, length, access, dispatch, glProcAddress); + return this.mapBufferImpl(target, bufferName, false /* isNamedBuffer */, useRange, offset, length, access, dispatch); } /** * <p> @@ -365,8 +368,7 @@ public class GLBufferObjectTracker { * @throws GLException if buffer mapping range does not fit, incl. optional offset */ private synchronized final GLBufferStorage mapBufferImpl(final int target, final int bufferName, final boolean isNamedBuffer, final boolean useRange, long offset, - long length, final int access, final MapBufferDispatch dispatch, - final long glProcAddress) throws GLException { + long length, final int access, final MapBufferDispatch dispatch) throws GLException { final GLBufferStorageImpl store = (GLBufferStorageImpl)bufferName2StorageMap.get(bufferName); if ( null == store ) { throw new GLException("Buffer with name "+bufferName+" not tracked"); @@ -394,15 +396,15 @@ public class GLBufferObjectTracker { final long addr; if( isNamedBuffer ) { if( useRange ) { - addr = ((MapBufferRangeDispatch)dispatch).mapBuffer(bufferName, offset, length, access, glProcAddress); + addr = ((MapBufferRangeDispatch)dispatch).mapBuffer(bufferName, offset, length, access); } else { - addr = ((MapBufferAllDispatch)dispatch).mapBuffer(bufferName, access, glProcAddress); + addr = ((MapBufferAllDispatch)dispatch).mapBuffer(bufferName, access); } } else { if( useRange ) { - addr = ((MapBufferRangeDispatch)dispatch).mapBuffer(target, offset, length, access, glProcAddress); + addr = ((MapBufferRangeDispatch)dispatch).mapBuffer(target, offset, length, access); } else { - addr = ((MapBufferAllDispatch)dispatch).mapBuffer(target, access, glProcAddress); + addr = ((MapBufferAllDispatch)dispatch).mapBuffer(target, access); } } // GL's map-buffer implementation always returns NULL on error, @@ -425,7 +427,7 @@ public class GLBufferObjectTracker { } public static interface UnmapBufferDispatch { - boolean unmap(final int targetOrBufferName, final long glProcAddress); + boolean unmap(final int targetOrBufferName); } /** @@ -437,7 +439,7 @@ public class GLBufferObjectTracker { */ public synchronized final boolean unmapBuffer(final GLBufferStateTracker bufferStateTracker, final GL caller, final int target, - final UnmapBufferDispatch dispatch, final long glProcAddress) { + final UnmapBufferDispatch dispatch) { final int bufferName = bufferStateTracker.getBoundBufferObject(target, caller); final GLBufferStorageImpl store; if( 0 == bufferName ) { @@ -453,7 +455,7 @@ public class GLBufferObjectTracker { ExceptionUtils.dumpStack(System.err); } } - final boolean res = dispatch.unmap(target, glProcAddress); + final boolean res = dispatch.unmap(target); if( res && null != store ) { store.setMappedBuffer(null); } @@ -466,20 +468,20 @@ public class GLBufferObjectTracker { return res; } /** - * Must be called when unmapping GL buffer objects via {@link GL2#glUnmapNamedBufferEXT(int)}. + * Must be called when unmapping GL buffer objects via {@link GL2#glUnmapNamedBuffer(int)}. * <p> * Only clear mapped buffer reference of {@link GLBufferStorage} * if native unmapping was successful. * </p> */ public synchronized final boolean unmapBuffer(final int bufferName, - final UnmapBufferDispatch dispatch, final long glProcAddress) { + final UnmapBufferDispatch dispatch) { final GLBufferStorageImpl store = (GLBufferStorageImpl) bufferName2StorageMap.get(bufferName); if (DEBUG && null == store ) { System.err.printf("%s: %s.%s: Buffer %d not tracked%n", warning, msgClazzName, msgUnmapped, bufferName); ExceptionUtils.dumpStack(System.err); } - final boolean res = dispatch.unmap(bufferName, glProcAddress); + final boolean res = dispatch.unmap(bufferName); if( res && null != store ) { store.setMappedBuffer(null); } |