diff options
author | Michael Bien <[email protected]> | 2010-01-15 16:49:17 +0100 |
---|---|---|
committer | Michael Bien <[email protected]> | 2010-01-15 16:49:17 +0100 |
commit | 5193eb3c98bfa14ca8eb5767452c8e97f9f495c6 (patch) | |
tree | 7b4d6d29a0218a62ea76e9ae63c2a629a3b7c7a5 /src/com/mbien/opencl/CLGLContext.java | |
parent | 64f212c105fd0f23e8116307b64ee4b87928823d (diff) |
improved QueueBarrier added constructor to restrict barriers to certain queues.
temporary added getGLObjectType to CLGLContext.
Diffstat (limited to 'src/com/mbien/opencl/CLGLContext.java')
-rw-r--r-- | src/com/mbien/opencl/CLGLContext.java | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/src/com/mbien/opencl/CLGLContext.java b/src/com/mbien/opencl/CLGLContext.java index abfe4b05..f3edae7f 100644 --- a/src/com/mbien/opencl/CLGLContext.java +++ b/src/com/mbien/opencl/CLGLContext.java @@ -10,7 +10,7 @@ import java.nio.LongBuffer; import javax.media.nativewindow.DefaultGraphicsConfiguration; import javax.media.opengl.GLContext; -import static com.mbien.opencl.CL.*; +import static com.mbien.opencl.CLGLI.*; /** * @@ -85,4 +85,40 @@ public final class CLGLContext extends CLContext { buffers.add(buffer); return buffer; } + + // TODO move somewhere else + public GLObjectType getGLObjectType(CLBuffer<?> buffer) { + int[] array = new int[1]; + int ret = ((CLGLI)cl).clGetGLObjectInfo(buffer.ID, array, 0, null, 0); + CLException.checkForError(ret, "error while asking for gl object info"); + return GLObjectType.valueOf(array[0]); + } + + public enum GLObjectType { + + GL_OBJECT_BUFFER(CL_GL_OBJECT_BUFFER), + GL_OBJECT_TEXTURE2D(CL_GL_OBJECT_TEXTURE2D), + GL_OBJECT_TEXTURE3D(CL_GL_OBJECT_TEXTURE3D), + GL_OBJECT_RENDERBUFFER(CL_GL_OBJECT_RENDERBUFFER); + + public final int TYPE; + + private GLObjectType(int type) { + this.TYPE = type; + } + + public static GLObjectType valueOf(int type) { + if(type == CL_GL_OBJECT_BUFFER) + return GL_OBJECT_BUFFER; + else if(type == CL_GL_OBJECT_TEXTURE2D) + return GL_OBJECT_TEXTURE2D; + else if(type == CL_GL_OBJECT_TEXTURE3D) + return GL_OBJECT_TEXTURE3D; + else if(type == CL_GL_OBJECT_RENDERBUFFER) + return GL_OBJECT_RENDERBUFFER; + return null; + } + } + + } |