summaryrefslogtreecommitdiffstats
path: root/src/com/jogamp/opencl/demos/julia3d/Julia3d.java
diff options
context:
space:
mode:
authorMichael Bien <[email protected]>2010-05-01 22:52:11 +0200
committerMichael Bien <[email protected]>2010-05-01 22:52:11 +0200
commit37401c35717505b79ab203881b86534bb7098ee8 (patch)
tree338d66ca2d1696cba9d838913150781479af1484 /src/com/jogamp/opencl/demos/julia3d/Julia3d.java
parent2c85c416d85205ab98b33e1a0b0daab32d4d81ff (diff)
MultiDeviceFractal is now... multi device again.
Julia3d + AMD: Fixed segfault on exit. minor misc improvements.
Diffstat (limited to 'src/com/jogamp/opencl/demos/julia3d/Julia3d.java')
-rw-r--r--src/com/jogamp/opencl/demos/julia3d/Julia3d.java21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/com/jogamp/opencl/demos/julia3d/Julia3d.java b/src/com/jogamp/opencl/demos/julia3d/Julia3d.java
index 38633c6..f4bf392 100644
--- a/src/com/jogamp/opencl/demos/julia3d/Julia3d.java
+++ b/src/com/jogamp/opencl/demos/julia3d/Julia3d.java
@@ -43,15 +43,18 @@ public class Julia3d {
this.config = renderConfig;
updateCamera();
- //setup
- CLDevice gpu = CLPlatform.getDefault().getMaxFlopsDevice();
- context = CLContext.create(gpu);
+ //setup, prefere GPUs
+ CLDevice device = CLPlatform.getDefault().getMaxFlopsDevice(CLDevice.Type.GPU);
+ if(device == null) {
+ device = CLPlatform.getDefault().getMaxFlopsDevice();
+ }
+ context = CLContext.create(device);
workGroupSize = 256;
//allocate buffers
configBuffer = context.createBuffer(config.getBuffer(), READ_ONLY);
- commandQueue = gpu.createCommandQueue();
+ commandQueue = device.createCommandQueue();
// update(true);
try {
@@ -63,7 +66,7 @@ public class Julia3d {
julia = program.createCLKernel("JuliaGPU");
multiply = program.createCLKernel("multiply");
- System.out.println(program.getBuildStatus(gpu));
+ System.out.println(program.getBuildStatus(device));
System.out.println(program.getBuildLog());
}
@@ -179,6 +182,10 @@ public class Julia3d {
vmul(camY, .5135f, camY);
}
+ CLDevice getDevice() {
+ return commandQueue.getDevice();
+ }
+
public static void main(String[] args) {
@@ -208,5 +215,9 @@ public class Julia3d {
return pixelBuffer.getBuffer();
}
+ void release() {
+ context.release();
+ }
+
}