ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/OpenCL/OpenCL.xs
(Generate patch)

Comparing OpenCL/OpenCL.xs (file contents):
Revision 1.28 by root, Thu Apr 19 13:49:33 2012 UTC vs.
Revision 1.37 by root, Sat Apr 21 18:49:21 2012 UTC

1#include "EXTERN.h" 1#include "EXTERN.h"
2#include "perl.h" 2#include "perl.h"
3#include "XSUB.h" 3#include "XSUB.h"
4
5#ifdef I_DLFCN
6 #include <dlfcn.h>
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 */
4 18
5#ifdef __APPLE__ 19#ifdef __APPLE__
6 #include <OpenCL/opencl.h> 20 #include <OpenCL/opencl.h>
7#else 21#else
8 #include <CL/opencl.h> 22 #include <CL/opencl.h>
31 45
32typedef SV *FUTURE; 46typedef SV *FUTURE;
33 47
34/*****************************************************************************/ 48/*****************************************************************************/
35 49
50// name must include a leading underscore
51// all of this horrors would be unneceesary if somebody wrote a proper OpenGL module
52// for perl. doh.
53static void *
54glsym (const char *name)
55{
56 void *fun = 0;
57
58 #if defined I_DLFCN && defined RTLD_DEFAULT
59 fun = dlsym (RTLD_DEFAULT, name + 1);
60 if (!fun) fun = dlsym (RTLD_DEFAULT, name);
61
62 if (!fun)
63 {
64 static void *libgl;
65 static const char *glso[] = {
66 "libGL.so.1",
67 "libGL.so.3",
68 "libGL.so.4.0",
69 "libGL.so",
70 "/usr/lib/libGL.so",
71 "/usr/X11R6/lib/libGL.1.dylib"
72 };
73 int i;
74
75 for (i = 0; !libgl && i < sizeof (glso) / sizeof (glso [0]); ++i)
76 {
77 libgl = dlopen (glso [i], RTLD_LAZY);
78 if (libgl)
79 break;
80 }
81
82 if (libgl)
83 {
84 fun = dlsym (libgl, name + 1);
85 if (!fun) fun = dlsym (libgl, name);
86 }
87 }
88 #endif
89
90 return fun;
91}
92
93/*****************************************************************************/
94
36/* up to two temporary buffers */ 95/* up to two temporary buffers */
37static void * 96static void *
38tmpbuf (size_t size) 97tmpbuf (size_t size)
39{ 98{
40 enum { buffers = 3 }; 99 enum { buffers = 3 };
41 static int idx; 100 static int idx;
42 static void *buf [buffers]; 101 static void *buf [buffers];
43 static size_t len [buffers]; 102 static size_t len [buffers];
44 103
45 idx = ++idx % buffers; 104 idx = (idx + 1) % buffers;
46 105
47 if (len [idx] < size) 106 if (len [idx] < size)
48 { 107 {
49 free (buf [idx]); 108 free (buf [idx]);
50 len [idx] = ((size + 31) & ~4095) + 4096 - 32; 109 len [idx] = ((size + 31) & ~4095) + 4096 - 32;
154 croak ("%s: %s is not a property list (must be even number of elements)", func, svname); 213 croak ("%s: %s is not a property list (must be even number of elements)", func, svname);
155 214
156 while (extracount--) 215 while (extracount--)
157 *l++ = *extra++; 216 *l++ = *extra++;
158 217
159 for (i = 0; i < len; ++i) 218 for (i = 0; i < len; i += 2)
160 { 219 {
161 cl_context_properties t = SvIV (*av_fetch (av, i, 0)); 220 cl_context_properties t = SvIV (*av_fetch (av, i , 0));
162 cl_context_properties v; 221 SV *p_sv = *av_fetch (av, i + 1, 0);
163 222 cl_context_properties v = SvIV (p_sv); // code below can override
164 ++i;
165 223
166 switch (t) 224 switch (t)
167 { 225 {
226 case CL_GLX_DISPLAY_KHR:
227 if (!SvOK (p_sv))
228 {
229 void *func = glsym ("_glXGetCurrentDisplay");
230 if (func)
231 v = (cl_context_properties)((void *(*)(void))func)();
232 }
233 break;
234
235 case CL_GL_CONTEXT_KHR:
236 if (!SvOK (p_sv))
237 {
238 void *func = glsym ("_glXGetCurrentContext");
239 if (func)
240 v = (cl_context_properties)((void *(*)(void))func)();
241 }
242 break;
243
168 default: 244 default:
169 /* unknown property, treat as int */ 245 /* unknown property, treat as int */
170 v = SvIV (*av_fetch (av, i, 0));
171 break; 246 break;
172 } 247 }
173 248
174 *l++ = t; 249 *l++ = t;
175 *l++ = v; 250 *l++ = v;
192 clGetImageInfo (img, CL_IMAGE_ROW_PITCH, sizeof (res), &res, 0); 267 clGetImageInfo (img, CL_IMAGE_ROW_PITCH, sizeof (res), &res, 0);
193 return res; 268 return res;
194} 269}
195 270
196static cl_event * 271static cl_event *
197event_list (SV **items, int count) 272event_list (SV **items, cl_uint *rcount)
198{ 273{
274 cl_uint count = *rcount;
275
199 if (!count) 276 if (!count)
200 return 0; 277 return 0;
201 278
202 cl_event *list = tmpbuf (sizeof (cl_event) * count); 279 cl_event *list = tmpbuf (sizeof (cl_event) * count);
280 int i = 0;
203 281
204 while (count--) 282 do
283 {
284 --count;
285 if (SvOK (items [count]))
205 list [count] = SvPTROBJ ("clEnqueue", "wait_events", items [count], "OpenCL::Event"); 286 list [i++] = SvPTROBJ ("clEnqueue", "wait_events", items [count], "OpenCL::Event");
287 }
288 while (count);
206 289
290 *rcount = i;
291
207 return list; 292 return i ? list : 0;
208} 293}
209 294
210#define EVENT_LIST(items,count) \ 295#define EVENT_LIST(items,count) \
211 cl_uint event_list_count = (count); \ 296 cl_uint event_list_count = (count); \
212 cl_event *event_list_ptr = event_list (&ST (items), event_list_count) 297 cl_event *event_list_ptr = event_list (&ST (items), &event_list_count)
213 298
214#define INFO(class) \ 299#define INFO(class) \
215{ \ 300{ \
216 size_t size; \ 301 size_t size; \
217 NEED_SUCCESS (Get ## class ## Info, (self, name, 0, 0, &size)); \ 302 NEED_SUCCESS (Get ## class ## Info, (self, name, 0, 0, &size)); \
249} 334}
250 335
251cl_int 336cl_int
252errno () 337errno ()
253 CODE: 338 CODE:
254 errno = res; 339 RETVAL = res;
340 OUTPUT:
341 RETVAL
255 342
256const char * 343const char *
257err2str (cl_int err) 344err2str (cl_int err)
258 345
259const char * 346const char *
278context_from_type (cl_context_properties *properties = 0, cl_device_type type = CL_DEVICE_TYPE_DEFAULT, FUTURE notify = 0) 365context_from_type (cl_context_properties *properties = 0, cl_device_type type = CL_DEVICE_TYPE_DEFAULT, FUTURE notify = 0)
279 PPCODE: 366 PPCODE:
280 NEED_SUCCESS_ARG (cl_context ctx, CreateContextFromType, (properties, type, 0, 0, &res)); 367 NEED_SUCCESS_ARG (cl_context ctx, CreateContextFromType, (properties, type, 0, 0, &res));
281 XPUSH_NEW_OBJ ("OpenCL::Context", ctx); 368 XPUSH_NEW_OBJ ("OpenCL::Context", ctx);
282 369
370#if 0
371
283void 372void
284context (cl_context_properties *properties = 0, FUTURE devices, FUTURE notify = 0) 373context (cl_context_properties *properties = 0, FUTURE devices, FUTURE notify = 0)
285 PPCODE: 374 PPCODE:
286 /* der Gipfel der Kunst */ 375 /* der Gipfel der Kunst */
376
377#endif
287 378
288void 379void
289wait_for_events (...) 380wait_for_events (...)
290 CODE: 381 CODE:
291 EVENT_LIST (0, items); 382 EVENT_LIST (0, items);
633 if (!(flags & (CL_MEM_USE_HOST_PTR | CL_MEM_COPY_HOST_PTR))) 724 if (!(flags & (CL_MEM_USE_HOST_PTR | CL_MEM_COPY_HOST_PTR)))
634 croak ("OpenCL::Context::buffer_sv: you have to specify use or copy host ptr when buffer data is given, use $context->buffer instead?"); 725 croak ("OpenCL::Context::buffer_sv: you have to specify use or copy host ptr when buffer data is given, use $context->buffer instead?");
635 NEED_SUCCESS_ARG (cl_mem mem, CreateBuffer, (self, flags, len, ptr, &res)); 726 NEED_SUCCESS_ARG (cl_mem mem, CreateBuffer, (self, flags, len, ptr, &res));
636 XPUSH_NEW_OBJ ("OpenCL::BufferObj", mem); 727 XPUSH_NEW_OBJ ("OpenCL::BufferObj", mem);
637 728
729#if !defined CL_VERSION_1_2 || defined CL_USE_DEPRECATED_OPENCL_1_1_APIS
730
638void 731void
639image2d (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) 732image2d (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)
640 PPCODE: 733 PPCODE:
641 STRLEN len; 734 STRLEN len;
642 char *ptr = SvOK (data) ? SvPVbyte (data, len) : 0; 735 char *ptr = SvOK (data) ? SvPVbyte (data, len) : 0;
651 char *ptr = SvOK (data) ? SvPVbyte (data, len) : 0; 744 char *ptr = SvOK (data) ? SvPVbyte (data, len) : 0;
652 const cl_image_format format = { channel_order, channel_type }; 745 const cl_image_format format = { channel_order, channel_type };
653 NEED_SUCCESS_ARG (cl_mem mem, CreateImage3D, (self, flags, &format, width, height, depth, row_pitch, slice_pitch, ptr, &res)); 746 NEED_SUCCESS_ARG (cl_mem mem, CreateImage3D, (self, flags, &format, width, height, depth, row_pitch, slice_pitch, ptr, &res));
654 XPUSH_NEW_OBJ ("OpenCL::Image3D", mem); 747 XPUSH_NEW_OBJ ("OpenCL::Image3D", mem);
655 748
749#endif
750
656#if cl_apple_gl_sharing || cl_khr_gl_sharing 751#if cl_apple_gl_sharing || cl_khr_gl_sharing
657 752
658void 753void
659gl_buffer (OpenCL::Context self, cl_mem_flags flags, cl_GLuint bufobj) 754gl_buffer (OpenCL::Context self, cl_mem_flags flags, cl_GLuint bufobj)
660 PPCODE: 755 PPCODE:
661 NEED_SUCCESS_ARG (cl_mem mem, CreateFromGLBuffer, (self, flags, bufobj, &res)); 756 NEED_SUCCESS_ARG (cl_mem mem, CreateFromGLBuffer, (self, flags, bufobj, &res));
662 XPUSH_NEW_OBJ ("OpenCL::BufferObj", mem); 757 XPUSH_NEW_OBJ ("OpenCL::BufferObj", mem);
663 758
759#if !defined CL_VERSION_1_2 || defined CL_USE_DEPRECATED_OPENCL_1_1_APIS
760
664void 761void
665gl_texture2d (OpenCL::Context self, cl_mem_flags flags, cl_GLenum target, cl_GLint miplevel, cl_GLuint texture) 762gl_texture2d (OpenCL::Context self, cl_mem_flags flags, cl_GLenum target, cl_GLint miplevel, cl_GLuint texture)
666 PPCODE: 763 PPCODE:
667 NEED_SUCCESS_ARG (cl_mem mem, CreateFromGLTexture2D, (self, flags, target, miplevel, texture, &res)); 764 NEED_SUCCESS_ARG (cl_mem mem, CreateFromGLTexture2D, (self, flags, target, miplevel, texture, &res));
668 XPUSH_NEW_OBJ ("OpenCL::Image2D", mem); 765 XPUSH_NEW_OBJ ("OpenCL::Image2D", mem);
670void 767void
671gl_texture3d (OpenCL::Context self, cl_mem_flags flags, cl_GLenum target, cl_GLint miplevel, cl_GLuint texture) 768gl_texture3d (OpenCL::Context self, cl_mem_flags flags, cl_GLenum target, cl_GLint miplevel, cl_GLuint texture)
672 PPCODE: 769 PPCODE:
673 NEED_SUCCESS_ARG (cl_mem mem, CreateFromGLTexture3D, (self, flags, target, miplevel, texture, &res)); 770 NEED_SUCCESS_ARG (cl_mem mem, CreateFromGLTexture3D, (self, flags, target, miplevel, texture, &res));
674 XPUSH_NEW_OBJ ("OpenCL::Image3D", mem); 771 XPUSH_NEW_OBJ ("OpenCL::Image3D", mem);
772
773#endif
675 774
676void 775void
677gl_renderbuffer (OpenCL::Context self, cl_mem_flags flags, cl_GLuint renderbuffer) 776gl_renderbuffer (OpenCL::Context self, cl_mem_flags flags, cl_GLuint renderbuffer)
678 PPCODE: 777 PPCODE:
679 NEED_SUCCESS_ARG (cl_mem mem, CreateFromGLRenderbuffer, (self, flags, renderbuffer, &res)); 778 NEED_SUCCESS_ARG (cl_mem mem, CreateFromGLRenderbuffer, (self, flags, renderbuffer, &res));
790 cl_event ev = 0; 889 cl_event ev = 0;
791 STRLEN len; 890 STRLEN len;
792 char *ptr = SvPVbyte (data, len); 891 char *ptr = SvPVbyte (data, len);
793 EVENT_LIST (5, items - 5); 892 EVENT_LIST (5, items - 5);
794 893
795 NEED_SUCCESS (EnqueueReadBuffer, (self, mem, blocking, offset, len, ptr, event_list_count, event_list_ptr, GIMME_V != G_VOID ? &ev : 0)); 894 NEED_SUCCESS (EnqueueWriteBuffer, (self, mem, blocking, offset, len, ptr, event_list_count, event_list_ptr, GIMME_V != G_VOID ? &ev : 0));
796 895
797 if (ev) 896 if (ev)
798 XPUSH_NEW_OBJ ("OpenCL::Event", ev); 897 XPUSH_NEW_OBJ ("OpenCL::Event", ev);
799 898
800void 899void
866 size_t min_len = host_row_pitch * host_slice_pitch * region [2]; 965 size_t min_len = host_row_pitch * host_slice_pitch * region [2];
867 966
868 if (len < min_len) 967 if (len < min_len)
869 croak ("clEnqueueWriteImage: data string is shorter than what would be transferred"); 968 croak ("clEnqueueWriteImage: data string is shorter than what would be transferred");
870 969
871 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)); 970 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));
872 971
873 if (ev) 972 if (ev)
874 XPUSH_NEW_OBJ ("OpenCL::Event", ev); 973 XPUSH_NEW_OBJ ("OpenCL::Event", ev);
875 974
876void 975void
931 size_t min_len = slice_pitch ? slice_pitch * depth : row_pitch * height; 1030 size_t min_len = slice_pitch ? slice_pitch * depth : row_pitch * height;
932 1031
933 if (len < min_len) 1032 if (len < min_len)
934 croak ("clEnqueueWriteImage: data string is shorter than what would be transferred"); 1033 croak ("clEnqueueWriteImage: data string is shorter than what would be transferred");
935 1034
936 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)); 1035 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));
937 1036
938 if (ev) 1037 if (ev)
939 XPUSH_NEW_OBJ ("OpenCL::Event", ev); 1038 XPUSH_NEW_OBJ ("OpenCL::Event", ev);
940 1039
941void 1040void
1023 gwo [i] = SvIV (AvARRAY (SvRV (global_work_offset))[i]); 1122 gwo [i] = SvIV (AvARRAY (SvRV (global_work_offset))[i]);
1024 } 1123 }
1025 1124
1026 if (SvOK (local_work_size)) 1125 if (SvOK (local_work_size))
1027 { 1126 {
1028 if (SvOK (local_work_size) && !SvROK (local_work_size) || SvTYPE (SvRV (local_work_size)) != SVt_PVAV) 1127 if ((SvOK (local_work_size) && !SvROK (local_work_size)) || SvTYPE (SvRV (local_work_size)) != SVt_PVAV)
1029 croak ("clEnqueueNDRangeKernel: global_work_size must be undef or an array reference"); 1128 croak ("clEnqueueNDRangeKernel: global_work_size must be undef or an array reference");
1030 1129
1031 if (AvFILLp (SvRV (local_work_size)) + 1 != gws_len) 1130 if (AvFILLp (SvRV (local_work_size)) + 1 != gws_len)
1032 croak ("clEnqueueNDRangeKernel: local_work_local must be undef or an array of same size as global_work_size"); 1131 croak ("clEnqueueNDRangeKernel: local_work_local must be undef or an array of same size as global_work_size");
1033 1132
1045 1144
1046void 1145void
1047enqueue_acquire_gl_objects (OpenCL::Queue self, SV *objects, ...) 1146enqueue_acquire_gl_objects (OpenCL::Queue self, SV *objects, ...)
1048 ALIAS: 1147 ALIAS:
1049 enqueue_release_gl_objects = 1 1148 enqueue_release_gl_objects = 1
1050 CODE: 1149 PPCODE:
1051 if (!SvROK (objects) || SvTYPE (SvRV (objects)) != SVt_PVAV) 1150 if (!SvROK (objects) || SvTYPE (SvRV (objects)) != SVt_PVAV)
1052 croak ("OpenCL::Queue::enqueue_acquire/release_gl_objects argument 'objects' must be an arrayref with memory objects, in call"); 1151 croak ("OpenCL::Queue::enqueue_acquire/release_gl_objects argument 'objects' must be an arrayref with memory objects, in call");
1053 1152
1054 cl_event ev = 0; 1153 cl_event ev = 0;
1055 EVENT_LIST (2, items - 2); 1154 EVENT_LIST (2, items - 2);
1069 if (ev) 1168 if (ev)
1070 XPUSH_NEW_OBJ ("OpenCL::Event", ev); 1169 XPUSH_NEW_OBJ ("OpenCL::Event", ev);
1071 1170
1072#endif 1171#endif
1073 1172
1173#if !defined CL_VERSION_1_2 || defined CL_USE_DEPRECATED_OPENCL_1_1_APIS
1174
1074void 1175void
1075enqueue_marker (OpenCL::Queue self) 1176enqueue_marker (OpenCL::Queue self)
1076 PPCODE: 1177 PPCODE:
1077 cl_event ev; 1178 cl_event ev;
1078 NEED_SUCCESS (EnqueueMarker, (self, &ev)); 1179 NEED_SUCCESS (EnqueueMarker, (self, &ev));
1086 1187
1087void 1188void
1088enqueue_barrier (OpenCL::Queue self) 1189enqueue_barrier (OpenCL::Queue self)
1089 CODE: 1190 CODE:
1090 NEED_SUCCESS (EnqueueBarrier, (self)); 1191 NEED_SUCCESS (EnqueueBarrier, (self));
1192
1193#endif
1091 1194
1092void 1195void
1093flush (OpenCL::Queue self) 1196flush (OpenCL::Queue self)
1094 CODE: 1197 CODE:
1095 NEED_SUCCESS (Flush, (self)); 1198 NEED_SUCCESS (Flush, (self));
1245void 1348void
1246gl_object_info (OpenCL::Memory self) 1349gl_object_info (OpenCL::Memory self)
1247 PPCODE: 1350 PPCODE:
1248 cl_gl_object_type type; 1351 cl_gl_object_type type;
1249 cl_GLuint name; 1352 cl_GLuint name;
1250 NEED_SUCCESS (clGetGLObjectInfo, (self, &type, &name)); 1353 NEED_SUCCESS (GetGLObjectInfo, (self, &type, &name));
1251 EXTEND (SP, 2); 1354 EXTEND (SP, 2);
1252 PUSHs (sv_2mortal (newSVuv (type))); 1355 PUSHs (sv_2mortal (newSVuv (type)));
1253 PUSHs (sv_2mortal (newSVuv (name))); 1356 PUSHs (sv_2mortal (newSVuv (name)));
1254 1357
1255#endif 1358#endif
1300 1403
1301void 1404void
1302target (OpenCL::Image self) 1405target (OpenCL::Image self)
1303 PPCODE: 1406 PPCODE:
1304 cl_GLenum value [1]; 1407 cl_GLenum value [1];
1305 NEED_SUCCESS (GetGlTextureInfo, (self, CL_GL_TEXTURE_TARGET, sizeof (value), value, 0)); 1408 NEED_SUCCESS (GetGLTextureInfo, (self, CL_GL_TEXTURE_TARGET, sizeof (value), value, 0));
1306 EXTEND (SP, 1); 1409 EXTEND (SP, 1);
1307 const int i = 0; 1410 const int i = 0;
1308 PUSHs (sv_2mortal (newSVuv (value [i]))); 1411 PUSHs (sv_2mortal (newSVuv (value [i])));
1309 1412
1310void 1413void
1311gl_mipmap_level (OpenCL::Image self) 1414gl_mipmap_level (OpenCL::Image self)
1312 PPCODE: 1415 PPCODE:
1313 cl_GLint value [1]; 1416 cl_GLint value [1];
1314 NEED_SUCCESS (GetGlTextureInfo, (self, CL_GL_MIPMAP_LEVEL, sizeof (value), value, 0)); 1417 NEED_SUCCESS (GetGLTextureInfo, (self, CL_GL_MIPMAP_LEVEL, sizeof (value), value, 0));
1315 EXTEND (SP, 1); 1418 EXTEND (SP, 1);
1316 const int i = 0; 1419 const int i = 0;
1317 PUSHs (sv_2mortal (newSViv (value [i]))); 1420 PUSHs (sv_2mortal (newSViv (value [i])));
1318 1421
1319#END:gl_texture 1422#END:gl_texture
1465 { 1568 {
1466 SV *sv = sv_2mortal (newSV (sizes [i])); 1569 SV *sv = sv_2mortal (newSV (sizes [i]));
1467 SvUPGRADE (sv, SVt_PV); 1570 SvUPGRADE (sv, SVt_PV);
1468 SvPOK_only (sv); 1571 SvPOK_only (sv);
1469 SvCUR_set (sv, sizes [i]); 1572 SvCUR_set (sv, sizes [i]);
1470 ptrs [i] = SvPVX (sv); 1573 ptrs [i] = (void *)SvPVX (sv);
1471 PUSHs (sv); 1574 PUSHs (sv);
1472 } 1575 }
1473 1576
1474 NEED_SUCCESS (GetProgramInfo, (self, CL_PROGRAM_BINARIES , sizeof (*ptrs ) * n, ptrs , &size)); 1577 NEED_SUCCESS (GetProgramInfo, (self, CL_PROGRAM_BINARIES , sizeof (*ptrs ) * n, ptrs , &size));
1475 if (size != sizeof (*ptrs) * n) XSRETURN_EMPTY; 1578 if (size != sizeof (*ptrs) * n) XSRETURN_EMPTY;
1625set_sampler (OpenCL::Kernel self, cl_uint idx, OpenCL::Sampler value) 1728set_sampler (OpenCL::Kernel self, cl_uint idx, OpenCL::Sampler value)
1626 CODE: 1729 CODE:
1627 clSetKernelArg (self, idx, sizeof (value), &value); 1730 clSetKernelArg (self, idx, sizeof (value), &value);
1628 1731
1629void 1732void
1733set_local (OpenCL::Kernel self, cl_uint idx, size_t size)
1734 CODE:
1735 clSetKernelArg (self, idx, size, 0);
1736
1737void
1630set_event (OpenCL::Kernel self, cl_uint idx, OpenCL::Event value) 1738set_event (OpenCL::Kernel self, cl_uint idx, OpenCL::Event value)
1631 CODE: 1739 CODE:
1632 clSetKernelArg (self, idx, sizeof (value), &value); 1740 clSetKernelArg (self, idx, sizeof (value), &value);
1633 1741
1634void 1742void

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines