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

Comparing OpenCL/OpenCL.xs (file contents):
Revision 1.33 by root, Fri Apr 20 08:57:09 2012 UTC vs.
Revision 1.36 by root, Sat Apr 21 17:56:21 2012 UTC

257 clGetImageInfo (img, CL_IMAGE_ROW_PITCH, sizeof (res), &res, 0); 257 clGetImageInfo (img, CL_IMAGE_ROW_PITCH, sizeof (res), &res, 0);
258 return res; 258 return res;
259} 259}
260 260
261static cl_event * 261static cl_event *
262event_list (SV **items, int count) 262event_list (SV **items, cl_uint *rcount)
263{ 263{
264 cl_uint count = *rcount;
265
264 if (!count) 266 if (!count)
265 return 0; 267 return 0;
266 268
267 cl_event *list = tmpbuf (sizeof (cl_event) * count); 269 cl_event *list = tmpbuf (sizeof (cl_event) * count);
270 int i = 0;
268 271
269 while (count--) 272 do
273 {
274 --count;
275 if (SvOK (items [count]))
270 list [count] = SvPTROBJ ("clEnqueue", "wait_events", items [count], "OpenCL::Event"); 276 list [i++] = SvPTROBJ ("clEnqueue", "wait_events", items [count], "OpenCL::Event");
277 }
278 while (count);
271 279
280 *rcount = i;
281
272 return list; 282 return i ? list : 0;
273} 283}
274 284
275#define EVENT_LIST(items,count) \ 285#define EVENT_LIST(items,count) \
276 cl_uint event_list_count = (count); \ 286 cl_uint event_list_count = (count); \
277 cl_event *event_list_ptr = event_list (&ST (items), event_list_count) 287 cl_event *event_list_ptr = event_list (&ST (items), &event_list_count)
278 288
279#define INFO(class) \ 289#define INFO(class) \
280{ \ 290{ \
281 size_t size; \ 291 size_t size; \
282 NEED_SUCCESS (Get ## class ## Info, (self, name, 0, 0, &size)); \ 292 NEED_SUCCESS (Get ## class ## Info, (self, name, 0, 0, &size)); \
855 cl_event ev = 0; 865 cl_event ev = 0;
856 STRLEN len; 866 STRLEN len;
857 char *ptr = SvPVbyte (data, len); 867 char *ptr = SvPVbyte (data, len);
858 EVENT_LIST (5, items - 5); 868 EVENT_LIST (5, items - 5);
859 869
860 NEED_SUCCESS (EnqueueReadBuffer, (self, mem, blocking, offset, len, ptr, event_list_count, event_list_ptr, GIMME_V != G_VOID ? &ev : 0)); 870 NEED_SUCCESS (EnqueueWriteBuffer, (self, mem, blocking, offset, len, ptr, event_list_count, event_list_ptr, GIMME_V != G_VOID ? &ev : 0));
861 871
862 if (ev) 872 if (ev)
863 XPUSH_NEW_OBJ ("OpenCL::Event", ev); 873 XPUSH_NEW_OBJ ("OpenCL::Event", ev);
864 874
865void 875void
1110 1120
1111void 1121void
1112enqueue_acquire_gl_objects (OpenCL::Queue self, SV *objects, ...) 1122enqueue_acquire_gl_objects (OpenCL::Queue self, SV *objects, ...)
1113 ALIAS: 1123 ALIAS:
1114 enqueue_release_gl_objects = 1 1124 enqueue_release_gl_objects = 1
1115 CODE: 1125 PPCODE:
1116 if (!SvROK (objects) || SvTYPE (SvRV (objects)) != SVt_PVAV) 1126 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"); 1127 croak ("OpenCL::Queue::enqueue_acquire/release_gl_objects argument 'objects' must be an arrayref with memory objects, in call");
1118 1128
1119 cl_event ev = 0; 1129 cl_event ev = 0;
1120 EVENT_LIST (2, items - 2); 1130 EVENT_LIST (2, items - 2);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines