aboutsummaryrefslogtreecommitdiffstats
path: root/src/com/mbien/opencl/CLContext.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/mbien/opencl/CLContext.java')
-rw-r--r--src/com/mbien/opencl/CLContext.java12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/com/mbien/opencl/CLContext.java b/src/com/mbien/opencl/CLContext.java
index e75aaddd..99322035 100644
--- a/src/com/mbien/opencl/CLContext.java
+++ b/src/com/mbien/opencl/CLContext.java
@@ -113,7 +113,7 @@ public class CLContext implements CLResource {
* Creates a context on the specified platform and with the specified
* device types.
*/
- private static final CLContext create(CLPlatform platform, CLDevice.Type... deviceTypes) {
+ public static final CLContext create(CLPlatform platform, CLDevice.Type... deviceTypes) {
long type = toDeviceBitmap(deviceTypes);
@@ -125,10 +125,16 @@ public class CLContext implements CLResource {
* Creates a context on the specified platform and with the specified
* devices.
*/
- private static final CLContext create(CLPlatform platform, CLDevice[] devices) {
+ public static final CLContext create(CLPlatform platform, CLDevice... devices) {
PointerBuffer properties = setupContextProperties(platform);
- return new CLContext(createContext(properties, devices));
+ CLContext context = new CLContext(createContext(properties, devices));
+ if(devices != null) {
+ for (int i = 0; i < devices.length; i++) {
+ devices[i].setContext(context);
+ }
+ }
+ return context;
}
protected static final long createContextFromType(PointerBuffer properties, long deviceType) {