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

Comparing OpenCL/OpenCL.xs (file contents):
Revision 1.24 by root, Thu Apr 19 12:12:04 2012 UTC vs.
Revision 1.25 by root, Thu Apr 19 12:55:30 2012 UTC

4 4
5#ifdef __APPLE__ 5#ifdef __APPLE__
6 #include <OpenCL/opencl.h> 6 #include <OpenCL/opencl.h>
7#else 7#else
8 #include <CL/opencl.h> 8 #include <CL/opencl.h>
9#endif
10#if HAVE_OPENGL
11 #ifdef __APPLE__
12 #include <OpenGL/gl.h>
13 #include <OpenCL/cl_gl.h>
14 #else
15 #include <GL/gl.h>
16 #include <CL/cl_gl.h>
17 #endif
18#endif 9#endif
19 10
20typedef cl_platform_id OpenCL__Platform; 11typedef cl_platform_id OpenCL__Platform;
21typedef cl_device_id OpenCL__Device; 12typedef cl_device_id OpenCL__Device;
22typedef cl_context OpenCL__Context; 13typedef cl_context OpenCL__Context;
247 { sizeof (cl_long ), "SIZEOF_LONG" }, 238 { sizeof (cl_long ), "SIZEOF_LONG" },
248 { sizeof (cl_ulong ), "SIZEOF_ULONG" }, 239 { sizeof (cl_ulong ), "SIZEOF_ULONG" },
249 { sizeof (cl_half ), "SIZEOF_HALF" }, 240 { sizeof (cl_half ), "SIZEOF_HALF" },
250 { sizeof (cl_float ), "SIZEOF_FLOAT" }, 241 { sizeof (cl_float ), "SIZEOF_FLOAT" },
251 { sizeof (cl_double), "SIZEOF_DOUBLE" }, 242 { sizeof (cl_double), "SIZEOF_DOUBLE" },
252 { HAVE_OPENGL , "HAVE_OPENGL" },
253#include "constiv.h" 243#include "constiv.h"
254 }; 244 };
255 for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ > const_iv; civ--) 245 for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ > const_iv; civ--)
256 newCONSTSUB (stash, (char *)civ[-1].name, newSViv (civ[-1].iv)); 246 newCONSTSUB (stash, (char *)civ[-1].name, newSViv (civ[-1].iv));
257} 247}
659 char *ptr = SvOK (data) ? SvPVbyte (data, len) : 0; 649 char *ptr = SvOK (data) ? SvPVbyte (data, len) : 0;
660 const cl_image_format format = { channel_order, channel_type }; 650 const cl_image_format format = { channel_order, channel_type };
661 NEED_SUCCESS_ARG (cl_mem mem, CreateImage3D, (self, flags, &format, width, height, depth, row_pitch, slice_pitch, ptr, &res)); 651 NEED_SUCCESS_ARG (cl_mem mem, CreateImage3D, (self, flags, &format, width, height, depth, row_pitch, slice_pitch, ptr, &res));
662 XPUSH_NEW_OBJ ("OpenCL::Image3D", mem); 652 XPUSH_NEW_OBJ ("OpenCL::Image3D", mem);
663 653
654#if cl_apple_gl_sharing || cl_khr_gl_sharing
655
656void
657gl_buffer (OpenCL::Context self, cl_mem_flags flags, cl_GLuint bufobj)
658 PPCODE:
659 NEED_SUCCESS_ARG (cl_mem mem, CreateFromGLBuffer, (self, flags, bufobj, &res));
660 XPUSH_NEW_OBJ ("OpenCL::BufferObj", mem);
661
662void
663gl_texture2d (OpenCL::Context self, cl_mem_flags flags, cl_GLenum target, cl_GLint miplevel, cl_GLuint texture)
664 PPCODE:
665 NEED_SUCCESS_ARG (cl_mem mem, CreateFromGLTexture2D, (self, flags, target, miplevel, texture, &res));
666 XPUSH_NEW_OBJ ("OpenCL::Image2D", mem);
667
668void
669gl_texture3d (OpenCL::Context self, cl_mem_flags flags, cl_GLenum target, cl_GLint miplevel, cl_GLuint texture)
670 PPCODE:
671 NEED_SUCCESS_ARG (cl_mem mem, CreateFromGLTexture3D, (self, flags, target, miplevel, texture, &res));
672 XPUSH_NEW_OBJ ("OpenCL::Image3D", mem);
673
674void
675gl_renderbuffer (OpenCL::Context self, cl_mem_flags flags, cl_GLuint renderbuffer)
676 PPCODE:
677 NEED_SUCCESS_ARG (cl_mem mem, CreateFromGLRenderBuffer, (self, flags, renderbuffer, &res));
678 XPUSH_NEW_OBJ ("OpenCL::Image2D", mem);
679
680#endif
681
664void 682void
665supported_image_formats (OpenCL::Context self, cl_mem_flags flags, cl_mem_object_type image_type) 683supported_image_formats (OpenCL::Context self, cl_mem_flags flags, cl_mem_object_type image_type)
666 PPCODE: 684 PPCODE:
667{ 685{
668 cl_uint count; 686 cl_uint count;
1019 NEED_SUCCESS (EnqueueNDRangeKernel, (self, kernel, gws_len, gwo, gws, lws, event_list_count, event_list_ptr, GIMME_V != G_VOID ? &ev : 0)); 1037 NEED_SUCCESS (EnqueueNDRangeKernel, (self, kernel, gws_len, gwo, gws, lws, event_list_count, event_list_ptr, GIMME_V != G_VOID ? &ev : 0));
1020 1038
1021 if (ev) 1039 if (ev)
1022 XPUSH_NEW_OBJ ("OpenCL::Event", ev); 1040 XPUSH_NEW_OBJ ("OpenCL::Event", ev);
1023 1041
1042#if 0
1043#if cl_apple_gl_sharing || cl_khr_gl_sharing
1044
1045void
1046enqueue_acquire_gl_objects (OpenCL::Queue self, SV *objects, ...)
1047 CODE:
1048 cl_event ev = 0;
1049 EVENT_LIST (2, items - 2);
1050
1051 NEED_SUCCESS (EnqueueAcquireGLObjects, (self, ..., event_list_count, event_list_ptr, GIMME_V != G_VOID ? &ev : 0));
1052
1053 if (ev)
1054 XPUSH_NEW_OBJ ("OpenCL::Event", ev);
1055
1056void
1057enqueue_release_gl_objects (OpenCL::Queue self, SV *objects, ...)
1058 CODE:
1059 cl_event ev = 0;
1060 EVENT_LIST (2, items - 2);
1061
1062 NEED_SUCCESS (EnqueueAcquireGLObjects, (self, ..., event_list_count, event_list_ptr, GIMME_V != G_VOID ? &ev : 0));
1063
1064 if (ev)
1065 XPUSH_NEW_OBJ ("OpenCL::Event", ev);
1066
1067#endif
1068#endif
1069
1024void 1070void
1025enqueue_marker (OpenCL::Queue self) 1071enqueue_marker (OpenCL::Queue self)
1026 PPCODE: 1072 PPCODE:
1027 cl_event ev; 1073 cl_event ev;
1028 NEED_SUCCESS (EnqueueMarker, (self, &ev)); 1074 NEED_SUCCESS (EnqueueMarker, (self, &ev));

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines