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 /make/config/jogl | |
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).
Diffstat (limited to 'make/config/jogl')
-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 |
10 files changed, 165 insertions, 536 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); -} - - |