… | |
… | |
3 | #include "XSUB.h" |
3 | #include "XSUB.h" |
4 | |
4 | |
5 | #ifdef I_DLFCN |
5 | #ifdef I_DLFCN |
6 | #include <dlfcn.h> |
6 | #include <dlfcn.h> |
7 | #endif |
7 | #endif |
|
|
8 | |
|
|
9 | // how stupid is that, the 1.2 header files define CL_VERSION_1_1, |
|
|
10 | // but then fail to define the api functions unless you ALSO define |
|
|
11 | // this. This breaks 100% of the opencl 1.1 apps, for what reason? |
|
|
12 | // after all, the functions are deprecated, not removed. |
|
|
13 | // in addition, you cannot test for this in any future-proof way. |
|
|
14 | // each time a new opencl version comes out, you need to make a new |
|
|
15 | // release. |
|
|
16 | #define CL_USE_DEPRECATED_OPENCL_1_1_APIS |
|
|
17 | #define CL_USE_DEPRECATED_OPENCL_1_2_APIS /* just guessing, you stupid idiots */ |
8 | |
18 | |
9 | #ifdef __APPLE__ |
19 | #ifdef __APPLE__ |
10 | #include <OpenCL/opencl.h> |
20 | #include <OpenCL/opencl.h> |
11 | #else |
21 | #else |
12 | #include <CL/opencl.h> |
22 | #include <CL/opencl.h> |
|
|
23 | #endif |
|
|
24 | |
|
|
25 | #if 0 // testing |
|
|
26 | #undef CL_USE_DEPRECATED_OPENCL_1_1_APIS |
|
|
27 | #undef CL_VERSION_1_2 |
13 | #endif |
28 | #endif |
14 | |
29 | |
15 | typedef cl_platform_id OpenCL__Platform; |
30 | typedef cl_platform_id OpenCL__Platform; |
16 | typedef cl_device_id OpenCL__Device; |
31 | typedef cl_device_id OpenCL__Device; |
17 | typedef cl_context OpenCL__Context; |
32 | typedef cl_context OpenCL__Context; |
… | |
… | |
89 | enum { buffers = 3 }; |
104 | enum { buffers = 3 }; |
90 | static int idx; |
105 | static int idx; |
91 | static void *buf [buffers]; |
106 | static void *buf [buffers]; |
92 | static size_t len [buffers]; |
107 | static size_t len [buffers]; |
93 | |
108 | |
94 | idx = ++idx % buffers; |
109 | idx = (idx + 1) % buffers; |
95 | |
110 | |
96 | if (len [idx] < size) |
111 | if (len [idx] < size) |
97 | { |
112 | { |
98 | free (buf [idx]); |
113 | free (buf [idx]); |
99 | len [idx] = ((size + 31) & ~4095) + 4096 - 32; |
114 | len [idx] = ((size + 31) & ~4095) + 4096 - 32; |
… | |
… | |
257 | clGetImageInfo (img, CL_IMAGE_ROW_PITCH, sizeof (res), &res, 0); |
272 | clGetImageInfo (img, CL_IMAGE_ROW_PITCH, sizeof (res), &res, 0); |
258 | return res; |
273 | return res; |
259 | } |
274 | } |
260 | |
275 | |
261 | static cl_event * |
276 | static cl_event * |
262 | event_list (SV **items, int count) |
277 | event_list (SV **items, cl_uint *rcount) |
263 | { |
278 | { |
|
|
279 | cl_uint count = *rcount; |
|
|
280 | |
264 | if (!count) |
281 | if (!count) |
265 | return 0; |
282 | return 0; |
266 | |
283 | |
267 | cl_event *list = tmpbuf (sizeof (cl_event) * count); |
284 | cl_event *list = tmpbuf (sizeof (cl_event) * count); |
|
|
285 | int i = 0; |
268 | |
286 | |
269 | while (count--) |
287 | do |
|
|
288 | { |
|
|
289 | --count; |
|
|
290 | if (SvOK (items [count])) |
270 | list [count] = SvPTROBJ ("clEnqueue", "wait_events", items [count], "OpenCL::Event"); |
291 | list [i++] = SvPTROBJ ("clEnqueue", "wait_events", items [count], "OpenCL::Event"); |
|
|
292 | } |
|
|
293 | while (count); |
271 | |
294 | |
|
|
295 | *rcount = i; |
|
|
296 | |
272 | return list; |
297 | return i ? list : 0; |
273 | } |
298 | } |
274 | |
299 | |
275 | #define EVENT_LIST(items,count) \ |
300 | #define EVENT_LIST(items,count) \ |
276 | cl_uint event_list_count = (count); \ |
301 | cl_uint event_list_count = (count); \ |
277 | cl_event *event_list_ptr = event_list (&ST (items), event_list_count) |
302 | cl_event *event_list_ptr = event_list (&ST (items), &event_list_count) |
278 | |
303 | |
279 | #define INFO(class) \ |
304 | #define INFO(class) \ |
280 | { \ |
305 | { \ |
281 | size_t size; \ |
306 | size_t size; \ |
282 | NEED_SUCCESS (Get ## class ## Info, (self, name, 0, 0, &size)); \ |
307 | NEED_SUCCESS (Get ## class ## Info, (self, name, 0, 0, &size)); \ |
… | |
… | |
314 | } |
339 | } |
315 | |
340 | |
316 | cl_int |
341 | cl_int |
317 | errno () |
342 | errno () |
318 | CODE: |
343 | CODE: |
319 | errno = res; |
344 | RETVAL = res; |
|
|
345 | OUTPUT: |
|
|
346 | RETVAL |
320 | |
347 | |
321 | const char * |
348 | const char * |
322 | err2str (cl_int err) |
349 | err2str (cl_int err) |
323 | |
350 | |
324 | const char * |
351 | const char * |
… | |
… | |
343 | context_from_type (cl_context_properties *properties = 0, cl_device_type type = CL_DEVICE_TYPE_DEFAULT, FUTURE notify = 0) |
370 | context_from_type (cl_context_properties *properties = 0, cl_device_type type = CL_DEVICE_TYPE_DEFAULT, FUTURE notify = 0) |
344 | PPCODE: |
371 | PPCODE: |
345 | NEED_SUCCESS_ARG (cl_context ctx, CreateContextFromType, (properties, type, 0, 0, &res)); |
372 | NEED_SUCCESS_ARG (cl_context ctx, CreateContextFromType, (properties, type, 0, 0, &res)); |
346 | XPUSH_NEW_OBJ ("OpenCL::Context", ctx); |
373 | XPUSH_NEW_OBJ ("OpenCL::Context", ctx); |
347 | |
374 | |
|
|
375 | #if 0 |
|
|
376 | |
348 | void |
377 | void |
349 | context (cl_context_properties *properties = 0, FUTURE devices, FUTURE notify = 0) |
378 | context (cl_context_properties *properties = 0, FUTURE devices, FUTURE notify = 0) |
350 | PPCODE: |
379 | PPCODE: |
351 | /* der Gipfel der Kunst */ |
380 | /* der Gipfel der Kunst */ |
|
|
381 | |
|
|
382 | #endif |
352 | |
383 | |
353 | void |
384 | void |
354 | wait_for_events (...) |
385 | wait_for_events (...) |
355 | CODE: |
386 | CODE: |
356 | EVENT_LIST (0, items); |
387 | EVENT_LIST (0, items); |
… | |
… | |
698 | if (!(flags & (CL_MEM_USE_HOST_PTR | CL_MEM_COPY_HOST_PTR))) |
729 | if (!(flags & (CL_MEM_USE_HOST_PTR | CL_MEM_COPY_HOST_PTR))) |
699 | croak ("OpenCL::Context::buffer_sv: you have to specify use or copy host ptr when buffer data is given, use $context->buffer instead?"); |
730 | croak ("OpenCL::Context::buffer_sv: you have to specify use or copy host ptr when buffer data is given, use $context->buffer instead?"); |
700 | NEED_SUCCESS_ARG (cl_mem mem, CreateBuffer, (self, flags, len, ptr, &res)); |
731 | NEED_SUCCESS_ARG (cl_mem mem, CreateBuffer, (self, flags, len, ptr, &res)); |
701 | XPUSH_NEW_OBJ ("OpenCL::BufferObj", mem); |
732 | XPUSH_NEW_OBJ ("OpenCL::BufferObj", mem); |
702 | |
733 | |
|
|
734 | #if !CL_VERSION_1_2 || defined CL_USE_DEPRECATED_OPENCL_1_1_APIS |
|
|
735 | |
703 | void |
736 | void |
704 | image2d (OpenCL::Context self, cl_mem_flags flags, cl_channel_order channel_order, cl_channel_type channel_type, size_t width, size_t height, size_t row_pitch = 0, SV *data = &PL_sv_undef) |
737 | image2d (OpenCL::Context self, cl_mem_flags flags, cl_channel_order channel_order, cl_channel_type channel_type, size_t width, size_t height, size_t row_pitch = 0, SV *data = &PL_sv_undef) |
705 | PPCODE: |
738 | PPCODE: |
706 | STRLEN len; |
739 | STRLEN len; |
707 | char *ptr = SvOK (data) ? SvPVbyte (data, len) : 0; |
740 | char *ptr = SvOK (data) ? SvPVbyte (data, len) : 0; |
… | |
… | |
716 | char *ptr = SvOK (data) ? SvPVbyte (data, len) : 0; |
749 | char *ptr = SvOK (data) ? SvPVbyte (data, len) : 0; |
717 | const cl_image_format format = { channel_order, channel_type }; |
750 | const cl_image_format format = { channel_order, channel_type }; |
718 | NEED_SUCCESS_ARG (cl_mem mem, CreateImage3D, (self, flags, &format, width, height, depth, row_pitch, slice_pitch, ptr, &res)); |
751 | NEED_SUCCESS_ARG (cl_mem mem, CreateImage3D, (self, flags, &format, width, height, depth, row_pitch, slice_pitch, ptr, &res)); |
719 | XPUSH_NEW_OBJ ("OpenCL::Image3D", mem); |
752 | XPUSH_NEW_OBJ ("OpenCL::Image3D", mem); |
720 | |
753 | |
|
|
754 | #endif |
|
|
755 | |
721 | #if cl_apple_gl_sharing || cl_khr_gl_sharing |
756 | #if cl_apple_gl_sharing || cl_khr_gl_sharing |
722 | |
757 | |
723 | void |
758 | void |
724 | gl_buffer (OpenCL::Context self, cl_mem_flags flags, cl_GLuint bufobj) |
759 | gl_buffer (OpenCL::Context self, cl_mem_flags flags, cl_GLuint bufobj) |
725 | PPCODE: |
760 | PPCODE: |
726 | NEED_SUCCESS_ARG (cl_mem mem, CreateFromGLBuffer, (self, flags, bufobj, &res)); |
761 | NEED_SUCCESS_ARG (cl_mem mem, CreateFromGLBuffer, (self, flags, bufobj, &res)); |
727 | XPUSH_NEW_OBJ ("OpenCL::BufferObj", mem); |
762 | XPUSH_NEW_OBJ ("OpenCL::BufferObj", mem); |
728 | |
763 | |
|
|
764 | #if !CL_VERSION_1_2 || defined CL_USE_DEPRECATED_OPENCL_1_1_APIS |
|
|
765 | |
729 | void |
766 | void |
730 | gl_texture2d (OpenCL::Context self, cl_mem_flags flags, cl_GLenum target, cl_GLint miplevel, cl_GLuint texture) |
767 | gl_texture2d (OpenCL::Context self, cl_mem_flags flags, cl_GLenum target, cl_GLint miplevel, cl_GLuint texture) |
731 | PPCODE: |
768 | PPCODE: |
732 | NEED_SUCCESS_ARG (cl_mem mem, CreateFromGLTexture2D, (self, flags, target, miplevel, texture, &res)); |
769 | NEED_SUCCESS_ARG (cl_mem mem, CreateFromGLTexture2D, (self, flags, target, miplevel, texture, &res)); |
733 | XPUSH_NEW_OBJ ("OpenCL::Image2D", mem); |
770 | XPUSH_NEW_OBJ ("OpenCL::Image2D", mem); |
… | |
… | |
735 | void |
772 | void |
736 | gl_texture3d (OpenCL::Context self, cl_mem_flags flags, cl_GLenum target, cl_GLint miplevel, cl_GLuint texture) |
773 | gl_texture3d (OpenCL::Context self, cl_mem_flags flags, cl_GLenum target, cl_GLint miplevel, cl_GLuint texture) |
737 | PPCODE: |
774 | PPCODE: |
738 | NEED_SUCCESS_ARG (cl_mem mem, CreateFromGLTexture3D, (self, flags, target, miplevel, texture, &res)); |
775 | NEED_SUCCESS_ARG (cl_mem mem, CreateFromGLTexture3D, (self, flags, target, miplevel, texture, &res)); |
739 | XPUSH_NEW_OBJ ("OpenCL::Image3D", mem); |
776 | XPUSH_NEW_OBJ ("OpenCL::Image3D", mem); |
|
|
777 | |
|
|
778 | #endif |
740 | |
779 | |
741 | void |
780 | void |
742 | gl_renderbuffer (OpenCL::Context self, cl_mem_flags flags, cl_GLuint renderbuffer) |
781 | gl_renderbuffer (OpenCL::Context self, cl_mem_flags flags, cl_GLuint renderbuffer) |
743 | PPCODE: |
782 | PPCODE: |
744 | NEED_SUCCESS_ARG (cl_mem mem, CreateFromGLRenderbuffer, (self, flags, renderbuffer, &res)); |
783 | NEED_SUCCESS_ARG (cl_mem mem, CreateFromGLRenderbuffer, (self, flags, renderbuffer, &res)); |
… | |
… | |
855 | cl_event ev = 0; |
894 | cl_event ev = 0; |
856 | STRLEN len; |
895 | STRLEN len; |
857 | char *ptr = SvPVbyte (data, len); |
896 | char *ptr = SvPVbyte (data, len); |
858 | EVENT_LIST (5, items - 5); |
897 | EVENT_LIST (5, items - 5); |
859 | |
898 | |
860 | NEED_SUCCESS (EnqueueReadBuffer, (self, mem, blocking, offset, len, ptr, event_list_count, event_list_ptr, GIMME_V != G_VOID ? &ev : 0)); |
899 | NEED_SUCCESS (EnqueueWriteBuffer, (self, mem, blocking, offset, len, ptr, event_list_count, event_list_ptr, GIMME_V != G_VOID ? &ev : 0)); |
861 | |
900 | |
862 | if (ev) |
901 | if (ev) |
863 | XPUSH_NEW_OBJ ("OpenCL::Event", ev); |
902 | XPUSH_NEW_OBJ ("OpenCL::Event", ev); |
864 | |
903 | |
865 | void |
904 | void |
… | |
… | |
931 | size_t min_len = host_row_pitch * host_slice_pitch * region [2]; |
970 | size_t min_len = host_row_pitch * host_slice_pitch * region [2]; |
932 | |
971 | |
933 | if (len < min_len) |
972 | if (len < min_len) |
934 | croak ("clEnqueueWriteImage: data string is shorter than what would be transferred"); |
973 | croak ("clEnqueueWriteImage: data string is shorter than what would be transferred"); |
935 | |
974 | |
936 | NEED_SUCCESS (EnqueueWriteBufferRect, (self, buf, blocking, buf_origin, host_origin, region, buf_row_pitch, buf_slice_pitch, host_row_pitch, host_slice_pitch, SvPVX (data), event_list_count, event_list_ptr, GIMME_V != G_VOID ? &ev : 0)); |
975 | NEED_SUCCESS (EnqueueWriteBufferRect, (self, buf, blocking, buf_origin, host_origin, region, buf_row_pitch, buf_slice_pitch, host_row_pitch, host_slice_pitch, ptr, event_list_count, event_list_ptr, GIMME_V != G_VOID ? &ev : 0)); |
937 | |
976 | |
938 | if (ev) |
977 | if (ev) |
939 | XPUSH_NEW_OBJ ("OpenCL::Event", ev); |
978 | XPUSH_NEW_OBJ ("OpenCL::Event", ev); |
940 | |
979 | |
941 | void |
980 | void |
… | |
… | |
996 | size_t min_len = slice_pitch ? slice_pitch * depth : row_pitch * height; |
1035 | size_t min_len = slice_pitch ? slice_pitch * depth : row_pitch * height; |
997 | |
1036 | |
998 | if (len < min_len) |
1037 | if (len < min_len) |
999 | croak ("clEnqueueWriteImage: data string is shorter than what would be transferred"); |
1038 | croak ("clEnqueueWriteImage: data string is shorter than what would be transferred"); |
1000 | |
1039 | |
1001 | NEED_SUCCESS (EnqueueWriteImage, (self, dst, blocking, dst_origin, region, row_pitch, slice_pitch, SvPVX (data), event_list_count, event_list_ptr, GIMME_V != G_VOID ? &ev : 0)); |
1040 | NEED_SUCCESS (EnqueueWriteImage, (self, dst, blocking, dst_origin, region, row_pitch, slice_pitch, ptr, event_list_count, event_list_ptr, GIMME_V != G_VOID ? &ev : 0)); |
1002 | |
1041 | |
1003 | if (ev) |
1042 | if (ev) |
1004 | XPUSH_NEW_OBJ ("OpenCL::Event", ev); |
1043 | XPUSH_NEW_OBJ ("OpenCL::Event", ev); |
1005 | |
1044 | |
1006 | void |
1045 | void |
… | |
… | |
1088 | gwo [i] = SvIV (AvARRAY (SvRV (global_work_offset))[i]); |
1127 | gwo [i] = SvIV (AvARRAY (SvRV (global_work_offset))[i]); |
1089 | } |
1128 | } |
1090 | |
1129 | |
1091 | if (SvOK (local_work_size)) |
1130 | if (SvOK (local_work_size)) |
1092 | { |
1131 | { |
1093 | if (SvOK (local_work_size) && !SvROK (local_work_size) || SvTYPE (SvRV (local_work_size)) != SVt_PVAV) |
1132 | if ((SvOK (local_work_size) && !SvROK (local_work_size)) || SvTYPE (SvRV (local_work_size)) != SVt_PVAV) |
1094 | croak ("clEnqueueNDRangeKernel: global_work_size must be undef or an array reference"); |
1133 | croak ("clEnqueueNDRangeKernel: global_work_size must be undef or an array reference"); |
1095 | |
1134 | |
1096 | if (AvFILLp (SvRV (local_work_size)) + 1 != gws_len) |
1135 | if (AvFILLp (SvRV (local_work_size)) + 1 != gws_len) |
1097 | croak ("clEnqueueNDRangeKernel: local_work_local must be undef or an array of same size as global_work_size"); |
1136 | croak ("clEnqueueNDRangeKernel: local_work_local must be undef or an array of same size as global_work_size"); |
1098 | |
1137 | |
… | |
… | |
1110 | |
1149 | |
1111 | void |
1150 | void |
1112 | enqueue_acquire_gl_objects (OpenCL::Queue self, SV *objects, ...) |
1151 | enqueue_acquire_gl_objects (OpenCL::Queue self, SV *objects, ...) |
1113 | ALIAS: |
1152 | ALIAS: |
1114 | enqueue_release_gl_objects = 1 |
1153 | enqueue_release_gl_objects = 1 |
1115 | CODE: |
1154 | PPCODE: |
1116 | if (!SvROK (objects) || SvTYPE (SvRV (objects)) != SVt_PVAV) |
1155 | if (!SvROK (objects) || SvTYPE (SvRV (objects)) != SVt_PVAV) |
1117 | croak ("OpenCL::Queue::enqueue_acquire/release_gl_objects argument 'objects' must be an arrayref with memory objects, in call"); |
1156 | croak ("OpenCL::Queue::enqueue_acquire/release_gl_objects argument 'objects' must be an arrayref with memory objects, in call"); |
1118 | |
1157 | |
1119 | cl_event ev = 0; |
1158 | cl_event ev = 0; |
1120 | EVENT_LIST (2, items - 2); |
1159 | EVENT_LIST (2, items - 2); |
… | |
… | |
1134 | if (ev) |
1173 | if (ev) |
1135 | XPUSH_NEW_OBJ ("OpenCL::Event", ev); |
1174 | XPUSH_NEW_OBJ ("OpenCL::Event", ev); |
1136 | |
1175 | |
1137 | #endif |
1176 | #endif |
1138 | |
1177 | |
1139 | void |
1178 | #if !CL_VERSION_1_2 || defined CL_USE_DEPRECATED_OPENCL_1_1_APIS |
1140 | enqueue_marker (OpenCL::Queue self) |
|
|
1141 | PPCODE: |
|
|
1142 | cl_event ev; |
|
|
1143 | NEED_SUCCESS (EnqueueMarker, (self, &ev)); |
|
|
1144 | XPUSH_NEW_OBJ ("OpenCL::Event", ev); |
|
|
1145 | |
1179 | |
1146 | void |
1180 | void |
1147 | enqueue_wait_for_events (OpenCL::Queue self, ...) |
1181 | enqueue_wait_for_events (OpenCL::Queue self, ...) |
1148 | CODE: |
1182 | CODE: |
1149 | EVENT_LIST (1, items - 1); |
1183 | EVENT_LIST (1, items - 1); |
1150 | NEED_SUCCESS (EnqueueWaitForEvents, (self, event_list_count, event_list_ptr)); |
1184 | NEED_SUCCESS (EnqueueWaitForEvents, (self, event_list_count, event_list_ptr)); |
1151 | |
1185 | |
|
|
1186 | #endif |
|
|
1187 | |
1152 | void |
1188 | void |
|
|
1189 | enqueue_marker (OpenCL::Queue self, ...) |
|
|
1190 | PPCODE: |
|
|
1191 | cl_event ev = 0; |
|
|
1192 | EVENT_LIST (1, items - 1); |
|
|
1193 | #if CL_VERSION_1_2 |
|
|
1194 | NEED_SUCCESS (EnqueueMarkerWithWaitList, (self, event_list_count, event_list_ptr, GIMME_V != G_VOID ? &ev : 0)); |
|
|
1195 | #else |
|
|
1196 | if (event_list_count) |
|
|
1197 | croak ("OpenCL::Queue->enqueue_marker does not support a wait list in OpenCL 1.1 - upgrade to 1.2"); |
|
|
1198 | NEED_SUCCESS (EnqueueMarker, (self, GIMME_V != G_VOID ? &ev : 0)); |
|
|
1199 | #endif |
|
|
1200 | if (ev) |
|
|
1201 | XPUSH_NEW_OBJ ("OpenCL::Event", ev); |
|
|
1202 | |
|
|
1203 | void |
1153 | enqueue_barrier (OpenCL::Queue self) |
1204 | enqueue_barrier (OpenCL::Queue self, ...) |
1154 | CODE: |
1205 | PPCODE: |
|
|
1206 | cl_event ev = 0; |
|
|
1207 | EVENT_LIST (1, items - 1); |
|
|
1208 | #if CL_VERSION_1_2 |
|
|
1209 | NEED_SUCCESS (EnqueueBarrierWithWaitList, (self, event_list_count, event_list_ptr, &ev)); |
|
|
1210 | #else |
|
|
1211 | if (event_list_count) |
|
|
1212 | croak ("OpenCL::Queue->enqueue_barrier does not support a wait list in OpenCL 1.1 - upgrade to 1.2"); |
|
|
1213 | if (GIMME_V != G_VOID) |
|
|
1214 | croak ("OpenCL::Queue->enqueue_barrier does not return an event object in OpenCL 1.1 - upgrade to 1.2"); |
1155 | NEED_SUCCESS (EnqueueBarrier, (self)); |
1215 | NEED_SUCCESS (EnqueueBarrier, (self)); |
|
|
1216 | #endif |
|
|
1217 | if (ev) |
|
|
1218 | XPUSH_NEW_OBJ ("OpenCL::Event", ev); |
1156 | |
1219 | |
1157 | void |
1220 | void |
1158 | flush (OpenCL::Queue self) |
1221 | flush (OpenCL::Queue self) |
1159 | CODE: |
1222 | CODE: |
1160 | NEED_SUCCESS (Flush, (self)); |
1223 | NEED_SUCCESS (Flush, (self)); |
… | |
… | |
1530 | { |
1593 | { |
1531 | SV *sv = sv_2mortal (newSV (sizes [i])); |
1594 | SV *sv = sv_2mortal (newSV (sizes [i])); |
1532 | SvUPGRADE (sv, SVt_PV); |
1595 | SvUPGRADE (sv, SVt_PV); |
1533 | SvPOK_only (sv); |
1596 | SvPOK_only (sv); |
1534 | SvCUR_set (sv, sizes [i]); |
1597 | SvCUR_set (sv, sizes [i]); |
1535 | ptrs [i] = SvPVX (sv); |
1598 | ptrs [i] = (void *)SvPVX (sv); |
1536 | PUSHs (sv); |
1599 | PUSHs (sv); |
1537 | } |
1600 | } |
1538 | |
1601 | |
1539 | NEED_SUCCESS (GetProgramInfo, (self, CL_PROGRAM_BINARIES , sizeof (*ptrs ) * n, ptrs , &size)); |
1602 | NEED_SUCCESS (GetProgramInfo, (self, CL_PROGRAM_BINARIES , sizeof (*ptrs ) * n, ptrs , &size)); |
1540 | if (size != sizeof (*ptrs) * n) XSRETURN_EMPTY; |
1603 | if (size != sizeof (*ptrs) * n) XSRETURN_EMPTY; |
… | |
… | |
1690 | set_sampler (OpenCL::Kernel self, cl_uint idx, OpenCL::Sampler value) |
1753 | set_sampler (OpenCL::Kernel self, cl_uint idx, OpenCL::Sampler value) |
1691 | CODE: |
1754 | CODE: |
1692 | clSetKernelArg (self, idx, sizeof (value), &value); |
1755 | clSetKernelArg (self, idx, sizeof (value), &value); |
1693 | |
1756 | |
1694 | void |
1757 | void |
|
|
1758 | set_local (OpenCL::Kernel self, cl_uint idx, size_t size) |
|
|
1759 | CODE: |
|
|
1760 | clSetKernelArg (self, idx, size, 0); |
|
|
1761 | |
|
|
1762 | void |
1695 | set_event (OpenCL::Kernel self, cl_uint idx, OpenCL::Event value) |
1763 | set_event (OpenCL::Kernel self, cl_uint idx, OpenCL::Event value) |
1696 | CODE: |
1764 | CODE: |
1697 | clSetKernelArg (self, idx, sizeof (value), &value); |
1765 | clSetKernelArg (self, idx, sizeof (value), &value); |
1698 | |
1766 | |
1699 | void |
1767 | void |