diff options
author | Michael Bien <[email protected]> | 2010-09-15 18:33:21 +0200 |
---|---|---|
committer | Michael Bien <[email protected]> | 2010-09-15 18:33:21 +0200 |
commit | 91938387529fe220323e0c7472f788c78e1ace72 (patch) | |
tree | ff843ed5b9c26359aa2319d21f2ef60b0dcd216b /src/com/jogamp/opencl/gl | |
parent | 39d98824e916487ae838e3ade8230a3193db1ee9 (diff) |
removed CLContext factory methods with CLPlatform + CLDevice list combinations.
justification:
- information is now no longer needed since every CLDevice knows its CLPlatform
- OpenCL device IDs are not portable between CLPlatforms
changes:
- Context factories will throw CLInvalidPlatformException if the platform of all CLDevices does not match
related changes:
- [persistance] CLProgramBuilder stores now the ICD suffix to be later able to map binaries back to the platform + device
Diffstat (limited to 'src/com/jogamp/opencl/gl')
-rw-r--r-- | src/com/jogamp/opencl/gl/CLGLContext.java | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/src/com/jogamp/opencl/gl/CLGLContext.java b/src/com/jogamp/opencl/gl/CLGLContext.java index f4eda602..7ce4c766 100644 --- a/src/com/jogamp/opencl/gl/CLGLContext.java +++ b/src/com/jogamp/opencl/gl/CLGLContext.java @@ -59,16 +59,6 @@ public final class CLGLContext extends CLContext { } /** - * Creates a shared context on the specified devices. - * The platform to be used is implementation dependent. - * Note: This will make the GLContext current. - * @see GLContext#makeCurrent() - */ - public static CLGLContext create(GLContext glContext, CLDevice... devices) { - return create(glContext, null, devices); - } - - /** * Creates a shared context on the specified platform and with the specified * device types. * Note: This will make the GLContext current. @@ -95,12 +85,16 @@ public final class CLGLContext extends CLContext { * Note: This will make the GLContext current. * @see GLContext#makeCurrent() */ - public static CLGLContext create(GLContext glContext, CLPlatform platform, CLDevice... devices) { + public static CLGLContext create(GLContext glContext, CLDevice... devices) { - if(platform == null) { - platform = CLPlatform.getDefault(); + if(devices == null) { + throw new IllegalArgumentException("no devices specified"); + }else if(devices[0] == null) { + throw new IllegalArgumentException("first device was null"); } + CLPlatform platform = devices[0].getPlatform(); + long[] glID = new long[1]; PointerBuffer properties = setupContextProperties(platform, glContext, glID); ErrorDispatcher dispatcher = createErrorHandler(); @@ -126,7 +120,7 @@ public final class CLGLContext extends CLContext { } // context must be current - glContext.makeCurrent(); +// glContext.makeCurrent(); GLContextImpl ctxImpl = (GLContextImpl)glContext; glID[0] = glContext.getHandle(); @@ -211,13 +205,13 @@ public final class CLGLContext extends CLContext { public final <B extends Buffer> CLGLImage2d<B> createFromGLRenderbuffer(B directBuffer, int glBuffer, 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); memoryObjects.add(buffer); return buffer; } - + //2d Textures public final CLGLTexture2d<?> createFromGLTexture2d(int target, int texture, int mipmap, Mem... flags) { return createFromGLTexture2d(null, target, texture, mipmap, Mem.flagsToInt(flags)); @@ -230,13 +224,13 @@ public final class CLGLContext extends CLContext { public final <B extends Buffer> CLGLTexture2d<B> createFromGLTexture2d(B directBuffer, int target, int texture, int mipmap, 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); memoryObjects.add(buffer); return buffer; } - + //3d Textures public final CLGLTexture3d<?> createFromGLTexture3d(int target, int texture, int mipmap, Mem... flags) { return createFromGLTexture3d(null, target, texture, mipmap, Mem.flagsToInt(flags)); |