diff options
author | Michael Bien <[email protected]> | 2010-04-24 05:01:43 +0200 |
---|---|---|
committer | Michael Bien <[email protected]> | 2010-04-24 05:01:43 +0200 |
commit | 7543640d906f7ae2339faa40d0fc019c7a787593 (patch) | |
tree | 584d9f0624f35bfa07c067d90c962210e348995b /src/com/jogamp/opencl/CLContext.java | |
parent | bec58034b631656d3ec436ea350fa1652a8f9195 (diff) |
CLGLContext.create() makes GLContext current.
made CLContext.release() more bulletproof.
added CLGLTest.
Diffstat (limited to 'src/com/jogamp/opencl/CLContext.java')
-rw-r--r-- | src/com/jogamp/opencl/CLContext.java | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/src/com/jogamp/opencl/CLContext.java b/src/com/jogamp/opencl/CLContext.java index 01159a01..4e172630 100644 --- a/src/com/jogamp/opencl/CLContext.java +++ b/src/com/jogamp/opencl/CLContext.java @@ -358,27 +358,31 @@ public class CLContext extends CLObject implements CLResource { */ public void release() { - //release all resources - while(!programs.isEmpty()) - programs.get(0).release(); - - while(!memoryObjects.isEmpty()) - memoryObjects.get(0).release(); - - while(!samplers.isEmpty()) - samplers.get(0).release(); - - for (CLDevice device : devices) { - List<CLCommandQueue> list = queuesMap.get(device); - if(list != null) { - while(!list.isEmpty()) { - list.get(0).release(); + try{ + //release all resources + while(!programs.isEmpty()) + programs.get(0).release(); + + while(!memoryObjects.isEmpty()) + memoryObjects.get(0).release(); + + while(!samplers.isEmpty()) + samplers.get(0).release(); + + for (CLDevice device : getDevices()) { + List<CLCommandQueue> list = queuesMap.get(device); + if(list != null) { + while(!list.isEmpty()) { + list.get(0).release(); + } } } + + }finally{ + int ret = cl.clReleaseContext(ID); + checkForError(ret, "error releasing context"); } - int ret = cl.clReleaseContext(ID); - checkForError(ret, "error releasing context"); } public void close() { |