diff options
author | Michael Bien <[email protected]> | 2011-05-27 03:00:12 +0200 |
---|---|---|
committer | Michael Bien <[email protected]> | 2011-05-27 03:00:12 +0200 |
commit | a444a384b808e423f2e8377ff14c69b0c4be043a (patch) | |
tree | 56050afad314344ee8c99aa57698969da97b3d97 /src/com/jogamp/opencl/gl | |
parent | 08a479b22d4ba9da9ee79fc938ac4de7fb83dc5a (diff) |
LLB refactoring.
- split up CL into multiple sub interfaces
- seperation is now feature wise
- introdused llb package for low level classes
Diffstat (limited to 'src/com/jogamp/opencl/gl')
-rw-r--r-- | src/com/jogamp/opencl/gl/CLGLBuffer.java | 6 | ||||
-rw-r--r-- | src/com/jogamp/opencl/gl/CLGLContext.java | 7 | ||||
-rw-r--r-- | src/com/jogamp/opencl/gl/CLGLImage2d.java | 10 | ||||
-rw-r--r-- | src/com/jogamp/opencl/gl/CLGLTexture2d.java | 17 | ||||
-rw-r--r-- | src/com/jogamp/opencl/gl/CLGLTexture3d.java | 13 |
5 files changed, 35 insertions, 18 deletions
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; } |