Skip to content

Commit

Permalink
Remove CLGL interface
Browse files Browse the repository at this point in the history
This removes the last sub-interface that would have to be separately
versioned for future versions of OpenCL. After this, new OpenCL versions
will only create one new interface and one new implementation.
  • Loading branch information
WadeWalker committed Nov 8, 2015
1 parent 37c656e commit 0135df3
Show file tree
Hide file tree
Showing 15 changed files with 35 additions and 84 deletions.
11 changes: 0 additions & 11 deletions make/build.xml
Expand Up @@ -410,17 +410,6 @@
<classpath refid="gluegen.classpath" />
</gluegen>

<echo message="Generating CLGL.java from OpenCL version 1.1"/>
<gluegen src="${stub.includes}/opencl.h"
outputRootDir="${build}"
config="${config}/clgl-if.cfg"
includeRefid="stub.includes.fileset.all.11"
literalInclude="${stub.includes.gluegen.all}"
emitter="com.jogamp.gluegen.JavaEmitter"
debug="false">
<classpath refid="gluegen.classpath" />
</gluegen>

<echo message="Generating CLImpl.java, CLImpl_JNI.c, and CLProcAddressTable.java for OpenCL version 1.1"/>
<gluegen src="${stub.includes}/opencl.h"
outputRootDir="${build}"
Expand Down
9 changes: 6 additions & 3 deletions make/config/cl-if.cfg
Expand Up @@ -14,9 +14,6 @@ ClassJavadoc CL * @author Michael Bien, GlueGen, et al.
ClassJavadoc CL */
JavaClass CL

#ignore cl-gl interoperability functions. Interface 'CL' is pure OpenCL.
Ignore CL_GL_.*|cl.*GL.*|.*_GL_.*

Ignore clCreateContext
Ignore clCreateContextFromType
Ignore clBuildProgram
Expand Down Expand Up @@ -44,3 +41,9 @@ CustomJavaCode CL public int clSetMemObjectDestructorCallback(long memObjID, CL
CustomJavaCode CL
CustomJavaCode CL /** Interface to C language function: <br> <code> int32_t {@native clSetEventCallback}(cl_event event, cl_int command_exec_callback_type, void (CL_CALLBACK *pfn_event_notify) (cl_event event, cl_int event_command_exec_status, void *user_data), void *user_data); </code> */
CustomJavaCode CL public int clSetEventCallback(long event, int type, CLEventCallback cb);

CustomJavaCode CL /** To be used on Mac OSX instead of {@link #CL_CGL_SHAREGROUP_KHR}}. FIXME: For all Mac OSX versions? */
CustomJavaCode CL public static final int CL_CONTEXT_PROPERTY_USE_CGL_SHAREGROUP_APPLE = 0x10000000;

#append to generated c files
#CustomCCode #include <inttypes.h>
4 changes: 2 additions & 2 deletions make/config/cl-impl-11.cfg
Expand Up @@ -4,7 +4,7 @@ NativeOutputDir gensrc/native/jocl11
Style ImplOnly

#imports for all generated java files
Import com.jogamp.opencl.llb.gl.CLGL
Import com.jogamp.opencl.llb.CL
Import java.security.AccessController
Import java.security.PrivilegedAction
Import com.jogamp.common.nio.PointerBuffer
Expand All @@ -22,7 +22,7 @@ ClassJavadoc CLImpl11 */

ImplJavaClass CLImpl11
AccessControl CLImpl11 PUBLIC
Implements CLImpl11 CLGL
Implements CLImpl11 CL

LocalProcAddressCallingConvention __ALL__ CL_API_CALL

Expand Down
4 changes: 2 additions & 2 deletions make/config/cl-impl-12.cfg
Expand Up @@ -4,7 +4,7 @@ NativeOutputDir gensrc/native/jocl12
Style ImplOnly

#imports for all generated java files
Import com.jogamp.opencl.llb.gl.CLGL
Import com.jogamp.opencl.llb.CL
Import java.security.AccessController
Import java.security.PrivilegedAction
Import com.jogamp.common.nio.PointerBuffer
Expand All @@ -22,7 +22,7 @@ ClassJavadoc CLImpl12 */

ImplJavaClass CLImpl12
AccessControl CLImpl12 PUBLIC
Implements CLImpl12 CLGL
Implements CLImpl12 CL

LocalProcAddressCallingConvention __ALL__ CL_API_CALL

Expand Down
4 changes: 2 additions & 2 deletions make/config/cl-impl-20.cfg
Expand Up @@ -4,7 +4,7 @@ NativeOutputDir gensrc/native/jocl20
Style ImplOnly

#imports for all generated java files
Import com.jogamp.opencl.llb.gl.CLGL
Import com.jogamp.opencl.llb.CL
Import java.security.AccessController
Import java.security.PrivilegedAction
Import com.jogamp.common.nio.PointerBuffer
Expand All @@ -22,7 +22,7 @@ ClassJavadoc CLImpl20 */

ImplJavaClass CLImpl20
AccessControl CLImpl20 PUBLIC
Implements CLImpl20 CLGL
Implements CLImpl20 CL

LocalProcAddressCallingConvention __ALL__ CL_API_CALL

Expand Down
26 changes: 0 additions & 26 deletions make/config/clgl-if.cfg

This file was deleted.

9 changes: 2 additions & 7 deletions src/com/jogamp/opencl/CLCommandQueue.java
Expand Up @@ -47,7 +47,6 @@
import com.jogamp.common.nio.PointerBuffer;
import com.jogamp.opencl.gl.CLGLObject;
import com.jogamp.opencl.llb.CL;
import com.jogamp.opencl.llb.gl.CLGL;

/**
* The command queue is used to queue a set of operations for a specific {@link CLDevice}.
Expand Down Expand Up @@ -1701,9 +1700,7 @@ public CLCommandQueue putAcquireGLObjects(final PointerBuffer glObjectIDs, final
conditions = condition.size;
}

final CLGL xl = (CLGL) cl;

final int ret = xl.clEnqueueAcquireGLObjects(ID, glObjectIDs.remaining(), glObjectIDs,
final int ret = cl.clEnqueueAcquireGLObjects(ID, glObjectIDs.remaining(), glObjectIDs,
conditions, conditionIDs,
events==null ? null : events.IDs);

Expand Down Expand Up @@ -1770,9 +1767,7 @@ public CLCommandQueue putReleaseGLObjects(final PointerBuffer glObjectIDs, final
conditions = condition.size;
}

final CLGL xl = (CLGL) cl;

final int ret = xl.clEnqueueReleaseGLObjects(ID, glObjectIDs.remaining(), glObjectIDs,
final int ret = cl.clEnqueueReleaseGLObjects(ID, glObjectIDs.remaining(), glObjectIDs,
conditions, conditionIDs,
events==null ? null : events.IDs);

Expand Down
1 change: 0 additions & 1 deletion src/com/jogamp/opencl/CLEvent.java
Expand Up @@ -35,7 +35,6 @@
import java.nio.Buffer;

import static com.jogamp.opencl.llb.CL.*;
import static com.jogamp.opencl.llb.gl.CLGL.*;
import static com.jogamp.opencl.CLException.*;

/**
Expand Down
17 changes: 8 additions & 9 deletions src/com/jogamp/opencl/CLException.java
Expand Up @@ -28,7 +28,6 @@

package com.jogamp.opencl;

import com.jogamp.opencl.llb.gl.CLGL;
import com.jogamp.opencl.llb.CL;

/**
Expand Down Expand Up @@ -146,8 +145,8 @@ public static String resolveErrorCode(final int error) {
case CL.CL_PLATFORM_NOT_FOUND_KHR: return "CL_PLATFORM_NOT_FOUND_KHR";
case CL.CL_MISALIGNED_SUB_BUFFER_OFFSET: return "CL_MISALIGNED_SUB_BUFFER_OFFSET";
case CL.CL_EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST: return "CL_EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST";
case CLGL.CL_INVALID_GL_OBJECT: return "CL_INVALID_GL_OBJECT";
case CLGL.CL_INVALID_GL_SHAREGROUP_REFERENCE_KHR: return "CL_INVALID_GL_SHAREGROUP_REFERENCE_KHR";
case CL.CL_INVALID_GL_OBJECT: return "CL_INVALID_GL_OBJECT";
case CL.CL_INVALID_GL_SHAREGROUP_REFERENCE_KHR: return "CL_INVALID_GL_SHAREGROUP_REFERENCE_KHR";
default: return null;
}
}
Expand Down Expand Up @@ -203,8 +202,8 @@ private static CLException createSpecificException(final int error, final String
case CL.CL_PLATFORM_NOT_FOUND_KHR: return new CLPlatformNotFoundKhrException(message);
case CL.CL_MISALIGNED_SUB_BUFFER_OFFSET: return new CLMisalignedSubBufferOffsetException(message);
case CL.CL_EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST: return new CLExecStatusErrorForEventsInWaitListException(message);
case CLGL.CL_INVALID_GL_OBJECT: return new CLInvalidGLObjectException(message);
case CLGL.CL_INVALID_GL_SHAREGROUP_REFERENCE_KHR: return new CLInvalidGLSharegroupReferenceKhrException(message);
case CL.CL_INVALID_GL_OBJECT: return new CLInvalidGLObjectException(message);
case CL.CL_INVALID_GL_SHAREGROUP_REFERENCE_KHR: return new CLInvalidGLSharegroupReferenceKhrException(message);
default: return null;
}
}
Expand Down Expand Up @@ -664,9 +663,9 @@ public CLInvalidOperationException(final String message) {
*
*/
public final static class CLInvalidGLObjectException extends CLException {
private static final long serialVersionUID = CLException.serialVersionUID+CLGL.CL_INVALID_GL_OBJECT;
private static final long serialVersionUID = CLException.serialVersionUID+CL.CL_INVALID_GL_OBJECT;
public CLInvalidGLObjectException(final String message) {
super(CLGL.CL_INVALID_GL_OBJECT, "CL_INVALID_GL_OBJECT", message);
super(CL.CL_INVALID_GL_OBJECT, "CL_INVALID_GL_OBJECT", message);
}
}

Expand Down Expand Up @@ -719,9 +718,9 @@ public CLInvalidPropertyException(final String message) {
*
*/
public final static class CLInvalidGLSharegroupReferenceKhrException extends CLException {
private static final long serialVersionUID = CLException.serialVersionUID+CLGL.CL_INVALID_GL_SHAREGROUP_REFERENCE_KHR;
private static final long serialVersionUID = CLException.serialVersionUID+CL.CL_INVALID_GL_SHAREGROUP_REFERENCE_KHR;
public CLInvalidGLSharegroupReferenceKhrException(final String message) {
super(CLGL.CL_INVALID_GL_SHAREGROUP_REFERENCE_KHR, "CL_INVALID_GL_SHAREGROUP_REFERENCE_KHR", message);
super(CL.CL_INVALID_GL_SHAREGROUP_REFERENCE_KHR, "CL_INVALID_GL_SHAREGROUP_REFERENCE_KHR", message);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/com/jogamp/opencl/CLMemory.java
Expand Up @@ -39,7 +39,7 @@
import java.util.List;

import static com.jogamp.opencl.CLException.*;
import static com.jogamp.opencl.llb.gl.CLGL.*;
import static com.jogamp.opencl.llb.CL.*;

/**
* Common superclass for all OpenCL memory types.
Expand Down
7 changes: 3 additions & 4 deletions src/com/jogamp/opencl/gl/CLGLBuffer.java
Expand Up @@ -32,7 +32,7 @@
import com.jogamp.opencl.CLCommandQueue;
import com.jogamp.opencl.CLContext;
import com.jogamp.opencl.CLException;
import com.jogamp.opencl.llb.gl.CLGL;
import com.jogamp.opencl.llb.CL;

import java.nio.Buffer;
import com.jogamp.opengl.GLContext;
Expand All @@ -59,10 +59,9 @@ private CLGLBuffer(final CLContext context, final B directBuffer, final long id,
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);

final CLGL clgli = (CLGL)getCL(context);

final CL cl = getCL(context);
final int[] result = new int[1];
final long id = clgli.clCreateFromGLBuffer(context.ID, flags, glBuffer, result, 0);
final long id = cl.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);
Expand Down
13 changes: 6 additions & 7 deletions src/com/jogamp/opencl/gl/CLGLContext.java
Expand Up @@ -45,7 +45,6 @@
import com.jogamp.opencl.CLMemory.Mem;
import com.jogamp.opencl.CLPlatform;
import com.jogamp.opencl.llb.CL;
import com.jogamp.opencl.llb.gl.CLGL;

/**
* OpenCL Context supporting JOGL-JOCL interoperablity.
Expand Down Expand Up @@ -164,7 +163,7 @@ private static PointerBuffer setupContextProperties(final CLPlatform platform, f
// create the OpenGL context."
properties = PointerBuffer.allocateDirect(7);
final long displayHandle = ctxImpl.getDrawableImpl().getNativeSurface().getDisplayHandle();
properties.put(CLGL.CL_GL_CONTEXT_KHR).put(glID[0])
properties.put(CL.CL_GL_CONTEXT_KHR).put(glID[0])
.put(CL.CL_GLX_DISPLAY_KHR).put(displayHandle)
.put(CL.CL_CONTEXT_PLATFORM).put(platform.ID);
}else if(glContext instanceof WindowsWGLContext) {
Expand All @@ -174,7 +173,7 @@ private static PointerBuffer setupContextProperties(final CLPlatform platform, f
// HDC handle of the display used to create the OpenGL context."
properties = PointerBuffer.allocateDirect(7);
final long surfaceHandle = ctxImpl.getDrawableImpl().getNativeSurface().getSurfaceHandle();
properties.put(CLGL.CL_GL_CONTEXT_KHR).put(glID[0])
properties.put(CL.CL_GL_CONTEXT_KHR).put(glID[0])
.put(CL.CL_WGL_HDC_KHR).put(surfaceHandle)
.put(CL.CL_CONTEXT_PLATFORM).put(platform.ID);
}else if(glContext instanceof MacOSXCGLContext) {
Expand All @@ -191,7 +190,7 @@ private static PointerBuffer setupContextProperties(final CLPlatform platform, f
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)
properties.put(CL.CL_CONTEXT_PROPERTY_USE_CGL_SHAREGROUP_APPLE).put(group)
.put(CL.CL_CONTEXT_PLATFORM).put(platform.ID);
}else if(glContext instanceof EGLContext) {
// TODO test EGL
Expand All @@ -202,7 +201,7 @@ private static PointerBuffer setupContextProperties(final CLPlatform platform, f
// display used to create the OpenGL ES or OpenGL context."
properties = PointerBuffer.allocateDirect(7);
final long displayHandle = ctxImpl.getDrawableImpl().getNativeSurface().getDisplayHandle();
properties.put(CLGL.CL_GL_CONTEXT_KHR).put(glID[0])
properties.put(CL.CL_GL_CONTEXT_KHR).put(glID[0])
.put(CL.CL_EGL_DISPLAY_KHR).put(displayHandle)
.put(CL.CL_CONTEXT_PLATFORM).put(platform.ID);
}else{
Expand Down Expand Up @@ -318,8 +317,8 @@ public final <B extends Buffer> CLGLTexture3d<B> createFromGLTexture3d(final B d
* Return the low level OpenCL interface with OpenGL interoperability.
*/
@Override
public CLGL getCL() {
return (CLGL)super.getCL();
public CL getCL() {
return super.getCL();
}

/**
Expand Down
4 changes: 1 addition & 3 deletions src/com/jogamp/opencl/gl/CLGLImage2d.java
Expand Up @@ -29,7 +29,6 @@
package com.jogamp.opencl.gl;

import com.jogamp.opencl.llb.CL;
import com.jogamp.opencl.llb.gl.CLGL;
import com.jogamp.opencl.CLContext;
import com.jogamp.opencl.CLException;
import com.jogamp.opencl.CLImage2d;
Expand Down Expand Up @@ -62,9 +61,8 @@ static <B extends Buffer> CLGLImage2d<B> createFromGLRenderbuffer(final CLContex

final CL cl = getCL(context);
final int[] result = new int[1];
final CLGL clgli = (CLGL)cl;

final long id = clgli.clCreateFromGLRenderbuffer(context.ID, flags, renderbuffer, result, 0);
final long id = cl.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);
Expand Down
4 changes: 1 addition & 3 deletions src/com/jogamp/opencl/gl/CLGLTexture2d.java
Expand Up @@ -33,7 +33,6 @@
import com.jogamp.opencl.CLException;
import com.jogamp.opencl.CLImageFormat;
import com.jogamp.opencl.llb.impl.CLImageFormatImpl;
import com.jogamp.opencl.llb.gl.CLGL;

import java.nio.Buffer;

Expand All @@ -59,9 +58,8 @@ static <B extends Buffer> CLGLTexture2d<B> createFromGLTexture2d(final CLContext

final CL cl = getCL(context);
final int[] result = new int[1];
final CLGL clgli = (CLGL)cl;

final long id = clgli.clCreateFromGLTexture2D(context.ID, flags, target, mipLevel, texture, result, 0);
final long id = cl.clCreateFromGLTexture2D(context.ID, flags, target, mipLevel, texture, result, 0);
CLException.checkForError(result[0], "can not create CLGLTexture2d from texture #"+texture+".");

final CLImageInfoAccessor accessor = new CLImageInfoAccessor(cl, id);
Expand Down
4 changes: 1 addition & 3 deletions src/com/jogamp/opencl/gl/CLGLTexture3d.java
Expand Up @@ -28,7 +28,6 @@

package com.jogamp.opencl.gl;

import com.jogamp.opencl.llb.gl.CLGL;
import com.jogamp.opencl.llb.CL;
import com.jogamp.opencl.CLContext;
import com.jogamp.opencl.CLException;
Expand Down Expand Up @@ -68,9 +67,8 @@ static <B extends Buffer> CLGLTexture3d<B> createFromGLTexture3d(final CLContext

final CL cl = getCL(context);
final int[] result = new int[1];
final CLGL clgli = (CLGL)cl;

final long id = clgli.clCreateFromGLTexture3D(context.ID, flags, target, mipLevel, texture, result, 0);
final long id = cl.clCreateFromGLTexture3D(context.ID, flags, target, mipLevel, texture, result, 0);
CLException.checkForError(result[0], "can not create CLGLTexture3d from texture #"+texture+".");

final CLImageInfoAccessor accessor = new CLImageInfoAccessor(cl, id);
Expand Down

0 comments on commit 0135df3

Please sign in to comment.