aboutsummaryrefslogtreecommitdiffstats
path: root/resources/clImplCustomCode.java
blob: 91b1fb48c194161a2e3699d28c2af70cf0b3861c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53

        public long clCreateContext(LongBuffer properties, long[] devices, CreateContextCallback pfn_notify, Object userData, IntBuffer errcode_ret) {

            if(pfn_notify != null)
                throw new RuntimeException("asynchronous execution with callback is not yet implemented, pass null through this method to block until complete.");

            if(userData != null)
                System.err.println("WARNING: userData not yet implemented... ignoring");

            int listLength = 0;
            if(devices != null)
                listLength = devices.length;

            return this.clCreateContext1(
                    BufferFactory.getArray(properties), BufferFactory.getIndirectBufferByteOffset(properties), listLength, devices, null, null,
                    BufferFactory.getArray(errcode_ret), BufferFactory.getIndirectBufferByteOffset(errcode_ret) );
        }
        private native long clCreateContext1(Object cl_context_properties, int props_offset, int deviceCount, long[] devices, CreateContextCallback pfn_notify, Object userData, Object errcode_ret, int err_offset);

        
        public long clCreateContextFromType(LongBuffer properties, long device_type, CreateContextCallback pfn_notify, Object userData, IntBuffer errcode_ret) {

            if(pfn_notify != null)
                throw new RuntimeException("asynchronous execution with callback is not yet implemented, pass null through this method to block until complete.");

            if(userData != null)
                System.err.println("WARNING: userData not yet implemented... ignoring");

            return this.clCreateContextFromType1(
                    BufferFactory.getArray(properties), BufferFactory.getIndirectBufferByteOffset(properties), device_type, pfn_notify, null,
                    BufferFactory.getArray(errcode_ret), BufferFactory.getIndirectBufferByteOffset(errcode_ret) );
        }
        private native long clCreateContextFromType1(Object properties, int props_offset, long device_type, CreateContextCallback pfn_notify, Object userData, Object errcode_ret, int err_offset);


        /** Interface to C language function: <br> <code> int32_t clBuildProgram(cl_program, uint32_t, cl_device_id * , const char * , void * ); </code>    */
        public int clBuildProgram(long program, long[] deviceList, String options, BuildProgramCallback cb, Object userData)  {

              if(cb != null)
                  throw new RuntimeException("asynchronous execution with callback is not yet implemented, pass null through this method to block until complete.");

              if(userData != null)
                  System.err.println("WARNING: userData not yet implemented... ignoring");

              int listLength = 0;
              if(deviceList != null)
                  listLength = deviceList.length;

              return clBuildProgram1(program, listLength, deviceList, options, cb, userData);
        }
        /** Entry point to C language function: <code> int32_t clBuildProgram(cl_program, uint32_t, cl_device_id * , const char * , void * ); </code>    */
        private native int clBuildProgram1(long program, int devices, Object deviceList, String options, BuildProgramCallback cb, Object userData);