--- OpenCL/OpenCL.xs 2011/11/17 06:22:29 1.12 +++ OpenCL/OpenCL.xs 2011/11/20 01:09:48 1.13 @@ -240,6 +240,75 @@ PPCODE: INFO (Platform) +#BEGIN:platform + +void +profile (OpenCL::Platform this) + PPCODE: + size_t size; + int i, n; + NEED_SUCCESS (GetPlatformInfo, (this, CL_PLATFORM_PROFILE, 0, 0, &size)); + char *value = tmpbuf (size); + NEED_SUCCESS (GetPlatformInfo, (this, CL_PLATFORM_PROFILE, size, value, 0)); + n = 1; + EXTEND (SP, n); + for (i = 0; i < n; ++i) + PUSHs (sv_2mortal (newSVpvn (value, size))); + +void +version (OpenCL::Platform this) + PPCODE: + size_t size; + int i, n; + NEED_SUCCESS (GetPlatformInfo, (this, CL_PLATFORM_VERSION, 0, 0, &size)); + char *value = tmpbuf (size); + NEED_SUCCESS (GetPlatformInfo, (this, CL_PLATFORM_VERSION, size, value, 0)); + n = 1; + EXTEND (SP, n); + for (i = 0; i < n; ++i) + PUSHs (sv_2mortal (newSVpvn (value, size))); + +void +name (OpenCL::Platform this) + PPCODE: + size_t size; + int i, n; + NEED_SUCCESS (GetPlatformInfo, (this, CL_PLATFORM_NAME, 0, 0, &size)); + char *value = tmpbuf (size); + NEED_SUCCESS (GetPlatformInfo, (this, CL_PLATFORM_NAME, size, value, 0)); + n = 1; + EXTEND (SP, n); + for (i = 0; i < n; ++i) + PUSHs (sv_2mortal (newSVpvn (value, size))); + +void +vendor (OpenCL::Platform this) + PPCODE: + size_t size; + int i, n; + NEED_SUCCESS (GetPlatformInfo, (this, CL_PLATFORM_VENDOR, 0, 0, &size)); + char *value = tmpbuf (size); + NEED_SUCCESS (GetPlatformInfo, (this, CL_PLATFORM_VENDOR, size, value, 0)); + n = 1; + EXTEND (SP, n); + for (i = 0; i < n; ++i) + PUSHs (sv_2mortal (newSVpvn (value, size))); + +void +extensions (OpenCL::Platform this) + PPCODE: + size_t size; + int i, n; + NEED_SUCCESS (GetPlatformInfo, (this, CL_PLATFORM_EXTENSIONS, 0, 0, &size)); + char *value = tmpbuf (size); + NEED_SUCCESS (GetPlatformInfo, (this, CL_PLATFORM_EXTENSIONS, size, value, 0)); + n = 1; + EXTEND (SP, n); + for (i = 0; i < n; ++i) + PUSHs (sv_2mortal (newSVpvn (value, size))); + +#END:platform + void devices (OpenCL::Platform this, cl_device_type type = CL_DEVICE_TYPE_ALL) PPCODE: @@ -388,6 +457,10 @@ NEED_SUCCESS_ARG (cl_program prog, CreateProgramWithSource, (this, 1, &ptr, &len2, &res)); XPUSH_NEW_OBJ ("OpenCL::Program", prog); +#BEGIN:context + +#END:context + MODULE = OpenCL PACKAGE = OpenCL::Queue void @@ -647,6 +720,13 @@ PPCODE: INFO (MemObject) +MODULE = OpenCL PACKAGE = OpenCL::Image + +void +image_info (OpenCL::Image this, cl_image_info name) + PPCODE: + INFO (Image) + MODULE = OpenCL PACKAGE = OpenCL::Sampler void @@ -707,6 +787,18 @@ INFO (Kernel) void +work_group_info (OpenCL::Kernel this, OpenCL::Device device, cl_kernel_work_group_info name) + PPCODE: + size_t size; + NEED_SUCCESS (GetKernelWorkGroupInfo, (this, device, name, 0, 0, &size)); + SV *sv = sv_2mortal (newSV (size)); + SvUPGRADE (sv, SVt_PV); + SvPOK_only (sv); + SvCUR_set (sv, size); + NEED_SUCCESS (GetKernelWorkGroupInfo, (this, device, name, size, SvPVX (sv), 0)); + XPUSHs (sv); + +void set_char (OpenCL::Kernel this, cl_uint idx, cl_char value) CODE: clSetKernelArg (this, idx, sizeof (value), &value); @@ -804,6 +896,11 @@ INFO (Event) void +profiling_info (OpenCL::Event this, cl_profiling_info name) + PPCODE: + INFO (EventProfiling) + +void wait (OpenCL::Event this) CODE: clWaitForEvents (1, &this);