diff options
author | Sven Gothel <[email protected]> | 2014-07-03 16:35:47 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-07-03 16:35:47 +0200 |
commit | a90ee128ce0550cd05f969d0283312c2f42b8254 (patch) | |
tree | dade644101970d8f69ea3845db310499f2b66a76 /src/com/jogamp/opencl/gl | |
parent | a0e0c8a39d0ef41ff6b64d9b40d058f21b786e81 (diff) |
Code Clean-Up based on our Recommended Settings (jogamp-scripting c47bc86ae2ee268a1f38c5580d11f93d7f8d6e74)
- Change non static accesses to static members using declaring type
- Change indirect accesses to static members to direct accesses (accesses through subtypes)
- Add final modifier to private fields
- Add final modifier to method parameters
- Add final modifier to local variables
- Remove unnecessary casts
- Remove unnecessary '$NON-NLS$' tags
- Remove trailing white spaces on all lines
Diffstat (limited to 'src/com/jogamp/opencl/gl')
-rw-r--r-- | src/com/jogamp/opencl/gl/CLGLBuffer.java | 26 | ||||
-rw-r--r-- | src/com/jogamp/opencl/gl/CLGLContext.java | 120 | ||||
-rw-r--r-- | src/com/jogamp/opencl/gl/CLGLImage2d.java | 33 | ||||
-rw-r--r-- | src/com/jogamp/opencl/gl/CLGLObject.java | 10 | ||||
-rw-r--r-- | src/com/jogamp/opencl/gl/CLGLTexture.java | 8 | ||||
-rw-r--r-- | src/com/jogamp/opencl/gl/CLGLTexture2d.java | 33 | ||||
-rw-r--r-- | src/com/jogamp/opencl/gl/CLGLTexture3d.java | 35 |
7 files changed, 135 insertions, 130 deletions
diff --git a/src/com/jogamp/opencl/gl/CLGLBuffer.java b/src/com/jogamp/opencl/gl/CLGLBuffer.java index a9fc49cd..59aacd9f 100644 --- a/src/com/jogamp/opencl/gl/CLGLBuffer.java +++ b/src/com/jogamp/opencl/gl/CLGLBuffer.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,7 +20,7 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. @@ -50,25 +50,25 @@ public final class CLGLBuffer<B extends Buffer> extends CLBuffer<B> implements C */ public final int GLID; - private CLGLBuffer(CLContext context, B directBuffer, long id, int glObject, long size, int flags) { + private CLGLBuffer(final CLContext context, final B directBuffer, final long id, final int glObject, final long size, final int flags) { super(context, directBuffer, size, id, flags); this.GLID = glObject; } - static <B extends Buffer> CLGLBuffer<B> create(CLContext context, B directBuffer, long size, int flags, int glBuffer) { + static <B extends Buffer> CLGLBuffer<B> create(final CLContext context, final B directBuffer, final long size, final int flags, final int glBuffer) { checkBuffer(directBuffer, flags); - - CLGL clgli = (CLGL)getCL(context); - - int[] result = new int[1]; - long id = clgli.clCreateFromGLBuffer(context.ID, flags, glBuffer, result, 0); + + final CLGL clgli = (CLGL)getCL(context); + + final int[] result = new int[1]; + final long id = clgli.clCreateFromGLBuffer(context.ID, flags, glBuffer, result, 0); CLException.checkForError(result[0], "can not create CLGLObject from glBuffer #"+glBuffer); return new CLGLBuffer<B>(context, directBuffer, id, glBuffer, size, flags); } - static <B extends Buffer> void checkBuffer(B directBuffer, int flags) throws IllegalArgumentException { + static <B extends Buffer> void checkBuffer(final B directBuffer, final int flags) throws IllegalArgumentException { if (directBuffer != null && !directBuffer.isDirect()) { throw new IllegalArgumentException("buffer is not a direct buffer"); } @@ -108,7 +108,7 @@ public final class CLGLBuffer<B extends Buffer> extends CLBuffer<B> implements C } @Override - public <T extends Buffer> CLGLBuffer<T> cloneWith(T directBuffer) { + public <T extends Buffer> CLGLBuffer<T> cloneWith(final T directBuffer) { return new CLGLBuffer<T>(context, directBuffer, ID, GLID, size, FLAGS); } diff --git a/src/com/jogamp/opencl/gl/CLGLContext.java b/src/com/jogamp/opencl/gl/CLGLContext.java index e99e7ac4..2564a82d 100644 --- a/src/com/jogamp/opencl/gl/CLGLContext.java +++ b/src/com/jogamp/opencl/gl/CLGLContext.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,7 +20,7 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. @@ -44,6 +44,8 @@ import com.jogamp.opencl.CLContext; import com.jogamp.opencl.CLDevice; import com.jogamp.opencl.CLMemory.Mem; import com.jogamp.opencl.CLPlatform; +import com.jogamp.opencl.llb.CL; +import com.jogamp.opencl.llb.CLContextBinding; import com.jogamp.opencl.llb.gl.CLGL; /** @@ -55,7 +57,7 @@ public final class CLGLContext extends CLContext { final long glID; private final GLContext glContext; - private CLGLContext(CLPlatform platform, GLContext glContext, long clContextID, long glContextID, ErrorDispatcher dispatcher) { + private CLGLContext(final CLPlatform platform, final GLContext glContext, final long clContextID, final long glContextID, final ErrorDispatcher dispatcher) { super(platform, clContextID, dispatcher); this.glID = glContextID; this.glContext = glContext; @@ -65,7 +67,7 @@ public final class CLGLContext extends CLContext { * Creates a shared context on all available devices (CL_DEVICE_TYPE_ALL). * @see GLContext#makeCurrent() */ - public static CLGLContext create(GLContext glContext) { + public static CLGLContext create(final GLContext glContext) { return create(glContext, (CLPlatform)null, CLDevice.Type.ALL); } @@ -73,7 +75,7 @@ public final class CLGLContext extends CLContext { * Creates a shared context on the specified platform on all available devices (CL_DEVICE_TYPE_ALL). * @see GLContext#makeCurrent() */ - public static CLGLContext create(GLContext glContext, CLPlatform platform) { + public static CLGLContext create(final GLContext glContext, final CLPlatform platform) { return create(glContext, platform, CLDevice.Type.ALL); } @@ -82,7 +84,7 @@ public final class CLGLContext extends CLContext { * device types. * @see GLContext#makeCurrent() */ - public static CLGLContext create(GLContext glContext, CLDevice.Type... deviceTypes) { + public static CLGLContext create(final GLContext glContext, final CLDevice.Type... deviceTypes) { return create(glContext, null, deviceTypes); } @@ -91,16 +93,16 @@ public final class CLGLContext extends CLContext { * device types. * @see GLContext#makeCurrent() */ - public static CLGLContext create(GLContext glContext, CLPlatform platform, CLDevice.Type... deviceTypes) { + public static CLGLContext create(final GLContext glContext, CLPlatform platform, final CLDevice.Type... deviceTypes) { if(platform == null) { platform = CLPlatform.getDefault(); } - long[] glID = new long[1]; - PointerBuffer properties = setupContextProperties(platform, glContext, glID); - ErrorDispatcher dispatcher = createErrorHandler(); - long clID = createContextFromType(platform, dispatcher, properties, toDeviceBitmap(deviceTypes)); + final long[] glID = new long[1]; + final PointerBuffer properties = setupContextProperties(platform, glContext, glID); + final ErrorDispatcher dispatcher = createErrorHandler(); + final long clID = createContextFromType(platform, dispatcher, properties, toDeviceBitmap(deviceTypes)); return new CLGLContext(platform, glContext, clID, glID[0], dispatcher); @@ -111,7 +113,7 @@ public final class CLGLContext extends CLContext { * devices. * @see GLContext#makeCurrent() */ - public static CLGLContext create(GLContext glContext, CLDevice... devices) { + public static CLGLContext create(final GLContext glContext, final CLDevice... devices) { if(devices == null) { throw new IllegalArgumentException("no devices specified"); @@ -119,14 +121,14 @@ public final class CLGLContext extends CLContext { throw new IllegalArgumentException("first device was null"); } - CLPlatform platform = devices[0].getPlatform(); + final CLPlatform platform = devices[0].getPlatform(); - long[] glID = new long[1]; - PointerBuffer properties = setupContextProperties(platform, glContext, glID); - ErrorDispatcher dispatcher = createErrorHandler(); - long clID = createContext(platform, dispatcher, properties, devices); + final long[] glID = new long[1]; + final PointerBuffer properties = setupContextProperties(platform, glContext, glID); + final ErrorDispatcher dispatcher = createErrorHandler(); + final long clID = createContext(platform, dispatcher, properties, devices); - CLGLContext context = new CLGLContext(platform, glContext, clID, glID[0], dispatcher); + final CLGLContext context = new CLGLContext(platform, glContext, clID, glID[0], dispatcher); if(devices != null) { for (int i = 0; i < devices.length; i++) { context.overrideContext(devices[i]); @@ -136,7 +138,7 @@ public final class CLGLContext extends CLContext { } - private static PointerBuffer setupContextProperties(CLPlatform platform, GLContext glContext, long[] glID) { + private static PointerBuffer setupContextProperties(final CLPlatform platform, final GLContext glContext, final long[] glID) { if(platform == null) { throw new RuntimeException("no OpenCL installation found"); @@ -151,7 +153,7 @@ public final class CLGLContext extends CLContext { " creating a OpenCL context for context sharing is not allowed in this situation."); } - GLContextImpl ctxImpl = (GLContextImpl)glContext; + final GLContextImpl ctxImpl = (GLContextImpl)glContext; glID[0] = glContext.getHandle(); PointerBuffer properties; @@ -162,36 +164,36 @@ public final class CLGLContext extends CLContext { // set to the Display handle of the X Window System display used to // create the OpenGL context." properties = PointerBuffer.allocateDirect(7); - long displayHandle = ctxImpl.getDrawableImpl().getNativeSurface().getDisplayHandle(); + final long displayHandle = ctxImpl.getDrawableImpl().getNativeSurface().getDisplayHandle(); properties.put(CLGL.CL_GL_CONTEXT_KHR).put(glID[0]) - .put(CLGL.CL_GLX_DISPLAY_KHR).put(displayHandle) - .put(CLGL.CL_CONTEXT_PLATFORM).put(platform.ID); + .put(CL.CL_GLX_DISPLAY_KHR).put(displayHandle) + .put(CLContextBinding.CL_CONTEXT_PLATFORM).put(platform.ID); }else if(glContext instanceof WindowsWGLContext) { // spec: "When the WGL binding API is supported, the attribute // CL_GL_CONTEXT_KHR should be set to an HGLRC handle to an OpenGL // context, and the attribute CL_WGL_HDC_KHR should be set to the // HDC handle of the display used to create the OpenGL context." properties = PointerBuffer.allocateDirect(7); - long surfaceHandle = ctxImpl.getDrawableImpl().getNativeSurface().getSurfaceHandle(); + final long surfaceHandle = ctxImpl.getDrawableImpl().getNativeSurface().getSurfaceHandle(); properties.put(CLGL.CL_GL_CONTEXT_KHR).put(glID[0]) - .put(CLGL.CL_WGL_HDC_KHR).put(surfaceHandle) - .put(CLGL.CL_CONTEXT_PLATFORM).put(platform.ID); + .put(CL.CL_WGL_HDC_KHR).put(surfaceHandle) + .put(CLContextBinding.CL_CONTEXT_PLATFORM).put(platform.ID); }else if(glContext instanceof MacOSXCGLContext) { // spec: "When the CGL binding API is supported, the attribute // CL_CGL_SHAREGROUP_KHR should be set to a CGLShareGroup handle to // a CGL share group object." /** - * FIXME: For all Mac OSX Versions ??? - * CL_CONTEXT_PROPERTY_USE_CGL_SHAREGROUP_APPLE used to specify the GL sharing group ID - * on Mac OSX 10.8.4 works. - * Using the std. CL_CGL_SHAREGROUP_KHR on Mac OSX 10.8.4 causes the context creation + * FIXME: For all Mac OSX Versions ??? + * CL_CONTEXT_PROPERTY_USE_CGL_SHAREGROUP_APPLE used to specify the GL sharing group ID + * on Mac OSX 10.8.4 works. + * Using the std. CL_CGL_SHAREGROUP_KHR on Mac OSX 10.8.4 causes the context creation * to throw a CL_INVALID_VALUE error. */ - long cgl = CGL.getCGLContext(glID[0]); - long group = CGL.CGLGetShareGroup(cgl); + final long cgl = CGL.getCGLContext(glID[0]); + final long group = CGL.CGLGetShareGroup(cgl); properties = PointerBuffer.allocateDirect(5); properties.put(CLGL.CL_CONTEXT_PROPERTY_USE_CGL_SHAREGROUP_APPLE).put(group) - .put(CLGL.CL_CONTEXT_PLATFORM).put(platform.ID); + .put(CLContextBinding.CL_CONTEXT_PLATFORM).put(platform.ID); }else if(glContext instanceof EGLContext) { // TODO test EGL // spec: "When the EGL binding API is supported, the attribute @@ -200,17 +202,17 @@ public final class CLGLContext extends CLContext { // CL_EGL_DISPLAY_KHR should be set to the EGLDisplay handle of the // display used to create the OpenGL ES or OpenGL context." properties = PointerBuffer.allocateDirect(7); - long displayHandle = ctxImpl.getDrawableImpl().getNativeSurface().getDisplayHandle(); + final long displayHandle = ctxImpl.getDrawableImpl().getNativeSurface().getDisplayHandle(); properties.put(CLGL.CL_GL_CONTEXT_KHR).put(glID[0]) - .put(CLGL.CL_EGL_DISPLAY_KHR).put(displayHandle) - .put(CLGL.CL_CONTEXT_PLATFORM).put(platform.ID); + .put(CL.CL_EGL_DISPLAY_KHR).put(displayHandle) + .put(CLContextBinding.CL_CONTEXT_PLATFORM).put(platform.ID); }else{ throw new RuntimeException("unsupported GLContext: "+glContext); } return properties.put(0).rewind(); // 0 terminated array } - + // Buffers /** * Creates a CLGLBuffer for memory sharing with the specified OpenGL buffer. @@ -218,7 +220,7 @@ public final class CLGLContext extends CLContext { * @param glBufferSize The size of the OpenGL buffer in bytes * @param flags optional flags. */ - public final CLGLBuffer<?> createFromGLBuffer(int glBuffer, long glBufferSize, Mem... flags) { + public final CLGLBuffer<?> createFromGLBuffer(final int glBuffer, final long glBufferSize, final Mem... flags) { return createFromGLBuffer(null, glBuffer, glBufferSize, Mem.flagsToInt(flags)); } @@ -228,7 +230,7 @@ public final class CLGLContext extends CLContext { * @param glBufferSize The size of the OpenGL buffer in bytes * @param flags optional flags. */ - public final CLGLBuffer<?> createFromGLBuffer(int glBuffer, long glBufferSize, int flags) { + public final CLGLBuffer<?> createFromGLBuffer(final int glBuffer, final long glBufferSize, final int flags) { return createFromGLBuffer(null, glBuffer, glBufferSize, flags); } @@ -239,7 +241,7 @@ public final class CLGLContext extends CLContext { * @param glBufferSize The size of the OpenGL buffer in bytes * @param flags optional flags. */ - public final <B extends Buffer> CLGLBuffer<B> createFromGLBuffer(B directBuffer, int glBuffer, long glBufferSize, Mem... flags) { + public final <B extends Buffer> CLGLBuffer<B> createFromGLBuffer(final B directBuffer, final int glBuffer, final long glBufferSize, final Mem... flags) { return createFromGLBuffer(directBuffer, glBuffer, glBufferSize, Mem.flagsToInt(flags)); } @@ -250,65 +252,65 @@ public final class CLGLContext extends CLContext { * @param glBufferSize The size of the OpenGL buffer in bytes * @param flags optional flags. */ - public final <B extends Buffer> CLGLBuffer<B> createFromGLBuffer(B directBuffer, int glBuffer, long glBufferSize, int flags) { - CLGLBuffer<B> buffer = CLGLBuffer.create(this, directBuffer, glBufferSize, flags, glBuffer); + public final <B extends Buffer> CLGLBuffer<B> createFromGLBuffer(final B directBuffer, final int glBuffer, final long glBufferSize, final int flags) { + final CLGLBuffer<B> buffer = CLGLBuffer.create(this, directBuffer, glBufferSize, flags, glBuffer); memoryObjects.add(buffer); return buffer; } // Renderbuffers - public final CLGLImage2d<?> createFromGLRenderbuffer(int glBuffer, Mem... flags) { + public final CLGLImage2d<?> createFromGLRenderbuffer(final int glBuffer, final Mem... flags) { return createFromGLRenderbuffer(null, glBuffer, Mem.flagsToInt(flags)); } - public final CLGLImage2d<?> createFromGLRenderbuffer(int glBuffer, int flags) { + public final CLGLImage2d<?> createFromGLRenderbuffer(final int glBuffer, final int flags) { return createFromGLRenderbuffer(null, glBuffer, flags); } - public final <B extends Buffer> CLGLImage2d<B> createFromGLRenderbuffer(B directBuffer, int glBuffer, Mem... flags) { + public final <B extends Buffer> CLGLImage2d<B> createFromGLRenderbuffer(final B directBuffer, final int glBuffer, final Mem... flags) { return createFromGLRenderbuffer(directBuffer, glBuffer, Mem.flagsToInt(flags)); } - public final <B extends Buffer> CLGLImage2d<B> createFromGLRenderbuffer(B directBuffer, int glBuffer, int flags) { - CLGLImage2d<B> buffer = CLGLImage2d.createFromGLRenderbuffer(this, directBuffer, flags, glBuffer); + public final <B extends Buffer> CLGLImage2d<B> createFromGLRenderbuffer(final B directBuffer, final int glBuffer, final int flags) { + final CLGLImage2d<B> buffer = CLGLImage2d.createFromGLRenderbuffer(this, directBuffer, flags, glBuffer); memoryObjects.add(buffer); return buffer; } //2d Textures - public final CLGLTexture2d<?> createFromGLTexture2d(int target, int texture, int mipmap, Mem... flags) { + public final CLGLTexture2d<?> createFromGLTexture2d(final int target, final int texture, final int mipmap, final Mem... flags) { return createFromGLTexture2d(null, target, texture, mipmap, Mem.flagsToInt(flags)); } - public final CLGLTexture2d<?> createFromGLTexture2d(int target, int texture, int mipmap, int flags) { + public final CLGLTexture2d<?> createFromGLTexture2d(final int target, final int texture, final int mipmap, final int flags) { return createFromGLTexture2d(null, target, texture, mipmap, flags); } - public final <B extends Buffer> CLGLTexture2d<B> createFromGLTexture2d(B directBuffer, int target, int texture, int mipmap, Mem... flags) { + public final <B extends Buffer> CLGLTexture2d<B> createFromGLTexture2d(final B directBuffer, final int target, final int texture, final int mipmap, final Mem... flags) { return createFromGLTexture2d(directBuffer, target, texture, mipmap, Mem.flagsToInt(flags)); } - public final <B extends Buffer> CLGLTexture2d<B> createFromGLTexture2d(B directBuffer, int target, int texture, int mipmap, int flags) { - CLGLTexture2d<B> buffer = CLGLTexture2d.createFromGLTexture2d(this, directBuffer, target, texture, mipmap, flags); + public final <B extends Buffer> CLGLTexture2d<B> createFromGLTexture2d(final B directBuffer, final int target, final int texture, final int mipmap, final int flags) { + final CLGLTexture2d<B> buffer = CLGLTexture2d.createFromGLTexture2d(this, directBuffer, target, texture, mipmap, flags); memoryObjects.add(buffer); return buffer; } //3d Textures - public final CLGLTexture3d<?> createFromGLTexture3d(int target, int texture, int mipmap, Mem... flags) { + public final CLGLTexture3d<?> createFromGLTexture3d(final int target, final int texture, final int mipmap, final Mem... flags) { return createFromGLTexture3d(null, target, texture, mipmap, Mem.flagsToInt(flags)); } - public final CLGLTexture3d<?> createFromGLTexture3d(int target, int texture, int mipmap, int flags) { + public final CLGLTexture3d<?> createFromGLTexture3d(final int target, final int texture, final int mipmap, final int flags) { return createFromGLTexture3d(null, target, texture, mipmap, flags); } - public final <B extends Buffer> CLGLTexture3d<B> createFromGLTexture3d(B directBuffer, int target, int texture, int mipmap, Mem... flags) { + public final <B extends Buffer> CLGLTexture3d<B> createFromGLTexture3d(final B directBuffer, final int target, final int texture, final int mipmap, final Mem... flags) { return createFromGLTexture3d(directBuffer, target, texture, mipmap, Mem.flagsToInt(flags)); } - public final <B extends Buffer> CLGLTexture3d<B> createFromGLTexture3d(B directBuffer, int target, int texture, int mipmap, int flags) { - CLGLTexture3d<B> buffer = CLGLTexture3d.createFromGLTexture3d(this, directBuffer, flags, target, mipmap, texture); + public final <B extends Buffer> CLGLTexture3d<B> createFromGLTexture3d(final B directBuffer, final int target, final int texture, final int mipmap, final int flags) { + final CLGLTexture3d<B> buffer = CLGLTexture3d.createFromGLTexture3d(this, directBuffer, flags, target, mipmap, texture); memoryObjects.add(buffer); return buffer; } diff --git a/src/com/jogamp/opencl/gl/CLGLImage2d.java b/src/com/jogamp/opencl/gl/CLGLImage2d.java index 954a2334..19cd51bf 100644 --- a/src/com/jogamp/opencl/gl/CLGLImage2d.java +++ b/src/com/jogamp/opencl/gl/CLGLImage2d.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,7 +20,7 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. @@ -29,6 +29,7 @@ package com.jogamp.opencl.gl; import com.jogamp.opencl.llb.CL; +import com.jogamp.opencl.llb.CLImageBinding; import com.jogamp.opencl.llb.gl.CLGL; import com.jogamp.opencl.CLContext; import com.jogamp.opencl.CLException; @@ -51,33 +52,33 @@ public class CLGLImage2d<B extends Buffer> extends CLImage2d<B> implements CLGLO */ public final int GLID; - protected CLGLImage2d(CLContext context, B directBuffer, CLImageFormat format, CLImageInfoAccessor accessor, int width, int height, long id, int glid, int flags) { + protected CLGLImage2d(final CLContext context, final B directBuffer, final CLImageFormat format, final CLImageInfoAccessor accessor, final int width, final int height, final long id, final int glid, final int flags) { super(context, directBuffer, format, accessor, width, height, id, flags); this.GLID = glid; } - static <B extends Buffer> CLGLImage2d<B> createFromGLRenderbuffer(CLContext context, B directBuffer, int flags, int renderbuffer) { + static <B extends Buffer> CLGLImage2d<B> createFromGLRenderbuffer(final CLContext context, final B directBuffer, final int flags, final int renderbuffer) { CLGLBuffer.checkBuffer(directBuffer, flags); - CL cl = getCL(context); - int[] result = new int[1]; - CLGL clgli = (CLGL)cl; + final CL cl = getCL(context); + final int[] result = new int[1]; + final CLGL clgli = (CLGL)cl; - long id = clgli.clCreateFromGLRenderbuffer(context.ID, flags, renderbuffer, result, 0); + final long id = clgli.clCreateFromGLRenderbuffer(context.ID, flags, renderbuffer, result, 0); CLException.checkForError(result[0], "can not create CLGLImage2d from renderbuffer #"+renderbuffer+"."); return createImage(context, id, directBuffer, renderbuffer, flags); } - static <B extends Buffer> CLGLImage2d<B> createImage(CLContext context, long id, B directBuffer, int glObject, int flags) { - CLImageInfoAccessor accessor = new CLImageInfoAccessor(getCL(context), id); + static <B extends Buffer> CLGLImage2d<B> createImage(final CLContext context, final long id, final B directBuffer, final int glObject, final int flags) { + final CLImageInfoAccessor accessor = new CLImageInfoAccessor(getCL(context), id); - CLImageFormat format = createUninitializedImageFormat(); - accessor.getInfo(CL.CL_IMAGE_FORMAT, CLImageFormatImpl.size(), format.getFormatImpl().getBuffer(), null); + final CLImageFormat format = createUninitializedImageFormat(); + accessor.getInfo(CLImageBinding.CL_IMAGE_FORMAT, CLImageFormatImpl.size(), format.getFormatImpl().getBuffer(), null); - int width = (int)accessor.getLong(CL.CL_IMAGE_WIDTH); - int height = (int)accessor.getLong(CL.CL_IMAGE_HEIGHT); + final int width = (int)accessor.getLong(CLImageBinding.CL_IMAGE_WIDTH); + final int height = (int)accessor.getLong(CLImageBinding.CL_IMAGE_HEIGHT); return new CLGLImage2d<B>(context, directBuffer, format, accessor, width, height, id, glObject, flags); } diff --git a/src/com/jogamp/opencl/gl/CLGLObject.java b/src/com/jogamp/opencl/gl/CLGLObject.java index a9bad53d..6e86a810 100644 --- a/src/com/jogamp/opencl/gl/CLGLObject.java +++ b/src/com/jogamp/opencl/gl/CLGLObject.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,7 +20,7 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. @@ -54,7 +54,7 @@ public interface CLGLObject { * Returns the OpenGL buffer type of this shared object. */ public GLObjectType getGLObjectType(); - + /** * Returns the OpenCL context of this shared object. */ diff --git a/src/com/jogamp/opencl/gl/CLGLTexture.java b/src/com/jogamp/opencl/gl/CLGLTexture.java index f4f90c33..7af41754 100644 --- a/src/com/jogamp/opencl/gl/CLGLTexture.java +++ b/src/com/jogamp/opencl/gl/CLGLTexture.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,7 +20,7 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. diff --git a/src/com/jogamp/opencl/gl/CLGLTexture2d.java b/src/com/jogamp/opencl/gl/CLGLTexture2d.java index 64ac4e0b..30b8164e 100644 --- a/src/com/jogamp/opencl/gl/CLGLTexture2d.java +++ b/src/com/jogamp/opencl/gl/CLGLTexture2d.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,7 +20,7 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. @@ -29,6 +29,7 @@ package com.jogamp.opencl.gl; import com.jogamp.opencl.llb.CL; +import com.jogamp.opencl.llb.CLImageBinding; import com.jogamp.opencl.CLContext; import com.jogamp.opencl.CLException; import com.jogamp.opencl.CLImageFormat; @@ -44,33 +45,33 @@ import java.nio.Buffer; public class CLGLTexture2d<B extends Buffer> extends CLGLImage2d<B> implements CLGLTexture { public final int target; - + public final int mipMapLevel; - public CLGLTexture2d(CLContext context, B directBuffer, CLImageFormat format, CLImageInfoAccessor accessor, int target, int mipLevel, int width, int height, long id, int glid, int flags) { + public CLGLTexture2d(final CLContext context, final B directBuffer, final CLImageFormat format, final CLImageInfoAccessor accessor, final int target, final int mipLevel, final int width, final int height, final long id, final int glid, final int flags) { super(context, directBuffer, format, accessor, width, height, id, glid, flags); this.target = target; this.mipMapLevel = mipLevel; } - static <B extends Buffer> CLGLTexture2d<B> createFromGLTexture2d(CLContext context, B directBuffer, int target, int texture, int mipLevel, int flags) { + static <B extends Buffer> CLGLTexture2d<B> createFromGLTexture2d(final CLContext context, final B directBuffer, final int target, final int texture, final int mipLevel, final int flags) { CLGLBuffer.checkBuffer(directBuffer, flags); - CL cl = getCL(context); - int[] result = new int[1]; - CLGL clgli = (CLGL)cl; + final CL cl = getCL(context); + final int[] result = new int[1]; + final CLGL clgli = (CLGL)cl; - long id = clgli.clCreateFromGLTexture2D(context.ID, flags, target, mipLevel, texture, result, 0); + final long id = clgli.clCreateFromGLTexture2D(context.ID, flags, target, mipLevel, texture, result, 0); CLException.checkForError(result[0], "can not create CLGLTexture2d from texture #"+texture+"."); - CLImageInfoAccessor accessor = new CLImageInfoAccessor(cl, id); + final CLImageInfoAccessor accessor = new CLImageInfoAccessor(cl, id); - CLImageFormat format = createUninitializedImageFormat(); - accessor.getInfo(CL.CL_IMAGE_FORMAT, CLImageFormatImpl.size(), format.getFormatImpl().getBuffer(), null); + final CLImageFormat format = createUninitializedImageFormat(); + accessor.getInfo(CLImageBinding.CL_IMAGE_FORMAT, CLImageFormatImpl.size(), format.getFormatImpl().getBuffer(), null); - int width = (int)accessor.getLong(CL.CL_IMAGE_WIDTH); - int height = (int)accessor.getLong(CL.CL_IMAGE_HEIGHT); + final int width = (int)accessor.getLong(CLImageBinding.CL_IMAGE_WIDTH); + final int height = (int)accessor.getLong(CLImageBinding.CL_IMAGE_HEIGHT); return new CLGLTexture2d<B>(context, directBuffer, format, accessor, target, mipLevel, width, height, id, texture, flags); diff --git a/src/com/jogamp/opencl/gl/CLGLTexture3d.java b/src/com/jogamp/opencl/gl/CLGLTexture3d.java index fdc2ba79..6d832479 100644 --- a/src/com/jogamp/opencl/gl/CLGLTexture3d.java +++ b/src/com/jogamp/opencl/gl/CLGLTexture3d.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,7 +20,7 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. @@ -30,6 +30,7 @@ package com.jogamp.opencl.gl; import com.jogamp.opencl.llb.gl.CLGL; import com.jogamp.opencl.llb.CL; +import com.jogamp.opencl.llb.CLImageBinding; import com.jogamp.opencl.CLContext; import com.jogamp.opencl.CLException; import com.jogamp.opencl.CLImage3d; @@ -52,35 +53,35 @@ public class CLGLTexture3d<B extends Buffer> extends CLImage3d<B> implements CLG public final int GLID; public final int target; - + public final int mipMapLevel; - private CLGLTexture3d(CLContext context, B directBuffer, CLImageFormat format, CLImageInfoAccessor accessor, int target, int mipLevel, int width, int height, int depth, long id, int glid, int flags) { + private CLGLTexture3d(final CLContext context, final B directBuffer, final CLImageFormat format, final CLImageInfoAccessor accessor, final int target, final int mipLevel, final int width, final int height, final int depth, final long id, final int glid, final int flags) { super(context, directBuffer, format, accessor, width, height, depth, id, flags); this.GLID = glid; this.target = target; this.mipMapLevel = mipLevel; } - static <B extends Buffer> CLGLTexture3d<B> createFromGLTexture3d(CLContext context, B directBuffer, int flags, int target, int mipLevel, int texture) { + static <B extends Buffer> CLGLTexture3d<B> createFromGLTexture3d(final CLContext context, final B directBuffer, final int flags, final int target, final int mipLevel, final int texture) { CLGLBuffer.checkBuffer(directBuffer, flags); - CL cl = getCL(context); - int[] result = new int[1]; - CLGL clgli = (CLGL)cl; + final CL cl = getCL(context); + final int[] result = new int[1]; + final CLGL clgli = (CLGL)cl; - long id = clgli.clCreateFromGLTexture3D(context.ID, flags, target, mipLevel, texture, result, 0); + final long id = clgli.clCreateFromGLTexture3D(context.ID, flags, target, mipLevel, texture, result, 0); CLException.checkForError(result[0], "can not create CLGLTexture3d from texture #"+texture+"."); - CLImageInfoAccessor accessor = new CLImageInfoAccessor(cl, id); + final CLImageInfoAccessor accessor = new CLImageInfoAccessor(cl, id); - CLImageFormat format = createUninitializedImageFormat(); - accessor.getInfo(CL.CL_IMAGE_FORMAT, CLImageFormatImpl.size(), format.getFormatImpl().getBuffer(), null); + final CLImageFormat format = createUninitializedImageFormat(); + accessor.getInfo(CLImageBinding.CL_IMAGE_FORMAT, CLImageFormatImpl.size(), format.getFormatImpl().getBuffer(), null); - int width = (int)accessor.getLong(CL.CL_IMAGE_WIDTH); - int height = (int)accessor.getLong(CL.CL_IMAGE_HEIGHT); - int depth = (int)accessor.getLong(CL.CL_IMAGE_DEPTH); + final int width = (int)accessor.getLong(CLImageBinding.CL_IMAGE_WIDTH); + final int height = (int)accessor.getLong(CLImageBinding.CL_IMAGE_HEIGHT); + final int depth = (int)accessor.getLong(CLImageBinding.CL_IMAGE_DEPTH); return new CLGLTexture3d<B>(context, directBuffer, format, accessor, target, mipLevel, width, height, depth, id, texture, flags); } |