diff options
Diffstat (limited to 'src')
33 files changed, 107 insertions, 66 deletions
diff --git a/src/com/jogamp/opencl/CLBuffer.java b/src/com/jogamp/opencl/CLBuffer.java index 6f00247c..dfdfd2d0 100644 --- a/src/com/jogamp/opencl/CLBuffer.java +++ b/src/com/jogamp/opencl/CLBuffer.java @@ -32,6 +32,7 @@ import com.jogamp.common.nio.Buffers; import java.util.List; import com.jogamp.common.nio.NativeSizeBuffer; import com.jogamp.opencl.CLMemory.Mem; +import com.jogamp.opencl.llb.CL; import java.nio.Buffer; import java.util.ArrayList; import java.util.Collections; diff --git a/src/com/jogamp/opencl/CLCommandQueue.java b/src/com/jogamp/opencl/CLCommandQueue.java index d578738b..2f83464f 100644 --- a/src/com/jogamp/opencl/CLCommandQueue.java +++ b/src/com/jogamp/opencl/CLCommandQueue.java @@ -29,7 +29,7 @@ package com.jogamp.opencl; import com.jogamp.common.nio.CachedBufferFactory; -import com.jogamp.opencl.gl.CLGLI; +import com.jogamp.opencl.llb.gl.CLGL; import com.jogamp.common.nio.NativeSizeBuffer; import com.jogamp.opencl.gl.CLGLObject; import java.nio.Buffer; @@ -41,7 +41,7 @@ import java.util.EnumSet; import java.util.List; import static com.jogamp.opencl.CLException.*; -import static com.jogamp.opencl.CL.*; +import static com.jogamp.opencl.llb.CL.*; import static com.jogamp.opencl.util.CLUtil.*; /** @@ -1667,7 +1667,7 @@ public class CLCommandQueue extends CLObject implements CLResource { conditions = condition.size; } - CLGLI xl = (CLGLI) cl; + CLGL xl = (CLGL) cl; int ret = xl.clEnqueueAcquireGLObjects(ID, glObjectIDs.remaining(), glObjectIDs, conditions, conditionIDs, @@ -1736,7 +1736,7 @@ public class CLCommandQueue extends CLObject implements CLResource { conditions = condition.size; } - CLGLI xl = (CLGLI) cl; + CLGL xl = (CLGL) cl; int ret = xl.clEnqueueReleaseGLObjects(ID, glObjectIDs.remaining(), glObjectIDs, conditions, conditionIDs, diff --git a/src/com/jogamp/opencl/CLContext.java b/src/com/jogamp/opencl/CLContext.java index 147fc2ae..2beea3f8 100644 --- a/src/com/jogamp/opencl/CLContext.java +++ b/src/com/jogamp/opencl/CLContext.java @@ -28,12 +28,13 @@ package com.jogamp.opencl; +import com.jogamp.opencl.llb.CL; import com.jogamp.common.nio.Buffers; import com.jogamp.opencl.CLDevice.Type; import com.jogamp.opencl.CLSampler.AddressingMode; import com.jogamp.opencl.CLSampler.FilteringMode; import com.jogamp.common.nio.NativeSizeBuffer; -import com.jogamp.opencl.impl.CLImageFormatImpl; +import com.jogamp.opencl.llb.impl.CLImageFormatImpl; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; @@ -57,7 +58,7 @@ import static java.lang.System.*; import static com.jogamp.opencl.CLException.*; import static com.jogamp.common.nio.Buffers.*; import static com.jogamp.common.os.Platform.*; -import static com.jogamp.opencl.CL.*; +import static com.jogamp.opencl.llb.CL.*; import static com.jogamp.opencl.CLBuffer.*; import static java.util.Collections.*; @@ -121,11 +122,11 @@ public class CLContext extends CLObject implements CLResource { NativeSizeBuffer deviceCount = NativeSizeBuffer.allocateDirect(1); - int ret = cl.clGetContextInfo(ID, CL.CL_CONTEXT_DEVICES, 0, null, deviceCount); + int ret = cl.clGetContextInfo(ID, CL_CONTEXT_DEVICES, 0, null, deviceCount); checkForError(ret, "can not enumerate devices"); ByteBuffer deviceIDs = Buffers.newDirectByteBuffer((int)deviceCount.get()); - ret = cl.clGetContextInfo(ID, CL.CL_CONTEXT_DEVICES, deviceIDs.capacity(), deviceIDs, null); + ret = cl.clGetContextInfo(ID, CL_CONTEXT_DEVICES, deviceIDs.capacity(), deviceIDs, null); checkForError(ret, "can not enumerate devices"); devices = new CLDevice[deviceIDs.capacity() / (is32Bit() ? 4 : 8)]; @@ -236,7 +237,7 @@ public class CLContext extends CLObject implements CLResource { throw new RuntimeException("no OpenCL installation found"); } - return NativeSizeBuffer.allocateDirect(3).put(CL.CL_CONTEXT_PLATFORM) + return NativeSizeBuffer.allocateDirect(3).put(CL_CONTEXT_PLATFORM) .put(platform.ID).put(0) // 0 terminated array .rewind(); } diff --git a/src/com/jogamp/opencl/CLDevice.java b/src/com/jogamp/opencl/CLDevice.java index 6ca4cf38..abfb3a07 100644 --- a/src/com/jogamp/opencl/CLDevice.java +++ b/src/com/jogamp/opencl/CLDevice.java @@ -28,6 +28,7 @@ package com.jogamp.opencl; +import com.jogamp.opencl.llb.CL; import com.jogamp.opencl.util.CLUtil; import com.jogamp.opencl.spi.CLInfoAccessor; import java.nio.ByteOrder; @@ -40,7 +41,7 @@ import java.util.Map; import java.util.Scanner; import java.util.Set; -import static com.jogamp.opencl.CL.*; +import static com.jogamp.opencl.llb.CL.*; /** * This object represents an OpenCL device. diff --git a/src/com/jogamp/opencl/CLEvent.java b/src/com/jogamp/opencl/CLEvent.java index 52b316da..0b2c1eb7 100644 --- a/src/com/jogamp/opencl/CLEvent.java +++ b/src/com/jogamp/opencl/CLEvent.java @@ -29,11 +29,11 @@ package com.jogamp.opencl; import com.jogamp.opencl.impl.CLTLInfoAccessor; -import com.jogamp.opencl.impl.CLEventCallback; +import com.jogamp.opencl.llb.impl.CLEventCallback; import com.jogamp.common.nio.NativeSizeBuffer; import java.nio.Buffer; -import static com.jogamp.opencl.CL.*; +import static com.jogamp.opencl.llb.CL.*; import static com.jogamp.opencl.CLException.*; /** diff --git a/src/com/jogamp/opencl/CLEventList.java b/src/com/jogamp/opencl/CLEventList.java index 3642d915..8c09f60f 100644 --- a/src/com/jogamp/opencl/CLEventList.java +++ b/src/com/jogamp/opencl/CLEventList.java @@ -102,6 +102,7 @@ public final class CLEventList implements CLResource, AutoCloseable, Iterable<CL /** * Releases all CLEvents in this list. */ + @Override public void release() { for (int i = 0; i < size; i++) { events[i].release(); @@ -115,6 +116,7 @@ public final class CLEventList implements CLResource, AutoCloseable, Iterable<CL * @deprecated use {@link #release()} instead. */ @Deprecated + @Override public final void close() throws Exception { release(); } @@ -139,6 +141,7 @@ public final class CLEventList implements CLResource, AutoCloseable, Iterable<CL return events.length; } + @Override public Iterator<CLEvent> iterator() { return new EventIterator(events, size); } @@ -167,10 +170,12 @@ public final class CLEventList implements CLResource, AutoCloseable, Iterable<CL this.size = size; } + @Override public boolean hasNext() { return index < size; } + @Override public CLEvent next() { if(hasNext()) return events[index++]; @@ -178,6 +183,7 @@ public final class CLEventList implements CLResource, AutoCloseable, Iterable<CL return null; } + @Override public void remove() { throw new UnsupportedOperationException("remove() not supported."); } diff --git a/src/com/jogamp/opencl/CLException.java b/src/com/jogamp/opencl/CLException.java index 59eda198..f776730b 100644 --- a/src/com/jogamp/opencl/CLException.java +++ b/src/com/jogamp/opencl/CLException.java @@ -28,7 +28,7 @@ package com.jogamp.opencl; -import static com.jogamp.opencl.CL.*; +import static com.jogamp.opencl.llb.gl.CLGL.*; /** * Main Exception type for runtime OpenCL errors and failed function calls (e.g. returning not CL_SUCCESS). diff --git a/src/com/jogamp/opencl/CLImage.java b/src/com/jogamp/opencl/CLImage.java index 76993d62..82c29f7f 100644 --- a/src/com/jogamp/opencl/CLImage.java +++ b/src/com/jogamp/opencl/CLImage.java @@ -30,9 +30,10 @@ package com.jogamp.opencl; import com.jogamp.opencl.impl.CLTLInfoAccessor; import com.jogamp.common.nio.NativeSizeBuffer; +import com.jogamp.opencl.llb.CL; import java.nio.Buffer; -import static com.jogamp.opencl.CL.*; +import static com.jogamp.opencl.llb.CL.*; /** * diff --git a/src/com/jogamp/opencl/CLImage2d.java b/src/com/jogamp/opencl/CLImage2d.java index 9e43e4b2..9a5d5edc 100644 --- a/src/com/jogamp/opencl/CLImage2d.java +++ b/src/com/jogamp/opencl/CLImage2d.java @@ -29,6 +29,7 @@ package com.jogamp.opencl; import com.jogamp.common.nio.Buffers; +import com.jogamp.opencl.llb.CL; import java.nio.Buffer; import java.nio.IntBuffer; diff --git a/src/com/jogamp/opencl/CLImage3d.java b/src/com/jogamp/opencl/CLImage3d.java index 4e29e06a..718f78e9 100644 --- a/src/com/jogamp/opencl/CLImage3d.java +++ b/src/com/jogamp/opencl/CLImage3d.java @@ -28,11 +28,12 @@ package com.jogamp.opencl; +import com.jogamp.opencl.llb.CL; import com.jogamp.common.nio.Buffers; import java.nio.Buffer; import java.nio.IntBuffer; -import static com.jogamp.opencl.CL.*; +import static com.jogamp.opencl.llb.CL.*; import static com.jogamp.opencl.CLException.*; /** diff --git a/src/com/jogamp/opencl/CLImageFormat.java b/src/com/jogamp/opencl/CLImageFormat.java index 5f014e0d..08fe7c7f 100644 --- a/src/com/jogamp/opencl/CLImageFormat.java +++ b/src/com/jogamp/opencl/CLImageFormat.java @@ -28,9 +28,9 @@ package com.jogamp.opencl; -import com.jogamp.opencl.impl.CLImageFormatImpl; +import com.jogamp.opencl.llb.impl.CLImageFormatImpl; -import static com.jogamp.opencl.CL.*; +import static com.jogamp.opencl.llb.CL.*; /** * Represents the OpenCL image format with its channeltype and order. diff --git a/src/com/jogamp/opencl/CLKernel.java b/src/com/jogamp/opencl/CLKernel.java index 4c898b4b..d833eca6 100644 --- a/src/com/jogamp/opencl/CLKernel.java +++ b/src/com/jogamp/opencl/CLKernel.java @@ -35,7 +35,7 @@ import java.nio.Buffer; import java.nio.ByteBuffer; import static com.jogamp.opencl.CLException.*; -import static com.jogamp.opencl.CL.*; +import static com.jogamp.opencl.llb.CL.*; import static com.jogamp.common.os.Platform.*; /** @@ -316,10 +316,11 @@ public class CLKernel extends CLObject implements CLResource, Cloneable { /** * Releases all resources of this kernel from its context. */ + @Override public void release() { int ret = cl.clReleaseKernel(ID); program.onKernelReleased(this); - if(ret != CL.CL_SUCCESS) { + if(ret != CL_SUCCESS) { throw newException(ret, "can not release "+this); } } diff --git a/src/com/jogamp/opencl/CLMemory.java b/src/com/jogamp/opencl/CLMemory.java index f299439d..ee8a7bf3 100644 --- a/src/com/jogamp/opencl/CLMemory.java +++ b/src/com/jogamp/opencl/CLMemory.java @@ -28,10 +28,11 @@ package com.jogamp.opencl; -import com.jogamp.opencl.gl.CLGLI; +import com.jogamp.opencl.llb.CL; +import com.jogamp.opencl.llb.gl.CLGL; import com.jogamp.common.nio.Buffers; import com.jogamp.common.nio.NativeSizeBuffer; -import com.jogamp.opencl.impl.CLMemObjectDestructorCallback; +import com.jogamp.opencl.llb.impl.CLMemObjectDestructorCallback; import java.nio.Buffer; import java.nio.IntBuffer; import java.util.ArrayList; @@ -39,7 +40,7 @@ import java.util.EnumSet; import java.util.List; import static com.jogamp.opencl.CLException.*; -import static com.jogamp.opencl.gl.CLGLI.*; +import static com.jogamp.opencl.llb.gl.CLGL.*; /** * Common superclass for all OpenCL memory types. @@ -231,7 +232,7 @@ public abstract class CLMemory <B extends Buffer> extends CLObject implements CL @Deprecated /*public*/ final GLObjectType _getGLObjectType() { int[] array = new int[1]; - int ret = ((CLGLI)cl).clGetGLObjectInfo(ID, array, 0, null, 0); + int ret = ((CLGL)cl).clGetGLObjectInfo(ID, array, 0, null, 0); CLException.checkForError(ret, "error while asking for gl object info"); return GLObjectType.valueOf(array[0]); } @@ -242,7 +243,7 @@ public abstract class CLMemory <B extends Buffer> extends CLObject implements CL @Deprecated /*public*/ final int _getGLObjectID() { int[] array = new int[1]; - int ret = ((CLGLI)cl).clGetGLObjectInfo(ID, null, 0, array, 0); + int ret = ((CLGL)cl).clGetGLObjectInfo(ID, null, 0, array, 0); CLException.checkForError(ret, "error while asking for gl object info"); return array[0]; } diff --git a/src/com/jogamp/opencl/CLObject.java b/src/com/jogamp/opencl/CLObject.java index 54031884..eb1f0abf 100644 --- a/src/com/jogamp/opencl/CLObject.java +++ b/src/com/jogamp/opencl/CLObject.java @@ -29,6 +29,7 @@ package com.jogamp.opencl; import com.jogamp.common.AutoCloseable; +import com.jogamp.opencl.llb.CL; /** * Common superclass for all OpenCL objects. @@ -64,6 +65,7 @@ abstract class CLObject implements AutoCloseable { * @see java.lang.AutoCloseable */ @Deprecated + @Override public final void close() { if(this instanceof CLResource) { ((CLResource)this).release(); diff --git a/src/com/jogamp/opencl/CLPlatform.java b/src/com/jogamp/opencl/CLPlatform.java index 4a87b43d..a494edcb 100644 --- a/src/com/jogamp/opencl/CLPlatform.java +++ b/src/com/jogamp/opencl/CLPlatform.java @@ -28,6 +28,7 @@ package com.jogamp.opencl; +import com.jogamp.opencl.llb.CL; import com.jogamp.opencl.impl.CLTLAccessorFactory; import com.jogamp.common.nio.Buffers; import com.jogamp.common.os.DynamicLookupHelper; @@ -37,8 +38,8 @@ import com.jogamp.common.nio.NativeSizeBuffer; import com.jogamp.gluegen.runtime.FunctionAddressResolver; import com.jogamp.opencl.spi.CLPlatformInfoAccessor; import com.jogamp.opencl.util.CLUtil; -import com.jogamp.opencl.impl.CLImpl; -import com.jogamp.opencl.impl.CLProcAddressTable; +import com.jogamp.opencl.llb.impl.CLImpl; +import com.jogamp.opencl.llb.impl.CLProcAddressTable; import com.jogamp.opencl.spi.CLAccessorFactory; import com.jogamp.opencl.util.Filter; import com.jogamp.opencl.util.JOCLVersion; @@ -55,7 +56,7 @@ import java.security.PrivilegedAction; import static java.security.AccessController.*; import static com.jogamp.opencl.CLException.*; -import static com.jogamp.opencl.CL.*; +import static com.jogamp.opencl.llb.CL.*; /** * CLPlatfrorm representing a OpenCL implementation (e.g. graphics driver). diff --git a/src/com/jogamp/opencl/CLProgram.java b/src/com/jogamp/opencl/CLProgram.java index e8706a73..b991c1e9 100644 --- a/src/com/jogamp/opencl/CLProgram.java +++ b/src/com/jogamp/opencl/CLProgram.java @@ -34,7 +34,7 @@ import com.jogamp.opencl.util.CLUtil; import com.jogamp.common.os.Platform; import com.jogamp.common.nio.NativeSizeBuffer; import com.jogamp.common.nio.PointerBuffer; -import com.jogamp.opencl.impl.BuildProgramCallback; +import com.jogamp.opencl.llb.impl.BuildProgramCallback; import com.jogamp.opencl.util.CLBuildListener; import java.nio.ByteBuffer; import java.nio.IntBuffer; @@ -48,7 +48,7 @@ import java.util.Map; import java.util.concurrent.locks.ReentrantLock; import static com.jogamp.opencl.CLException.*; -import static com.jogamp.opencl.CL.*; +import static com.jogamp.opencl.llb.CL.*; import static com.jogamp.common.nio.Buffers.*; /** diff --git a/src/com/jogamp/opencl/CLSampler.java b/src/com/jogamp/opencl/CLSampler.java index 015445e3..04751be2 100644 --- a/src/com/jogamp/opencl/CLSampler.java +++ b/src/com/jogamp/opencl/CLSampler.java @@ -34,7 +34,7 @@ import com.jogamp.common.nio.NativeSizeBuffer; import java.nio.Buffer; import static com.jogamp.opencl.CLException.*; -import static com.jogamp.opencl.CL.*; +import static com.jogamp.opencl.llb.CL.*; import static com.jogamp.opencl.util.CLUtil.*; /** @@ -78,7 +78,7 @@ public class CLSampler extends CLObject implements CLResource { public void release() { int ret = cl.clReleaseSampler(ID); context.onSamplerReleased(this); - if(ret != CL.CL_SUCCESS) { + if(ret != CL_SUCCESS) { throw newException(ret, "can not release "+this); } } diff --git a/src/com/jogamp/opencl/CLUserEvent.java b/src/com/jogamp/opencl/CLUserEvent.java index 4bbbf3b8..22839b0a 100644 --- a/src/com/jogamp/opencl/CLUserEvent.java +++ b/src/com/jogamp/opencl/CLUserEvent.java @@ -33,7 +33,7 @@ package com.jogamp.opencl; import static com.jogamp.opencl.CLException.*; -import static com.jogamp.opencl.CL.*; +import static com.jogamp.opencl.llb.CL.*; /** * Custom, user controlled event. diff --git a/src/com/jogamp/opencl/gl/CLGLBuffer.java b/src/com/jogamp/opencl/gl/CLGLBuffer.java index 148aa83d..55cede88 100644 --- a/src/com/jogamp/opencl/gl/CLGLBuffer.java +++ b/src/com/jogamp/opencl/gl/CLGLBuffer.java @@ -32,6 +32,7 @@ import com.jogamp.opencl.CLBuffer; import com.jogamp.opencl.CLCommandQueue; import com.jogamp.opencl.CLContext; import com.jogamp.opencl.CLException; +import com.jogamp.opencl.llb.gl.CLGL; import java.nio.Buffer; import javax.media.opengl.GLContext; @@ -58,7 +59,7 @@ public final class CLGLBuffer<B extends Buffer> extends CLBuffer<B> implements C static <B extends Buffer> CLGLBuffer<B> create(CLContext context, B directBuffer, long size, int flags, int glObject) { checkBuffer(directBuffer, flags); - CLGLI clgli = (CLGLI)getCL(context); + CLGL clgli = (CLGL)getCL(context); int[] result = new int[1]; long id = clgli.clCreateFromGLBuffer(context.ID, flags, glObject, result, 0); @@ -86,10 +87,12 @@ public final class CLGLBuffer<B extends Buffer> extends CLBuffer<B> implements C initCLCapacity(); } + @Override public int getGLObjectID() { return GLID; } + @Override public GLObjectType getGLObjectType() { return GLObjectType.GL_OBJECT_BUFFER; } @@ -99,6 +102,7 @@ public final class CLGLBuffer<B extends Buffer> extends CLBuffer<B> implements C return (CLGLContext) super.getContext(); } + @Override public GLContext getGLContext() { return getContext().getGLContext(); } diff --git a/src/com/jogamp/opencl/gl/CLGLContext.java b/src/com/jogamp/opencl/gl/CLGLContext.java index ee6c2108..e688717f 100644 --- a/src/com/jogamp/opencl/gl/CLGLContext.java +++ b/src/com/jogamp/opencl/gl/CLGLContext.java @@ -28,6 +28,7 @@ package com.jogamp.opencl.gl; +import com.jogamp.opencl.llb.gl.CLGL; import com.jogamp.opencl.CLContext; import com.jogamp.opencl.CLDevice; import java.nio.Buffer; @@ -42,7 +43,7 @@ import jogamp.opengl.windows.wgl.WindowsWGLContext; import jogamp.opengl.x11.glx.X11GLXContext; import javax.media.opengl.GLContext; -import static com.jogamp.opencl.gl.CLGLI.*; +import static com.jogamp.opencl.llb.gl.CLGL.*; /** * OpenCL Context supporting JOGL-JOCL interoperablity. @@ -308,8 +309,8 @@ public final class CLGLContext extends CLContext { * Return the low level OpenCL interface with OpenGL interoperability. */ @Override - public CLGLI getCL() { - return (CLGLI)super.getCL(); + public CLGL getCL() { + return (CLGL)super.getCL(); } /** diff --git a/src/com/jogamp/opencl/gl/CLGLImage2d.java b/src/com/jogamp/opencl/gl/CLGLImage2d.java index 94ad7e84..dd6b9d5a 100644 --- a/src/com/jogamp/opencl/gl/CLGLImage2d.java +++ b/src/com/jogamp/opencl/gl/CLGLImage2d.java @@ -28,15 +28,16 @@ package com.jogamp.opencl.gl; -import com.jogamp.opencl.CL; +import com.jogamp.opencl.llb.CL; +import com.jogamp.opencl.llb.gl.CLGL; import com.jogamp.opencl.CLContext; import com.jogamp.opencl.CLImage2d; import com.jogamp.opencl.CLImageFormat; -import com.jogamp.opencl.impl.CLImageFormatImpl; +import com.jogamp.opencl.llb.impl.CLImageFormatImpl; import java.nio.Buffer; import javax.media.opengl.GLContext; -import static com.jogamp.opencl.CL.*; +import static com.jogamp.opencl.llb.CL.*; /** * 2D OpenCL image representing an OpenGL renderbuffer. @@ -60,7 +61,7 @@ public class CLGLImage2d<B extends Buffer> extends CLImage2d<B> implements CLGLO CL cl = getCL(context); int[] result = new int[1]; - CLGLI clgli = (CLGLI)cl; + CLGL clgli = (CLGL)cl; long id = clgli.clCreateFromGLRenderbuffer(context.ID, flags, glObject, result, 0); @@ -94,6 +95,7 @@ public class CLGLImage2d<B extends Buffer> extends CLImage2d<B> implements CLGLO return (CLGLContext) super.getContext(); } + @Override public GLContext getGLContext() { return getContext().getGLContext(); } diff --git a/src/com/jogamp/opencl/gl/CLGLTexture2d.java b/src/com/jogamp/opencl/gl/CLGLTexture2d.java index faf1bdc8..484d00d2 100644 --- a/src/com/jogamp/opencl/gl/CLGLTexture2d.java +++ b/src/com/jogamp/opencl/gl/CLGLTexture2d.java @@ -28,13 +28,15 @@ package com.jogamp.opencl.gl; -import com.jogamp.opencl.CL; +import com.jogamp.opencl.llb.CL; import com.jogamp.opencl.CLContext; import com.jogamp.opencl.CLImageFormat; -import com.jogamp.opencl.impl.CLImageFormatImpl; +import com.jogamp.opencl.llb.impl.CLImageFormatImpl; +import com.jogamp.opencl.llb.gl.CLGL; import java.nio.Buffer; -import static com.jogamp.opencl.CL.*; +import static com.jogamp.opencl.CLException.*; +import static com.jogamp.opencl.llb.CL.*; /** * 2D OpenCL image representing an 2D OpenGL texture. @@ -58,26 +60,29 @@ public class CLGLTexture2d<B extends Buffer> extends CLGLImage2d<B> implements C CL cl = getCL(context); int[] result = new int[1]; - CLGLI clgli = (CLGLI)cl; + CLGL clgli = (CLGL)cl; long id = clgli.clCreateFromGLTexture2D(context.ID, flags, target, mipLevel, texture, result, 0); + checkForError((int)id, "can not share memory with texture #"+texture+"."); CLImageInfoAccessor accessor = new CLImageInfoAccessor(cl, id); CLImageFormat format = createUninitializedImageFormat(); accessor.getInfo(CL_IMAGE_FORMAT, CLImageFormatImpl.size(), format.getFormatImpl().getBuffer(), null); - int width = (int)accessor.getLong(CL_IMAGE_WIDTH); - int height = (int)accessor.getLong(CL_IMAGE_HEIGHT); + int width = 640; //(int)accessor.getLong(CL_IMAGE_WIDTH); + int height = 480; //(int)accessor.getLong(CL_IMAGE_HEIGHT); return new CLGLTexture2d<B>(context, directBuffer, format, accessor, target, mipLevel, width, height, id, texture, flags); } + @Override public int getTextureTarget() { return target; } + @Override public int getMipMapLevel() { return mipMapLevel; } diff --git a/src/com/jogamp/opencl/gl/CLGLTexture3d.java b/src/com/jogamp/opencl/gl/CLGLTexture3d.java index ace779d9..8dd2682c 100644 --- a/src/com/jogamp/opencl/gl/CLGLTexture3d.java +++ b/src/com/jogamp/opencl/gl/CLGLTexture3d.java @@ -28,15 +28,16 @@ package com.jogamp.opencl.gl; -import com.jogamp.opencl.CL; +import com.jogamp.opencl.llb.gl.CLGL; +import com.jogamp.opencl.llb.CL; import com.jogamp.opencl.CLContext; import com.jogamp.opencl.CLImage3d; import com.jogamp.opencl.CLImageFormat; -import com.jogamp.opencl.impl.CLImageFormatImpl; +import com.jogamp.opencl.llb.impl.CLImageFormatImpl; import java.nio.Buffer; import javax.media.opengl.GLContext; -import static com.jogamp.opencl.CL.*; +import static com.jogamp.opencl.llb.CL.*; /** * 3D OpenCL image representing an 3D OpenGL texture. @@ -66,7 +67,7 @@ public class CLGLTexture3d<B extends Buffer> extends CLImage3d<B> implements CLG CL cl = getCL(context); int[] result = new int[1]; - CLGLI clgli = (CLGLI)cl; + CLGL clgli = (CLGL)cl; long id = clgli.clCreateFromGLTexture3D(context.ID, flags, target, mipLevel, texture, result, 0); @@ -82,18 +83,22 @@ public class CLGLTexture3d<B extends Buffer> extends CLImage3d<B> implements CLG return new CLGLTexture3d<B>(context, directBuffer, format, accessor, target, mipLevel, width, height, depth, id, texture, flags); } + @Override public int getGLObjectID() { return GLID; } + @Override public int getTextureTarget() { return target; } + @Override public int getMipMapLevel() { return mipMapLevel; } + @Override public GLObjectType getGLObjectType() { return GLObjectType.GL_OBJECT_TEXTURE3D; } diff --git a/src/com/jogamp/opencl/impl/CLTLAccessorFactory.java b/src/com/jogamp/opencl/impl/CLTLAccessorFactory.java index 1c7f9526..b5ad1d8a 100644 --- a/src/com/jogamp/opencl/impl/CLTLAccessorFactory.java +++ b/src/com/jogamp/opencl/impl/CLTLAccessorFactory.java @@ -5,7 +5,7 @@ package com.jogamp.opencl.impl; import java.nio.IntBuffer; import com.jogamp.common.nio.NativeSizeBuffer; -import com.jogamp.opencl.CL; +import com.jogamp.opencl.llb.CL; import com.jogamp.opencl.spi.CLAccessorFactory; import com.jogamp.opencl.spi.CLInfoAccessor; import com.jogamp.opencl.spi.CLPlatformInfoAccessor; diff --git a/src/com/jogamp/opencl/impl/BuildProgramCallback.java b/src/com/jogamp/opencl/llb/impl/BuildProgramCallback.java index cb4b36d1..51bde322 100644 --- a/src/com/jogamp/opencl/impl/BuildProgramCallback.java +++ b/src/com/jogamp/opencl/llb/impl/BuildProgramCallback.java @@ -26,15 +26,15 @@ * or implied, of JogAmp Community. */ -package com.jogamp.opencl.impl; +package com.jogamp.opencl.llb.impl; /** * A callback an application can register to be called when the program executable * has been built (successfully or unsuccessfully).<br/> - * Note1: registering a build callback can make {@link com.jogamp.opencl.CL#clBuildProgram} non blocking (OpenCL implementation dependent).<br/> - * Note2: the thread which calls this method is unspecified. The Application should ensure propper synchronization. + * Note1: registering a build callback can make {@link com.jogamp.opencl.llb.CL#clBuildProgram} non blocking (OpenCL implementation dependent).<br/> + * Note2: the thread which calls this method is unspecified. The Application should ensure proper synchronization. * @author Michael Bien - * @see com.jogamp.opencl.CL#clBuildProgram(long, int, com.jogamp.common.nio.PointerBuffer, java.lang.String, com.jogamp.opencl.impl.BuildProgramCallback) + * @see com.jogamp.opencl.llb.CL#clBuildProgram */ public interface BuildProgramCallback { diff --git a/src/com/jogamp/opencl/impl/CLEventCallback.java b/src/com/jogamp/opencl/llb/impl/CLEventCallback.java index d1526a08..1373995a 100644 --- a/src/com/jogamp/opencl/impl/CLEventCallback.java +++ b/src/com/jogamp/opencl/llb/impl/CLEventCallback.java @@ -30,7 +30,7 @@ * Created on Tuesday, July 06 2010 00:46 */ -package com.jogamp.opencl.impl; +package com.jogamp.opencl.llb.impl; /** * A callback for a specific command execution status. diff --git a/src/com/jogamp/opencl/impl/CLImpl.java b/src/com/jogamp/opencl/llb/impl/CLImpl.java index 8ea44201..5de3126d 100644 --- a/src/com/jogamp/opencl/impl/CLImpl.java +++ b/src/com/jogamp/opencl/llb/impl/CLImpl.java @@ -29,7 +29,7 @@ /* * Created on Monday, June 07 2010 at 04:25 */ -package com.jogamp.opencl.impl; +package com.jogamp.opencl.llb.impl; import com.jogamp.common.nio.NativeSizeBuffer; import com.jogamp.common.os.Platform; @@ -56,6 +56,7 @@ public class CLImpl extends CLAbstractImpl { this.contextCallbackMap.setKeyNotFoundValue(0); } + @Override public long clCreateContext(NativeSizeBuffer properties, NativeSizeBuffer devices, CLErrorHandler pfn_notify, IntBuffer errcode_ret) { if (properties != null && !properties.isDirect()) { @@ -87,6 +88,7 @@ public class CLImpl extends CLAbstractImpl { private native long clCreateContext0(Object cl_context_properties, int props_offset, int numDevices, Object devices, int devices_offset, Object pfn_notify, long[] global, Object errcode_ret, int err_offset, long address); + @Override public long clCreateContextFromType(NativeSizeBuffer properties, long device_type, CLErrorHandler pfn_notify, IntBuffer errcode_ret) { if (properties != null && !properties.isDirect()) { @@ -117,6 +119,7 @@ public class CLImpl extends CLAbstractImpl { private native long clCreateContextFromType0(Object properties, int props_offset, long device_type, Object pfn_notify, long[] global, Object errcode_ret, int err_offset, long address); + @Override public int clReleaseContext(long context) { long global = 0; synchronized (contextCallbackMap) { @@ -134,6 +137,7 @@ public class CLImpl extends CLAbstractImpl { public native int clReleaseContextImpl(long context, long global, long address); /** Interface to C language function: <br> <code> int32_t clBuildProgram(cl_program, uint32_t, cl_device_id * , const char * , void * ); </code> */ + @Override public int clBuildProgram(long program, int deviceCount, NativeSizeBuffer deviceList, String options, BuildProgramCallback cb) { if (deviceList != null && !deviceList.isDirect()) { @@ -152,6 +156,7 @@ public class CLImpl extends CLAbstractImpl { private native int clBuildProgram0(long program, int deviceCount, Object deviceList, int deviceListOffset, String options, BuildProgramCallback cb, long address); + @Override public int clSetEventCallback(long event, int trigger, CLEventCallback callback) { final long address = addressTable._addressof_clSetEventCallback; if (address == 0) { @@ -163,6 +168,7 @@ public class CLImpl extends CLAbstractImpl { private native int clSetEventCallback0(long event, int type, CLEventCallback cb, long address); + @Override public int clSetMemObjectDestructorCallback(long memObjID, CLMemObjectDestructorCallback cb) { final long address = addressTable._addressof_clSetMemObjectDestructorCallback; if (address == 0) { @@ -182,6 +188,7 @@ public class CLImpl extends CLAbstractImpl { @param event_wait_list a direct {@link com.jogamp.gluegen.common.nio.NativeSizeBuffer} @param event a direct {@link com.jogamp.gluegen.common.nio.NativeSizeBuffer} @param errcode_ret a direct {@link java.nio.IntBuffer} */ + @Override public ByteBuffer clEnqueueMapImage(long command_queue, long image, int blocking_map, long map_flags, NativeSizeBuffer origin, NativeSizeBuffer range, NativeSizeBuffer image_row_pitch, NativeSizeBuffer image_slice_pitch, diff --git a/src/com/jogamp/opencl/impl/CLMemObjectDestructorCallback.java b/src/com/jogamp/opencl/llb/impl/CLMemObjectDestructorCallback.java index c040d2ce..5ed57cce 100644 --- a/src/com/jogamp/opencl/impl/CLMemObjectDestructorCallback.java +++ b/src/com/jogamp/opencl/llb/impl/CLMemObjectDestructorCallback.java @@ -30,7 +30,7 @@ * Created on Thursday, September 02 2010 23:09 */ -package com.jogamp.opencl.impl; +package com.jogamp.opencl.llb.impl; /** * A callback which is invoked by the OpenCL implementation when the memory diff --git a/src/com/jogamp/opencl/spi/CLAccessorFactory.java b/src/com/jogamp/opencl/spi/CLAccessorFactory.java index 6239bb37..752891b4 100644 --- a/src/com/jogamp/opencl/spi/CLAccessorFactory.java +++ b/src/com/jogamp/opencl/spi/CLAccessorFactory.java @@ -3,7 +3,7 @@ */ package com.jogamp.opencl.spi; -import com.jogamp.opencl.CL; +import com.jogamp.opencl.llb.CL; /** * Implementations of this interface are factories responsible for creating CLAccessors. diff --git a/src/com/jogamp/opencl/util/CLBuildListener.java b/src/com/jogamp/opencl/util/CLBuildListener.java index 9a520582..05517850 100644 --- a/src/com/jogamp/opencl/util/CLBuildListener.java +++ b/src/com/jogamp/opencl/util/CLBuildListener.java @@ -37,10 +37,10 @@ import com.jogamp.opencl.CLProgram; /** * A callback an application can register to be called when the program executable * has been built (successfully or unsuccessfully).<br/> - * Note1: registering a build callback can make {@link com.jogamp.opencl.CL#clBuildProgram} non blocking (OpenCL implementation dependent).<br/> + * Note1: registering a build callback can make {@link com.jogamp.opencl.llb.CL#clBuildProgram} non blocking (OpenCL implementation dependent).<br/> * Note2: the thread which calls this method is unspecified. The Application should ensure propper synchronization. * @author Michael Bien - * @see com.jogamp.opencl.CL#clBuildProgram(long, int, com.jogamp.common.nio.NativeSizeBuffer, java.lang.String, com.jogamp.opencl.impl.BuildProgramCallback) + * @see com.jogamp.opencl.llb.CL#clBuildProgram(long, int, com.jogamp.common.nio.NativeSizeBuffer, java.lang.String, com.jogamp.opencl.llb.impl.BuildProgramCallback) */ public interface CLBuildListener { diff --git a/src/com/jogamp/opencl/util/CLInfo.java b/src/com/jogamp/opencl/util/CLInfo.java index 3b483fc2..40c4f2ff 100644 --- a/src/com/jogamp/opencl/util/CLInfo.java +++ b/src/com/jogamp/opencl/util/CLInfo.java @@ -34,7 +34,7 @@ package com.jogamp.opencl.util; import com.jogamp.common.os.Platform; import com.jogamp.opencl.CLDevice; import com.jogamp.opencl.CLPlatform; -import com.jogamp.opencl.impl.CLImpl; +import com.jogamp.opencl.llb.impl.CLImpl; import java.util.Map; diff --git a/src/com/jogamp/opencl/util/CLUtil.java b/src/com/jogamp/opencl/util/CLUtil.java index 371c493c..98a6cd7e 100644 --- a/src/com/jogamp/opencl/util/CLUtil.java +++ b/src/com/jogamp/opencl/util/CLUtil.java @@ -29,7 +29,7 @@ package com.jogamp.opencl.util; import com.jogamp.common.JogampRuntimeException; -import com.jogamp.opencl.CL; +import com.jogamp.opencl.llb.CL; import com.jogamp.opencl.CLDevice; import com.jogamp.opencl.CLPlatform; import com.jogamp.opencl.CLProperty; diff --git a/src/com/jogamp/opencl/util/JOCLVersion.java b/src/com/jogamp/opencl/util/JOCLVersion.java index 265233a2..48dd2a9e 100644 --- a/src/com/jogamp/opencl/util/JOCLVersion.java +++ b/src/com/jogamp/opencl/util/JOCLVersion.java @@ -35,7 +35,7 @@ import com.jogamp.common.GlueGenVersion; import com.jogamp.common.os.Platform; import com.jogamp.common.util.JogampVersion; import com.jogamp.common.util.VersionUtil; -import com.jogamp.opencl.CL; +import com.jogamp.opencl.llb.CL; import java.security.PrivilegedAction; import java.util.jar.Manifest; @@ -56,7 +56,7 @@ public class JOCLVersion extends JogampVersion { private static JOCLVersion createInstance() { return doPrivileged(new PrivilegedAction<JOCLVersion>() { - public JOCLVersion run() { + @Override public JOCLVersion run() { Manifest manifest = VersionUtil.getManifest(CL.class.getClassLoader(), PACKAGE); if(manifest == null) { manifest = new Manifest(); @@ -92,7 +92,7 @@ public class JOCLVersion extends JogampVersion { try{ doPrivileged(new PrivilegedAction<Object>() { - public Object run() { + @Override public Object run() { sb.append(GlueGenVersion.getInstance().toString()); return null; } |