summaryrefslogtreecommitdiffstats
path: root/src/com/jogamp/opencl
diff options
context:
space:
mode:
authorMichael Bien <[email protected]>2010-06-27 23:44:56 +0200
committerMichael Bien <[email protected]>2010-06-27 23:44:56 +0200
commit467453f0752f162ce297de0db27d6a4fef67d15f (patch)
tree005e02f82b122dcfa3c54f7ccf5db0992e49422d /src/com/jogamp/opencl
parentbe5f1d62838cd8709a1f4f881c08494246a8471f (diff)
minor refactorings and updates.
Diffstat (limited to 'src/com/jogamp/opencl')
-rw-r--r--src/com/jogamp/opencl/CLContext.java4
-rw-r--r--src/com/jogamp/opencl/CLException.java2
-rw-r--r--src/com/jogamp/opencl/CLKernel.java3
-rw-r--r--src/com/jogamp/opencl/CLPlatform.java10
-rw-r--r--src/com/jogamp/opencl/CLProgram.java10
-rw-r--r--src/com/jogamp/opencl/JOCLJNILibLoader.java11
6 files changed, 11 insertions, 29 deletions
diff --git a/src/com/jogamp/opencl/CLContext.java b/src/com/jogamp/opencl/CLContext.java
index 5deaf4cf..34e23786 100644
--- a/src/com/jogamp/opencl/CLContext.java
+++ b/src/com/jogamp/opencl/CLContext.java
@@ -1,5 +1,6 @@
package com.jogamp.opencl;
+import com.jogamp.common.nio.Buffers;
import com.jogamp.opencl.CLDevice.Type;
import com.jogamp.opencl.CLSampler.AddressingMode;
import com.jogamp.opencl.CLSampler.FilteringMode;
@@ -11,7 +12,6 @@ import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.Buffer;
import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
import java.nio.DoubleBuffer;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
@@ -78,7 +78,7 @@ public class CLContext extends CLObject implements CLResource {
int ret = cl.clGetContextInfo(ID, CL.CL_CONTEXT_DEVICES, 0, null, deviceCount);
checkForError(ret, "can not enumerate devices");
- ByteBuffer deviceIDs = ByteBuffer.allocateDirect((int)deviceCount.get()).order(ByteOrder.nativeOrder());
+ ByteBuffer deviceIDs = Buffers.newDirectByteBuffer((int)deviceCount.get());
ret = cl.clGetContextInfo(ID, CL.CL_CONTEXT_DEVICES, deviceIDs.capacity(), deviceIDs, null);
checkForError(ret, "can not enumerate devices");
diff --git a/src/com/jogamp/opencl/CLException.java b/src/com/jogamp/opencl/CLException.java
index ff178617..e7133994 100644
--- a/src/com/jogamp/opencl/CLException.java
+++ b/src/com/jogamp/opencl/CLException.java
@@ -15,7 +15,7 @@ public class CLException extends RuntimeException {
public final String error;
private final static String ERROR_CODE_DOC =
- "http://www.khronos.org/opencl/sdk/1.0/docs/man/xhtml/errors.html";
+ "http://www.khronos.org/opencl/sdk/1.1/docs/man/xhtml/errors.html";
public CLException(String message) {
super(message);
diff --git a/src/com/jogamp/opencl/CLKernel.java b/src/com/jogamp/opencl/CLKernel.java
index 8fa000dc..785fbc78 100644
--- a/src/com/jogamp/opencl/CLKernel.java
+++ b/src/com/jogamp/opencl/CLKernel.java
@@ -5,7 +5,6 @@ import com.jogamp.common.nio.Buffers;
import com.jogamp.common.nio.PointerBuffer;
import java.nio.Buffer;
import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
import static com.jogamp.opencl.CLException.*;
import static com.jogamp.opencl.CL.*;
@@ -45,7 +44,7 @@ public class CLKernel extends CLObject implements CLResource, Cloneable {
int ret = cl.clGetKernelInfo(ID, CL_KERNEL_FUNCTION_NAME, 0, null, size);
checkForError(ret, "error while asking for kernel function name");
- ByteBuffer bb = ByteBuffer.allocateDirect((int)size.get(0)).order(ByteOrder.nativeOrder());
+ ByteBuffer bb = Buffers.newDirectByteBuffer((int)size.get(0));
ret = cl.clGetKernelInfo(ID, CL_KERNEL_FUNCTION_NAME, bb.capacity(), bb, null);
checkForError(ret, "error while asking for kernel function name");
diff --git a/src/com/jogamp/opencl/CLPlatform.java b/src/com/jogamp/opencl/CLPlatform.java
index 84d6497f..c12fbd47 100644
--- a/src/com/jogamp/opencl/CLPlatform.java
+++ b/src/com/jogamp/opencl/CLPlatform.java
@@ -1,5 +1,6 @@
package com.jogamp.opencl;
+import com.jogamp.common.nio.Buffers;
import com.jogamp.common.os.DynamicLookupHelper;
import java.security.PrivilegedAction;
import com.jogamp.common.JogampRuntimeException;
@@ -11,7 +12,6 @@ import com.jogamp.opencl.impl.CLImpl;
import com.jogamp.opencl.impl.CLProcAddressTable;
import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
import java.nio.IntBuffer;
import java.util.ArrayList;
import java.util.Collections;
@@ -73,8 +73,8 @@ public final class CLPlatform {
cl = new CLImpl(table);
//load JOCL and init table
- doPrivileged(new PrivilegedAction<CLProcAddressTable>() {
- public CLProcAddressTable run() {
+ doPrivileged(new PrivilegedAction<Object>() {
+ public Object run() {
NativeLibrary lib = JOCLJNILibLoader.loadJOCL();
@@ -114,7 +114,7 @@ public final class CLPlatform {
*/
public static CLPlatform[] listCLPlatforms() {
- IntBuffer ib = ByteBuffer.allocateDirect(4).order(ByteOrder.nativeOrder()).asIntBuffer();
+ IntBuffer ib = Buffers.newDirectIntBuffer(1);
// find all available OpenCL platforms
int ret = cl.clGetPlatformIDs(0, null, ib);
checkForError(ret, "can not enumerate platforms");
@@ -161,7 +161,7 @@ public final class CLPlatform {
*/
public CLDevice[] listCLDevices(CLDevice.Type... types) {
- IntBuffer ib = ByteBuffer.allocateDirect(4).order(ByteOrder.nativeOrder()).asIntBuffer();
+ IntBuffer ib = Buffers.newDirectIntBuffer(1);
List<CLDevice> list = new ArrayList<CLDevice>();
for(int t = 0; t < types.length; t++) {
diff --git a/src/com/jogamp/opencl/CLProgram.java b/src/com/jogamp/opencl/CLProgram.java
index c56c04c9..7991b9d6 100644
--- a/src/com/jogamp/opencl/CLProgram.java
+++ b/src/com/jogamp/opencl/CLProgram.java
@@ -155,16 +155,6 @@ public class CLProgram extends CLObject implements CLResource {
return CLUtil.clString2JavaString(buffer, (int)size.get(0));
}
-// private int getProgramInfoInt(int flag) {
-//
-// ByteBuffer bb = ByteBuffer.allocateDirect(4).order(ByteOrder.nativeOrder());
-//
-// int ret = cl.clGetProgramInfo(programID, flag, bb.capacity(), bb, null, 0);
-// checkForError(ret, "");
-//
-// return bb.getInt();
-// }
-
private int getBuildInfoInt(CLDevice device, int flag) {
ByteBuffer buffer = newDirectByteBuffer(4);
diff --git a/src/com/jogamp/opencl/JOCLJNILibLoader.java b/src/com/jogamp/opencl/JOCLJNILibLoader.java
index c8a05210..61436aa5 100644
--- a/src/com/jogamp/opencl/JOCLJNILibLoader.java
+++ b/src/com/jogamp/opencl/JOCLJNILibLoader.java
@@ -1,10 +1,8 @@
package com.jogamp.opencl;
-import java.security.PrivilegedAction;
import com.jogamp.common.jvm.JNILibLoaderBase;
import com.jogamp.common.os.NativeLibrary;
-import static java.security.AccessController.*;
/**
* Responsible for JOCL lib loading.
@@ -16,12 +14,7 @@ class JOCLJNILibLoader extends JNILibLoaderBase {
* Loads the native binding and returns the OpenCL library for dynamic linking.
*/
static NativeLibrary loadJOCL() {
-
- return doPrivileged(new PrivilegedAction<NativeLibrary>() {
- public NativeLibrary run() {
- loadLibrary("jocl", null, true);
- return NativeLibrary.open("OpenCL", JOCLJNILibLoader.class.getClassLoader());
- }
- });
+ loadLibrary("jocl", null, true);
+ return NativeLibrary.open("OpenCL", JOCLJNILibLoader.class.getClassLoader());
}
}