summaryrefslogtreecommitdiffstats
path: root/resources
diff options
context:
space:
mode:
authorMichael Bien <[email protected]>2009-10-01 01:19:17 +0200
committerMichael Bien <[email protected]>2009-10-01 01:19:17 +0200
commitbe4e9559f16e3ac5a5d109b26fbb9d579345f25c (patch)
tree2e1dddf49650c1d7eade1aea936c0c76b735e5d1 /resources
parenta550876d23b84427667111c5e2700766752b6040 (diff)
added utility methods and getters to CLPlatform, CLDevice and CLContext.
adapted unit test.
Diffstat (limited to 'resources')
-rw-r--r--resources/cl-if.cfg4
-rw-r--r--resources/clImplCustomCode.c28
-rw-r--r--resources/clImplCustomCode.java8
3 files changed, 33 insertions, 7 deletions
diff --git a/resources/cl-if.cfg b/resources/cl-if.cfg
index 6d23789d..08e21dcc 100644
--- a/resources/cl-if.cfg
+++ b/resources/cl-if.cfg
@@ -17,11 +17,11 @@ Ignore CL_GL_.*|cl.*GL.*
#custom implementations
Ignore clCreateContext
CustomJavaCode CL /** Interface to C language function: <br> <code> cl_context clCreateContext(intptr_t * , uint32_t, cl_device_id * , void (*pfn_notify)(const char *, const void *, size_t, void *), void *, int32_t * ); </code> */
-CustomJavaCode CL public long clCreateContext(IntBuffer properties, int arg1, long[] devices, CreateContextCallback pfn_notify, Object userData, IntBuffer errcode_ret);
+CustomJavaCode CL public long clCreateContext(IntBuffer properties, int properties_offset, long[] devices, CreateContextCallback pfn_notify, Object userData, IntBuffer errcode_ret, int errcode_offset);
Ignore clCreateContextFromType
CustomJavaCode CL /** Interface to C language function: <br> <code> cl_context clCreateContextFromType(cl_context_properties *properties, cl_device_type device_type, void (*pfn_notify)(const char *errinfo, const void *private_info, size_t cb, void *user_data), void *user_data, cl_int *errcode_ret) ; </code> */
-CustomJavaCode CL public long clCreateContextFromType(IntBuffer properties, long device_type, CreateContextCallback pfn_notify, Object userData, IntBuffer errcode_ret);
+CustomJavaCode CL public long clCreateContextFromType(IntBuffer properties, int properties_offset, long device_type, CreateContextCallback pfn_notify, Object userData, IntBuffer errcode_ret, int errcode_offset);
Ignore clBuildProgram
#TODO..
diff --git a/resources/clImplCustomCode.c b/resources/clImplCustomCode.c
index a9847833..83d25938 100644
--- a/resources/clImplCustomCode.c
+++ b/resources/clImplCustomCode.c
@@ -23,6 +23,12 @@ Java_com_mbien_opencl_impl_CLImpl_clCreateContextFromType0(JNIEnv *env, jobject
intptr_t * _props_ptr = NULL;
int32_t * _errcode_ptr = NULL;
+/*
+ printf("jlong: %zu \n", sizeof(jlong) );
+ printf("intptr_t: %zu \n", sizeof(intptr_t));
+ printf("size_t: %zu \n", sizeof(size_t));
+*/
+
cl_context _res;
if (props != NULL) {
@@ -38,14 +44,34 @@ Java_com_mbien_opencl_impl_CLImpl_clCreateContextFromType0(JNIEnv *env, jobject
return (jlong) (intptr_t) _res;
}
-//clCreateContext0(IntBuffer properties, int size, long[] devices, CreateContextCallback pfn_notify, Object userData, IntBuffer errcode_ret, int size2)
+
/*
JNIEXPORT jlong JNICALL
Java_com_mbien_opencl_impl_CLImpl_clCreateContext0(JNIEnv *env, jobject _unused,
jobject props, jint props_byte_offset, jlong device_type, jobject cb, jobject data, jobject errcode, jint errcode_byte_offset) {
+ intptr_t * _props_ptr = NULL;
+ int32_t * _errcode_ptr = NULL;
+ void * _device_ptr = NULL;
+ cl_context _res;
+ if (props != NULL) {
+ _props_ptr = (intptr_t *) (((char*) (*env)->GetDirectBufferAddress(env, props)) + props_byte_offset);
+ }
+
+ if (device_type != NULL) {
+ _device_ptr = (void *) (((char*) (*env)->GetPrimitiveArrayCritical(env, device_type, NULL)));
+ }
+
+ _res = clCreateContext();
+
+ if (device_type != NULL) {
+ (*env)->ReleasePrimitiveArrayCritical(env, device_type, _device_ptr, 0);
+ }
+ return (jlong) (intptr_t) _res;
}
*/
+
+
diff --git a/resources/clImplCustomCode.java b/resources/clImplCustomCode.java
index 2fa48d64..5ccc3b02 100644
--- a/resources/clImplCustomCode.java
+++ b/resources/clImplCustomCode.java
@@ -1,13 +1,13 @@
- public long clCreateContext(IntBuffer properties, int arg1, long[] devices, CreateContextCallback cb, Object userData, IntBuffer errcode_ret) {
- return this.clCreateContext0(properties, arg1, devices, cb, null, errcode_ret, 0);
+ public long clCreateContext(IntBuffer properties, int offset1, long[] devices, CreateContextCallback cb, Object userData, IntBuffer errcode_ret, int offset2) {
+ return this.clCreateContext0(properties, offset1, devices, cb, null, errcode_ret, offset2);
}
private native long clCreateContext0(IntBuffer properties, int size, long[] devices, CreateContextCallback pfn_notify, Object userData, IntBuffer errcode_ret, int size2);
- public long clCreateContextFromType(IntBuffer arg0, long device_type, CreateContextCallback pfn_notify, Object userData, IntBuffer errcode_ret) {
- return this.clCreateContextFromType0(arg0, 0, device_type, pfn_notify, null, errcode_ret, 0);
+ public long clCreateContextFromType(IntBuffer arg0, int offset1, long device_type, CreateContextCallback pfn_notify, Object userData, IntBuffer errcode_ret, int offset2) {
+ return this.clCreateContextFromType0(arg0, offset1, device_type, pfn_notify, null, errcode_ret, offset2);
}
private native long clCreateContextFromType0(IntBuffer arg0, int size, long device_type, CreateContextCallback pfn_notify, Object userData, IntBuffer errcode_ret, int size2);