1 | //
|
---|
2 | // Copyright (c) 2008-2020 The Khronos Group Inc.
|
---|
3 | //
|
---|
4 | // Licensed under the Apache License, Version 2.0 (the "License");
|
---|
5 | // you may not use this file except in compliance with the License.
|
---|
6 | // You may obtain a copy of the License at
|
---|
7 | //
|
---|
8 | // http://www.apache.org/licenses/LICENSE-2.0
|
---|
9 | //
|
---|
10 | // Unless required by applicable law or agreed to in writing, software
|
---|
11 | // distributed under the License is distributed on an "AS IS" BASIS,
|
---|
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
---|
13 | // See the License for the specific language governing permissions and
|
---|
14 | // limitations under the License.
|
---|
15 | //
|
---|
16 |
|
---|
17 | /*! \file
|
---|
18 | *
|
---|
19 | * \brief C++ bindings for OpenCL 1.0 (rev 48), OpenCL 1.1 (rev 33) and
|
---|
20 | * OpenCL 1.2 (rev 15)
|
---|
21 | * \author Benedict R. Gaster, Laurent Morichetti and Lee Howes
|
---|
22 | *
|
---|
23 | * Additions and fixes from:
|
---|
24 | * Brian Cole, March 3rd 2010 and April 2012
|
---|
25 | * Matt Gruenke, April 2012.
|
---|
26 | * Bruce Merry, February 2013.
|
---|
27 | * Tom Deakin and Simon McIntosh-Smith, July 2013
|
---|
28 | *
|
---|
29 | * \version 1.2.9
|
---|
30 | * \date December 2015
|
---|
31 | *
|
---|
32 | * Optional extension support
|
---|
33 | *
|
---|
34 | * cl
|
---|
35 | * cl_ext_device_fission
|
---|
36 | * #define USE_CL_DEVICE_FISSION
|
---|
37 | */
|
---|
38 |
|
---|
39 | /*! \mainpage
|
---|
40 | * \section intro Introduction
|
---|
41 | * For many large applications C++ is the language of choice and so it seems
|
---|
42 | * reasonable to define C++ bindings for OpenCL.
|
---|
43 | *
|
---|
44 | *
|
---|
45 | * The interface is contained with a single C++ header file \em cl.hpp and all
|
---|
46 | * definitions are contained within the namespace \em cl. There is no additional
|
---|
47 | * requirement to include \em cl.h and to use either the C++ or original C
|
---|
48 | * bindings it is enough to simply include \em cl.hpp.
|
---|
49 | *
|
---|
50 | * The bindings themselves are lightweight and correspond closely to the
|
---|
51 | * underlying C API. Using the C++ bindings introduces no additional execution
|
---|
52 | * overhead.
|
---|
53 | *
|
---|
54 | * For detail documentation on the bindings see:
|
---|
55 | *
|
---|
56 | * The OpenCL C++ Wrapper API 1.2 (revision 09)
|
---|
57 | * http://www.khronos.org/registry/cl/specs/opencl-cplusplus-1.2.pdf
|
---|
58 | *
|
---|
59 | * \section example Example
|
---|
60 | *
|
---|
61 | * The following example shows a general use case for the C++
|
---|
62 | * bindings, including support for the optional exception feature and
|
---|
63 | * also the supplied vector and string classes, see following sections for
|
---|
64 | * decriptions of these features.
|
---|
65 | *
|
---|
66 | * \code
|
---|
67 | * #define __CL_ENABLE_EXCEPTIONS
|
---|
68 | *
|
---|
69 | * #if defined(__APPLE__) || defined(__MACOSX)
|
---|
70 | * #include <OpenCL/cl.hpp>
|
---|
71 | * #else
|
---|
72 | * #include <CL/cl.hpp>
|
---|
73 | * #endif
|
---|
74 | * #include <cstdio>
|
---|
75 | * #include <cstdlib>
|
---|
76 | * #include <iostream>
|
---|
77 | *
|
---|
78 | * const char * helloStr = "__kernel void "
|
---|
79 | * "hello(void) "
|
---|
80 | * "{ "
|
---|
81 | * " "
|
---|
82 | * "} ";
|
---|
83 | *
|
---|
84 | * int
|
---|
85 | * main(void)
|
---|
86 | * {
|
---|
87 | * cl_int err = CL_SUCCESS;
|
---|
88 | * try {
|
---|
89 | *
|
---|
90 | * std::vector<cl::Platform> platforms;
|
---|
91 | * cl::Platform::get(&platforms);
|
---|
92 | * if (platforms.size() == 0) {
|
---|
93 | * std::cout << "Platform size 0\n";
|
---|
94 | * return -1;
|
---|
95 | * }
|
---|
96 | *
|
---|
97 | * cl_context_properties properties[] =
|
---|
98 | * { CL_CONTEXT_PLATFORM, (cl_context_properties)(platforms[0])(), 0};
|
---|
99 | * cl::Context context(CL_DEVICE_TYPE_CPU, properties);
|
---|
100 | *
|
---|
101 | * std::vector<cl::Device> devices = context.getInfo<CL_CONTEXT_DEVICES>();
|
---|
102 | *
|
---|
103 | * cl::Program::Sources source(1,
|
---|
104 | * std::make_pair(helloStr,strlen(helloStr)));
|
---|
105 | * cl::Program program_ = cl::Program(context, source);
|
---|
106 | * program_.build(devices);
|
---|
107 | *
|
---|
108 | * cl::Kernel kernel(program_, "hello", &err);
|
---|
109 | *
|
---|
110 | * cl::Event event;
|
---|
111 | * cl::CommandQueue queue(context, devices[0], 0, &err);
|
---|
112 | * queue.enqueueNDRangeKernel(
|
---|
113 | * kernel,
|
---|
114 | * cl::NullRange,
|
---|
115 | * cl::NDRange(4,4),
|
---|
116 | * cl::NullRange,
|
---|
117 | * NULL,
|
---|
118 | * &event);
|
---|
119 | *
|
---|
120 | * event.wait();
|
---|
121 | * }
|
---|
122 | * catch (cl::Error err) {
|
---|
123 | * std::cerr
|
---|
124 | * << "ERROR: "
|
---|
125 | * << err.what()
|
---|
126 | * << "("
|
---|
127 | * << err.err()
|
---|
128 | * << ")"
|
---|
129 | * << std::endl;
|
---|
130 | * }
|
---|
131 | *
|
---|
132 | * return EXIT_SUCCESS;
|
---|
133 | * }
|
---|
134 | *
|
---|
135 | * \endcode
|
---|
136 | *
|
---|
137 | */
|
---|
138 | #ifndef CL_HPP_
|
---|
139 | #define CL_HPP_
|
---|
140 |
|
---|
141 | // The latest version of the OpenCL C++ bindings can be found on GitHub:
|
---|
142 | // -> https://github.com/KhronosGroup/OpenCL-CLHPP
|
---|
143 | #pragma message("This version of the OpenCL Host API C++ bindings is deprecated, please use cl2.hpp instead.")
|
---|
144 |
|
---|
145 | #ifdef _WIN32
|
---|
146 |
|
---|
147 | #include <malloc.h>
|
---|
148 |
|
---|
149 | #if defined(USE_DX_INTEROP)
|
---|
150 | #include <CL/cl_d3d10.h>
|
---|
151 | #include <CL/cl_dx9_media_sharing.h>
|
---|
152 | #endif
|
---|
153 | #endif // _WIN32
|
---|
154 |
|
---|
155 | #if defined(_MSC_VER)
|
---|
156 | #include <intrin.h>
|
---|
157 | #endif // _MSC_VER
|
---|
158 |
|
---|
159 | //
|
---|
160 | #if defined(USE_CL_DEVICE_FISSION)
|
---|
161 | #include <CL/cl_ext.h>
|
---|
162 | #endif
|
---|
163 |
|
---|
164 | #if defined(__APPLE__) || defined(__MACOSX)
|
---|
165 | #include <OpenCL/opencl.h>
|
---|
166 | #else
|
---|
167 | #include <CL/opencl.h>
|
---|
168 | #endif // !__APPLE__
|
---|
169 |
|
---|
170 | #if (_MSC_VER >= 1700) || (__cplusplus >= 201103L)
|
---|
171 | #define CL_HPP_RVALUE_REFERENCES_SUPPORTED
|
---|
172 | #define CL_HPP_CPP11_ATOMICS_SUPPORTED
|
---|
173 | #include <atomic>
|
---|
174 | #endif
|
---|
175 |
|
---|
176 | #if (__cplusplus >= 201103L)
|
---|
177 | #define CL_HPP_NOEXCEPT noexcept
|
---|
178 | #else
|
---|
179 | #define CL_HPP_NOEXCEPT
|
---|
180 | #endif
|
---|
181 |
|
---|
182 |
|
---|
183 | // To avoid accidentally taking ownership of core OpenCL types
|
---|
184 | // such as cl_kernel constructors are made explicit
|
---|
185 | // under OpenCL 1.2
|
---|
186 | #if defined(CL_VERSION_1_2) && !defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS)
|
---|
187 | #define __CL_EXPLICIT_CONSTRUCTORS explicit
|
---|
188 | #else // #if defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS)
|
---|
189 | #define __CL_EXPLICIT_CONSTRUCTORS
|
---|
190 | #endif // #if defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS)
|
---|
191 |
|
---|
192 | // Define deprecated prefixes and suffixes to ensure compilation
|
---|
193 | // in case they are not pre-defined
|
---|
194 | #if !defined(CL_EXT_PREFIX__VERSION_1_1_DEPRECATED)
|
---|
195 | #define CL_EXT_PREFIX__VERSION_1_1_DEPRECATED
|
---|
196 | #endif // #if !defined(CL_EXT_PREFIX__VERSION_1_1_DEPRECATED)
|
---|
197 | #if !defined(CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED)
|
---|
198 | #define CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED
|
---|
199 | #endif // #if !defined(CL_EXT_PREFIX__VERSION_1_1_DEPRECATED)
|
---|
200 |
|
---|
201 | #if !defined(CL_CALLBACK)
|
---|
202 | #define CL_CALLBACK
|
---|
203 | #endif //CL_CALLBACK
|
---|
204 |
|
---|
205 | #include <utility>
|
---|
206 | #include <limits>
|
---|
207 | #include <iterator>
|
---|
208 |
|
---|
209 | #if defined(__CL_ENABLE_EXCEPTIONS)
|
---|
210 | #include <exception>
|
---|
211 | #endif // #if defined(__CL_ENABLE_EXCEPTIONS)
|
---|
212 |
|
---|
213 | #if !defined(__NO_STD_VECTOR)
|
---|
214 | #include <vector>
|
---|
215 | #endif
|
---|
216 |
|
---|
217 | #if !defined(__NO_STD_STRING)
|
---|
218 | #include <string>
|
---|
219 | #endif
|
---|
220 |
|
---|
221 | #if defined(__ANDROID__) || defined(linux) || defined(__APPLE__) || defined(__MACOSX)
|
---|
222 | #include <alloca.h>
|
---|
223 | #endif // linux
|
---|
224 |
|
---|
225 | #include <cstring>
|
---|
226 |
|
---|
227 | // Compiler specific weak linking
|
---|
228 | #ifndef CL_WEAK_ATTRIB_PREFIX
|
---|
229 | // C++17: use inline variables/functions
|
---|
230 | #if __cplusplus >= 201703L
|
---|
231 | #define CL_USE_INLINE
|
---|
232 | #endif
|
---|
233 |
|
---|
234 | #ifdef CL_USE_INLINE
|
---|
235 | #define CL_WEAK_ATTRIB_PREFIX inline
|
---|
236 | #define CL_WEAK_ATTRIB_SUFFIX
|
---|
237 | #elif defined(_MSC_VER)
|
---|
238 | #define CL_WEAK_ATTRIB_PREFIX __declspec(selectany)
|
---|
239 | #define CL_WEAK_ATTRIB_SUFFIX
|
---|
240 | #elif defined(__MINGW32__)
|
---|
241 | #define CL_WEAK_ATTRIB_PREFIX
|
---|
242 | #define CL_WEAK_ATTRIB_SUFFIX __attribute__((selectany))
|
---|
243 | #else // GCC, CLANG, etc.
|
---|
244 | #define CL_WEAK_ATTRIB_PREFIX
|
---|
245 | #define CL_WEAK_ATTRIB_SUFFIX __attribute__((weak))
|
---|
246 | #endif // CL_USE_INLINE
|
---|
247 |
|
---|
248 | #endif // CL_WEAK_ATTRIB_PREFIX
|
---|
249 |
|
---|
250 | /*! \namespace cl
|
---|
251 | *
|
---|
252 | * \brief The OpenCL C++ bindings are defined within this namespace.
|
---|
253 | *
|
---|
254 | */
|
---|
255 | namespace cl {
|
---|
256 |
|
---|
257 | class Memory;
|
---|
258 |
|
---|
259 | /**
|
---|
260 | * Deprecated APIs for 1.2
|
---|
261 | */
|
---|
262 | #if defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS) || (defined(CL_VERSION_1_1) && !defined(CL_VERSION_1_2))
|
---|
263 | #define __INIT_CL_EXT_FCN_PTR(name) \
|
---|
264 | if(!pfn_##name) { \
|
---|
265 | pfn_##name = (PFN_##name) \
|
---|
266 | clGetExtensionFunctionAddress(#name); \
|
---|
267 | if(!pfn_##name) { \
|
---|
268 | } \
|
---|
269 | }
|
---|
270 | #endif // #if defined(CL_VERSION_1_1)
|
---|
271 |
|
---|
272 | #if defined(CL_VERSION_1_2)
|
---|
273 | #define __INIT_CL_EXT_FCN_PTR_PLATFORM(platform, name) \
|
---|
274 | if(!pfn_##name) { \
|
---|
275 | pfn_##name = (PFN_##name) \
|
---|
276 | clGetExtensionFunctionAddressForPlatform(platform, #name); \
|
---|
277 | if(!pfn_##name) { \
|
---|
278 | } \
|
---|
279 | }
|
---|
280 | #endif // #if defined(CL_VERSION_1_1)
|
---|
281 |
|
---|
282 | class Program;
|
---|
283 | class Device;
|
---|
284 | class Context;
|
---|
285 | class CommandQueue;
|
---|
286 | class Memory;
|
---|
287 | class Buffer;
|
---|
288 |
|
---|
289 | #if defined(__CL_ENABLE_EXCEPTIONS)
|
---|
290 | /*! \brief Exception class
|
---|
291 | *
|
---|
292 | * This may be thrown by API functions when __CL_ENABLE_EXCEPTIONS is defined.
|
---|
293 | */
|
---|
294 | class Error : public std::exception
|
---|
295 | {
|
---|
296 | private:
|
---|
297 | cl_int err_;
|
---|
298 | const char * errStr_;
|
---|
299 | public:
|
---|
300 | /*! \brief Create a new CL error exception for a given error code
|
---|
301 | * and corresponding message.
|
---|
302 | *
|
---|
303 | * \param err error code value.
|
---|
304 | *
|
---|
305 | * \param errStr a descriptive string that must remain in scope until
|
---|
306 | * handling of the exception has concluded. If set, it
|
---|
307 | * will be returned by what().
|
---|
308 | */
|
---|
309 | Error(cl_int err, const char * errStr = NULL) : err_(err), errStr_(errStr)
|
---|
310 | {}
|
---|
311 |
|
---|
312 | ~Error() throw() {}
|
---|
313 |
|
---|
314 | /*! \brief Get error string associated with exception
|
---|
315 | *
|
---|
316 | * \return A memory pointer to the error message string.
|
---|
317 | */
|
---|
318 | virtual const char * what() const throw ()
|
---|
319 | {
|
---|
320 | if (errStr_ == NULL) {
|
---|
321 | return "empty";
|
---|
322 | }
|
---|
323 | else {
|
---|
324 | return errStr_;
|
---|
325 | }
|
---|
326 | }
|
---|
327 |
|
---|
328 | /*! \brief Get error code associated with exception
|
---|
329 | *
|
---|
330 | * \return The error code.
|
---|
331 | */
|
---|
332 | cl_int err(void) const { return err_; }
|
---|
333 | };
|
---|
334 |
|
---|
335 | #define __ERR_STR(x) #x
|
---|
336 | #else
|
---|
337 | #define __ERR_STR(x) NULL
|
---|
338 | #endif // __CL_ENABLE_EXCEPTIONS
|
---|
339 |
|
---|
340 |
|
---|
341 | namespace detail
|
---|
342 | {
|
---|
343 | #if defined(__CL_ENABLE_EXCEPTIONS)
|
---|
344 | static inline cl_int errHandler (
|
---|
345 | cl_int err,
|
---|
346 | const char * errStr = NULL)
|
---|
347 | {
|
---|
348 | if (err != CL_SUCCESS) {
|
---|
349 | throw Error(err, errStr);
|
---|
350 | }
|
---|
351 | return err;
|
---|
352 | }
|
---|
353 | #else
|
---|
354 | static inline cl_int errHandler (cl_int err, const char * errStr = NULL)
|
---|
355 | {
|
---|
356 | (void) errStr; // suppress unused variable warning
|
---|
357 | return err;
|
---|
358 | }
|
---|
359 | #endif // __CL_ENABLE_EXCEPTIONS
|
---|
360 | }
|
---|
361 |
|
---|
362 |
|
---|
363 |
|
---|
364 | //! \cond DOXYGEN_DETAIL
|
---|
365 | #if !defined(__CL_USER_OVERRIDE_ERROR_STRINGS)
|
---|
366 | #define __GET_DEVICE_INFO_ERR __ERR_STR(clGetDeviceInfo)
|
---|
367 | #define __GET_PLATFORM_INFO_ERR __ERR_STR(clGetPlatformInfo)
|
---|
368 | #define __GET_DEVICE_IDS_ERR __ERR_STR(clGetDeviceIDs)
|
---|
369 | #define __GET_PLATFORM_IDS_ERR __ERR_STR(clGetPlatformIDs)
|
---|
370 | #define __GET_CONTEXT_INFO_ERR __ERR_STR(clGetContextInfo)
|
---|
371 | #define __GET_EVENT_INFO_ERR __ERR_STR(clGetEventInfo)
|
---|
372 | #define __GET_EVENT_PROFILE_INFO_ERR __ERR_STR(clGetEventProfileInfo)
|
---|
373 | #define __GET_MEM_OBJECT_INFO_ERR __ERR_STR(clGetMemObjectInfo)
|
---|
374 | #define __GET_IMAGE_INFO_ERR __ERR_STR(clGetImageInfo)
|
---|
375 | #define __GET_SAMPLER_INFO_ERR __ERR_STR(clGetSamplerInfo)
|
---|
376 | #define __GET_KERNEL_INFO_ERR __ERR_STR(clGetKernelInfo)
|
---|
377 | #if defined(CL_VERSION_1_2)
|
---|
378 | #define __GET_KERNEL_ARG_INFO_ERR __ERR_STR(clGetKernelArgInfo)
|
---|
379 | #endif // #if defined(CL_VERSION_1_2)
|
---|
380 | #define __GET_KERNEL_WORK_GROUP_INFO_ERR __ERR_STR(clGetKernelWorkGroupInfo)
|
---|
381 | #define __GET_PROGRAM_INFO_ERR __ERR_STR(clGetProgramInfo)
|
---|
382 | #define __GET_PROGRAM_BUILD_INFO_ERR __ERR_STR(clGetProgramBuildInfo)
|
---|
383 | #define __GET_COMMAND_QUEUE_INFO_ERR __ERR_STR(clGetCommandQueueInfo)
|
---|
384 |
|
---|
385 | #define __CREATE_CONTEXT_ERR __ERR_STR(clCreateContext)
|
---|
386 | #define __CREATE_CONTEXT_FROM_TYPE_ERR __ERR_STR(clCreateContextFromType)
|
---|
387 | #define __GET_SUPPORTED_IMAGE_FORMATS_ERR __ERR_STR(clGetSupportedImageFormats)
|
---|
388 |
|
---|
389 | #define __CREATE_BUFFER_ERR __ERR_STR(clCreateBuffer)
|
---|
390 | #define __COPY_ERR __ERR_STR(cl::copy)
|
---|
391 | #define __CREATE_SUBBUFFER_ERR __ERR_STR(clCreateSubBuffer)
|
---|
392 | #define __CREATE_GL_BUFFER_ERR __ERR_STR(clCreateFromGLBuffer)
|
---|
393 | #define __CREATE_GL_RENDER_BUFFER_ERR __ERR_STR(clCreateFromGLBuffer)
|
---|
394 | #define __GET_GL_OBJECT_INFO_ERR __ERR_STR(clGetGLObjectInfo)
|
---|
395 | #if defined(CL_VERSION_1_2)
|
---|
396 | #define __CREATE_IMAGE_ERR __ERR_STR(clCreateImage)
|
---|
397 | #define __CREATE_GL_TEXTURE_ERR __ERR_STR(clCreateFromGLTexture)
|
---|
398 | #define __IMAGE_DIMENSION_ERR __ERR_STR(Incorrect image dimensions)
|
---|
399 | #endif // #if defined(CL_VERSION_1_2)
|
---|
400 | #define __CREATE_SAMPLER_ERR __ERR_STR(clCreateSampler)
|
---|
401 | #define __SET_MEM_OBJECT_DESTRUCTOR_CALLBACK_ERR __ERR_STR(clSetMemObjectDestructorCallback)
|
---|
402 |
|
---|
403 | #define __CREATE_USER_EVENT_ERR __ERR_STR(clCreateUserEvent)
|
---|
404 | #define __SET_USER_EVENT_STATUS_ERR __ERR_STR(clSetUserEventStatus)
|
---|
405 | #define __SET_EVENT_CALLBACK_ERR __ERR_STR(clSetEventCallback)
|
---|
406 | #define __WAIT_FOR_EVENTS_ERR __ERR_STR(clWaitForEvents)
|
---|
407 |
|
---|
408 | #define __CREATE_KERNEL_ERR __ERR_STR(clCreateKernel)
|
---|
409 | #define __SET_KERNEL_ARGS_ERR __ERR_STR(clSetKernelArg)
|
---|
410 | #define __CREATE_PROGRAM_WITH_SOURCE_ERR __ERR_STR(clCreateProgramWithSource)
|
---|
411 | #define __CREATE_PROGRAM_WITH_BINARY_ERR __ERR_STR(clCreateProgramWithBinary)
|
---|
412 | #if defined(CL_VERSION_1_2)
|
---|
413 | #define __CREATE_PROGRAM_WITH_BUILT_IN_KERNELS_ERR __ERR_STR(clCreateProgramWithBuiltInKernels)
|
---|
414 | #endif // #if defined(CL_VERSION_1_2)
|
---|
415 | #define __BUILD_PROGRAM_ERR __ERR_STR(clBuildProgram)
|
---|
416 | #if defined(CL_VERSION_1_2)
|
---|
417 | #define __COMPILE_PROGRAM_ERR __ERR_STR(clCompileProgram)
|
---|
418 | #define __LINK_PROGRAM_ERR __ERR_STR(clLinkProgram)
|
---|
419 | #endif // #if defined(CL_VERSION_1_2)
|
---|
420 | #define __CREATE_KERNELS_IN_PROGRAM_ERR __ERR_STR(clCreateKernelsInProgram)
|
---|
421 |
|
---|
422 | #define __CREATE_COMMAND_QUEUE_ERR __ERR_STR(clCreateCommandQueue)
|
---|
423 | #define __SET_COMMAND_QUEUE_PROPERTY_ERR __ERR_STR(clSetCommandQueueProperty)
|
---|
424 | #define __ENQUEUE_READ_BUFFER_ERR __ERR_STR(clEnqueueReadBuffer)
|
---|
425 | #define __ENQUEUE_READ_BUFFER_RECT_ERR __ERR_STR(clEnqueueReadBufferRect)
|
---|
426 | #define __ENQUEUE_WRITE_BUFFER_ERR __ERR_STR(clEnqueueWriteBuffer)
|
---|
427 | #define __ENQUEUE_WRITE_BUFFER_RECT_ERR __ERR_STR(clEnqueueWriteBufferRect)
|
---|
428 | #define __ENQEUE_COPY_BUFFER_ERR __ERR_STR(clEnqueueCopyBuffer)
|
---|
429 | #define __ENQEUE_COPY_BUFFER_RECT_ERR __ERR_STR(clEnqueueCopyBufferRect)
|
---|
430 | #define __ENQUEUE_FILL_BUFFER_ERR __ERR_STR(clEnqueueFillBuffer)
|
---|
431 | #define __ENQUEUE_READ_IMAGE_ERR __ERR_STR(clEnqueueReadImage)
|
---|
432 | #define __ENQUEUE_WRITE_IMAGE_ERR __ERR_STR(clEnqueueWriteImage)
|
---|
433 | #define __ENQUEUE_COPY_IMAGE_ERR __ERR_STR(clEnqueueCopyImage)
|
---|
434 | #define __ENQUEUE_FILL_IMAGE_ERR __ERR_STR(clEnqueueFillImage)
|
---|
435 | #define __ENQUEUE_COPY_IMAGE_TO_BUFFER_ERR __ERR_STR(clEnqueueCopyImageToBuffer)
|
---|
436 | #define __ENQUEUE_COPY_BUFFER_TO_IMAGE_ERR __ERR_STR(clEnqueueCopyBufferToImage)
|
---|
437 | #define __ENQUEUE_MAP_BUFFER_ERR __ERR_STR(clEnqueueMapBuffer)
|
---|
438 | #define __ENQUEUE_MAP_IMAGE_ERR __ERR_STR(clEnqueueMapImage)
|
---|
439 | #define __ENQUEUE_UNMAP_MEM_OBJECT_ERR __ERR_STR(clEnqueueUnMapMemObject)
|
---|
440 | #define __ENQUEUE_NDRANGE_KERNEL_ERR __ERR_STR(clEnqueueNDRangeKernel)
|
---|
441 | #define __ENQUEUE_TASK_ERR __ERR_STR(clEnqueueTask)
|
---|
442 | #define __ENQUEUE_NATIVE_KERNEL __ERR_STR(clEnqueueNativeKernel)
|
---|
443 | #if defined(CL_VERSION_1_2)
|
---|
444 | #define __ENQUEUE_MIGRATE_MEM_OBJECTS_ERR __ERR_STR(clEnqueueMigrateMemObjects)
|
---|
445 | #endif // #if defined(CL_VERSION_1_2)
|
---|
446 |
|
---|
447 | #define __ENQUEUE_ACQUIRE_GL_ERR __ERR_STR(clEnqueueAcquireGLObjects)
|
---|
448 | #define __ENQUEUE_RELEASE_GL_ERR __ERR_STR(clEnqueueReleaseGLObjects)
|
---|
449 |
|
---|
450 |
|
---|
451 | #define __RETAIN_ERR __ERR_STR(Retain Object)
|
---|
452 | #define __RELEASE_ERR __ERR_STR(Release Object)
|
---|
453 | #define __FLUSH_ERR __ERR_STR(clFlush)
|
---|
454 | #define __FINISH_ERR __ERR_STR(clFinish)
|
---|
455 | #define __VECTOR_CAPACITY_ERR __ERR_STR(Vector capacity error)
|
---|
456 |
|
---|
457 | /**
|
---|
458 | * CL 1.2 version that uses device fission.
|
---|
459 | */
|
---|
460 | #if defined(CL_VERSION_1_2)
|
---|
461 | #define __CREATE_SUB_DEVICES __ERR_STR(clCreateSubDevices)
|
---|
462 | #else
|
---|
463 | #define __CREATE_SUB_DEVICES __ERR_STR(clCreateSubDevicesEXT)
|
---|
464 | #endif // #if defined(CL_VERSION_1_2)
|
---|
465 |
|
---|
466 | /**
|
---|
467 | * Deprecated APIs for 1.2
|
---|
468 | */
|
---|
469 | #if defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS) || (defined(CL_VERSION_1_1) && !defined(CL_VERSION_1_2))
|
---|
470 | #define __ENQUEUE_MARKER_ERR __ERR_STR(clEnqueueMarker)
|
---|
471 | #define __ENQUEUE_WAIT_FOR_EVENTS_ERR __ERR_STR(clEnqueueWaitForEvents)
|
---|
472 | #define __ENQUEUE_BARRIER_ERR __ERR_STR(clEnqueueBarrier)
|
---|
473 | #define __UNLOAD_COMPILER_ERR __ERR_STR(clUnloadCompiler)
|
---|
474 | #define __CREATE_GL_TEXTURE_2D_ERR __ERR_STR(clCreateFromGLTexture2D)
|
---|
475 | #define __CREATE_GL_TEXTURE_3D_ERR __ERR_STR(clCreateFromGLTexture3D)
|
---|
476 | #define __CREATE_IMAGE2D_ERR __ERR_STR(clCreateImage2D)
|
---|
477 | #define __CREATE_IMAGE3D_ERR __ERR_STR(clCreateImage3D)
|
---|
478 | #endif // #if defined(CL_VERSION_1_1)
|
---|
479 |
|
---|
480 | #endif // __CL_USER_OVERRIDE_ERROR_STRINGS
|
---|
481 | //! \endcond
|
---|
482 |
|
---|
483 | /**
|
---|
484 | * CL 1.2 marker and barrier commands
|
---|
485 | */
|
---|
486 | #if defined(CL_VERSION_1_2)
|
---|
487 | #define __ENQUEUE_MARKER_WAIT_LIST_ERR __ERR_STR(clEnqueueMarkerWithWaitList)
|
---|
488 | #define __ENQUEUE_BARRIER_WAIT_LIST_ERR __ERR_STR(clEnqueueBarrierWithWaitList)
|
---|
489 | #endif // #if defined(CL_VERSION_1_2)
|
---|
490 |
|
---|
491 | #if !defined(__USE_DEV_STRING) && !defined(__NO_STD_STRING)
|
---|
492 | typedef std::string STRING_CLASS;
|
---|
493 | #elif !defined(__USE_DEV_STRING)
|
---|
494 |
|
---|
495 | /*! \class string
|
---|
496 | * \brief Simple string class, that provides a limited subset of std::string
|
---|
497 | * functionality but avoids many of the issues that come with that class.
|
---|
498 |
|
---|
499 | * \note Deprecated. Please use std::string as default or
|
---|
500 | * re-define the string class to match the std::string
|
---|
501 | * interface by defining STRING_CLASS
|
---|
502 | */
|
---|
503 | class CL_EXT_PREFIX__VERSION_1_1_DEPRECATED string
|
---|
504 | {
|
---|
505 | private:
|
---|
506 | ::size_t size_;
|
---|
507 | char * str_;
|
---|
508 | public:
|
---|
509 | //! \brief Constructs an empty string, allocating no memory.
|
---|
510 | string(void) : size_(0), str_(NULL)
|
---|
511 | {
|
---|
512 | }
|
---|
513 |
|
---|
514 | /*! \brief Constructs a string populated from an arbitrary value of
|
---|
515 | * specified size.
|
---|
516 | *
|
---|
517 | * An extra '\0' is added, in case none was contained in str.
|
---|
518 | *
|
---|
519 | * \param str the initial value of the string instance. Note that '\0'
|
---|
520 | * characters receive no special treatment. If NULL,
|
---|
521 | * the string is left empty, with a size of 0.
|
---|
522 | *
|
---|
523 | * \param size the number of characters to copy from str.
|
---|
524 | */
|
---|
525 | string(const char * str, ::size_t size) :
|
---|
526 | size_(size),
|
---|
527 | str_(NULL)
|
---|
528 | {
|
---|
529 | if( size > 0 ) {
|
---|
530 | str_ = new char[size_+1];
|
---|
531 | if (str_ != NULL) {
|
---|
532 | memcpy(str_, str, size_ * sizeof(char));
|
---|
533 | str_[size_] = '\0';
|
---|
534 | }
|
---|
535 | else {
|
---|
536 | size_ = 0;
|
---|
537 | }
|
---|
538 | }
|
---|
539 | }
|
---|
540 |
|
---|
541 | /*! \brief Constructs a string populated from a null-terminated value.
|
---|
542 | *
|
---|
543 | * \param str the null-terminated initial value of the string instance.
|
---|
544 | * If NULL, the string is left empty, with a size of 0.
|
---|
545 | */
|
---|
546 | string(const char * str) :
|
---|
547 | size_(0),
|
---|
548 | str_(NULL)
|
---|
549 | {
|
---|
550 | if( str ) {
|
---|
551 | size_= ::strlen(str);
|
---|
552 | }
|
---|
553 | if( size_ > 0 ) {
|
---|
554 | str_ = new char[size_ + 1];
|
---|
555 | if (str_ != NULL) {
|
---|
556 | memcpy(str_, str, (size_ + 1) * sizeof(char));
|
---|
557 | }
|
---|
558 | }
|
---|
559 | }
|
---|
560 |
|
---|
561 | void resize( ::size_t n )
|
---|
562 | {
|
---|
563 | if( size_ == n ) {
|
---|
564 | return;
|
---|
565 | }
|
---|
566 | if (n == 0) {
|
---|
567 | if( str_ ) {
|
---|
568 | delete [] str_;
|
---|
569 | }
|
---|
570 | str_ = NULL;
|
---|
571 | size_ = 0;
|
---|
572 | }
|
---|
573 | else {
|
---|
574 | char *newString = new char[n + 1];
|
---|
575 | ::size_t copySize = n;
|
---|
576 | if( size_ < n ) {
|
---|
577 | copySize = size_;
|
---|
578 | }
|
---|
579 | size_ = n;
|
---|
580 |
|
---|
581 | if(str_) {
|
---|
582 | memcpy(newString, str_, (copySize + 1) * sizeof(char));
|
---|
583 | }
|
---|
584 | if( copySize < size_ ) {
|
---|
585 | memset(newString + copySize, 0, size_ - copySize);
|
---|
586 | }
|
---|
587 | newString[size_] = '\0';
|
---|
588 |
|
---|
589 | delete [] str_;
|
---|
590 | str_ = newString;
|
---|
591 | }
|
---|
592 | }
|
---|
593 |
|
---|
594 | const char& operator[] ( ::size_t pos ) const
|
---|
595 | {
|
---|
596 | return str_[pos];
|
---|
597 | }
|
---|
598 |
|
---|
599 | char& operator[] ( ::size_t pos )
|
---|
600 | {
|
---|
601 | return str_[pos];
|
---|
602 | }
|
---|
603 |
|
---|
604 | /*! \brief Copies the value of another string to this one.
|
---|
605 | *
|
---|
606 | * \param rhs the string to copy.
|
---|
607 | *
|
---|
608 | * \returns a reference to the modified instance.
|
---|
609 | */
|
---|
610 | string& operator=(const string& rhs)
|
---|
611 | {
|
---|
612 | if (this == &rhs) {
|
---|
613 | return *this;
|
---|
614 | }
|
---|
615 |
|
---|
616 | if( str_ != NULL ) {
|
---|
617 | delete [] str_;
|
---|
618 | str_ = NULL;
|
---|
619 | size_ = 0;
|
---|
620 | }
|
---|
621 |
|
---|
622 | if (rhs.size_ == 0 || rhs.str_ == NULL) {
|
---|
623 | str_ = NULL;
|
---|
624 | size_ = 0;
|
---|
625 | }
|
---|
626 | else {
|
---|
627 | str_ = new char[rhs.size_ + 1];
|
---|
628 | size_ = rhs.size_;
|
---|
629 |
|
---|
630 | if (str_ != NULL) {
|
---|
631 | memcpy(str_, rhs.str_, (size_ + 1) * sizeof(char));
|
---|
632 | }
|
---|
633 | else {
|
---|
634 | size_ = 0;
|
---|
635 | }
|
---|
636 | }
|
---|
637 |
|
---|
638 | return *this;
|
---|
639 | }
|
---|
640 |
|
---|
641 | /*! \brief Constructs a string by copying the value of another instance.
|
---|
642 | *
|
---|
643 | * \param rhs the string to copy.
|
---|
644 | */
|
---|
645 | string(const string& rhs) :
|
---|
646 | size_(0),
|
---|
647 | str_(NULL)
|
---|
648 | {
|
---|
649 | *this = rhs;
|
---|
650 | }
|
---|
651 |
|
---|
652 | //! \brief Destructor - frees memory used to hold the current value.
|
---|
653 | ~string()
|
---|
654 | {
|
---|
655 | delete[] str_;
|
---|
656 | str_ = NULL;
|
---|
657 | }
|
---|
658 |
|
---|
659 | //! \brief Queries the length of the string, excluding any added '\0's.
|
---|
660 | ::size_t size(void) const { return size_; }
|
---|
661 |
|
---|
662 | //! \brief Queries the length of the string, excluding any added '\0's.
|
---|
663 | ::size_t length(void) const { return size(); }
|
---|
664 |
|
---|
665 | /*! \brief Returns a pointer to the private copy held by this instance,
|
---|
666 | * or "" if empty/unset.
|
---|
667 | */
|
---|
668 | const char * c_str(void) const { return (str_) ? str_ : "";}
|
---|
669 | } CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED;
|
---|
670 | typedef cl::string STRING_CLASS;
|
---|
671 | #endif // #elif !defined(__USE_DEV_STRING)
|
---|
672 |
|
---|
673 | #if !defined(__USE_DEV_VECTOR) && !defined(__NO_STD_VECTOR)
|
---|
674 | #define VECTOR_CLASS std::vector
|
---|
675 | #elif !defined(__USE_DEV_VECTOR)
|
---|
676 | #define VECTOR_CLASS cl::vector
|
---|
677 |
|
---|
678 | #if !defined(__MAX_DEFAULT_VECTOR_SIZE)
|
---|
679 | #define __MAX_DEFAULT_VECTOR_SIZE 10
|
---|
680 | #endif
|
---|
681 |
|
---|
682 | /*! \class vector
|
---|
683 | * \brief Fixed sized vector implementation that mirroring
|
---|
684 | *
|
---|
685 | * \note Deprecated. Please use std::vector as default or
|
---|
686 | * re-define the vector class to match the std::vector
|
---|
687 | * interface by defining VECTOR_CLASS
|
---|
688 |
|
---|
689 | * \note Not recommended for use with custom objects as
|
---|
690 | * current implementation will construct N elements
|
---|
691 | *
|
---|
692 | * std::vector functionality.
|
---|
693 | * \brief Fixed sized vector compatible with std::vector.
|
---|
694 | *
|
---|
695 | * \note
|
---|
696 | * This differs from std::vector<> not just in memory allocation,
|
---|
697 | * but also in terms of when members are constructed, destroyed,
|
---|
698 | * and assigned instead of being copy constructed.
|
---|
699 | *
|
---|
700 | * \param T type of element contained in the vector.
|
---|
701 | *
|
---|
702 | * \param N maximum size of the vector.
|
---|
703 | */
|
---|
704 | template <typename T, unsigned int N = __MAX_DEFAULT_VECTOR_SIZE>
|
---|
705 | class CL_EXT_PREFIX__VERSION_1_1_DEPRECATED vector
|
---|
706 | {
|
---|
707 | private:
|
---|
708 | T data_[N];
|
---|
709 | unsigned int size_;
|
---|
710 |
|
---|
711 | public:
|
---|
712 | //! \brief Constructs an empty vector with no memory allocated.
|
---|
713 | vector() :
|
---|
714 | size_(static_cast<unsigned int>(0))
|
---|
715 | {}
|
---|
716 |
|
---|
717 | //! \brief Deallocates the vector's memory and destroys all of its elements.
|
---|
718 | ~vector()
|
---|
719 | {
|
---|
720 | clear();
|
---|
721 | }
|
---|
722 |
|
---|
723 | //! \brief Returns the number of elements currently contained.
|
---|
724 | unsigned int size(void) const
|
---|
725 | {
|
---|
726 | return size_;
|
---|
727 | }
|
---|
728 |
|
---|
729 | /*! \brief Empties the vector of all elements.
|
---|
730 | * \note
|
---|
731 | * This does not deallocate memory but will invoke destructors
|
---|
732 | * on contained elements.
|
---|
733 | */
|
---|
734 | void clear()
|
---|
735 | {
|
---|
736 | while(!empty()) {
|
---|
737 | pop_back();
|
---|
738 | }
|
---|
739 | }
|
---|
740 |
|
---|
741 | /*! \brief Appends an element after the last valid element.
|
---|
742 | * Calling this on a vector that has reached capacity will throw an
|
---|
743 | * exception if exceptions are enabled.
|
---|
744 | */
|
---|
745 | void push_back (const T& x)
|
---|
746 | {
|
---|
747 | if (size() < N) {
|
---|
748 | new (&data_[size_]) T(x);
|
---|
749 | size_++;
|
---|
750 | } else {
|
---|
751 | detail::errHandler(CL_MEM_OBJECT_ALLOCATION_FAILURE, __VECTOR_CAPACITY_ERR);
|
---|
752 | }
|
---|
753 | }
|
---|
754 |
|
---|
755 | /*! \brief Removes the last valid element from the vector.
|
---|
756 | * Calling this on an empty vector will throw an exception
|
---|
757 | * if exceptions are enabled.
|
---|
758 | */
|
---|
759 | void pop_back(void)
|
---|
760 | {
|
---|
761 | if (size_ != 0) {
|
---|
762 | --size_;
|
---|
763 | data_[size_].~T();
|
---|
764 | } else {
|
---|
765 | detail::errHandler(CL_MEM_OBJECT_ALLOCATION_FAILURE, __VECTOR_CAPACITY_ERR);
|
---|
766 | }
|
---|
767 | }
|
---|
768 |
|
---|
769 | /*! \brief Constructs with a value copied from another.
|
---|
770 | *
|
---|
771 | * \param vec the vector to copy.
|
---|
772 | */
|
---|
773 | vector(const vector<T, N>& vec) :
|
---|
774 | size_(vec.size_)
|
---|
775 | {
|
---|
776 | if (size_ != 0) {
|
---|
777 | assign(vec.begin(), vec.end());
|
---|
778 | }
|
---|
779 | }
|
---|
780 |
|
---|
781 | /*! \brief Constructs with a specified number of initial elements.
|
---|
782 | *
|
---|
783 | * \param size number of initial elements.
|
---|
784 | *
|
---|
785 | * \param val value of initial elements.
|
---|
786 | */
|
---|
787 | vector(unsigned int size, const T& val = T()) :
|
---|
788 | size_(0)
|
---|
789 | {
|
---|
790 | for (unsigned int i = 0; i < size; i++) {
|
---|
791 | push_back(val);
|
---|
792 | }
|
---|
793 | }
|
---|
794 |
|
---|
795 | /*! \brief Overwrites the current content with that copied from another
|
---|
796 | * instance.
|
---|
797 | *
|
---|
798 | * \param rhs vector to copy.
|
---|
799 | *
|
---|
800 | * \returns a reference to this.
|
---|
801 | */
|
---|
802 | vector<T, N>& operator=(const vector<T, N>& rhs)
|
---|
803 | {
|
---|
804 | if (this == &rhs) {
|
---|
805 | return *this;
|
---|
806 | }
|
---|
807 |
|
---|
808 | if (rhs.size_ != 0) {
|
---|
809 | assign(rhs.begin(), rhs.end());
|
---|
810 | } else {
|
---|
811 | clear();
|
---|
812 | }
|
---|
813 |
|
---|
814 | return *this;
|
---|
815 | }
|
---|
816 |
|
---|
817 | /*! \brief Tests equality against another instance.
|
---|
818 | *
|
---|
819 | * \param vec the vector against which to compare.
|
---|
820 | */
|
---|
821 | bool operator==(vector<T,N> &vec)
|
---|
822 | {
|
---|
823 | if (size() != vec.size()) {
|
---|
824 | return false;
|
---|
825 | }
|
---|
826 |
|
---|
827 | for( unsigned int i = 0; i < size(); ++i ) {
|
---|
828 | if( operator[](i) != vec[i] ) {
|
---|
829 | return false;
|
---|
830 | }
|
---|
831 | }
|
---|
832 | return true;
|
---|
833 | }
|
---|
834 |
|
---|
835 | //! \brief Conversion operator to T*.
|
---|
836 | operator T* () { return data_; }
|
---|
837 |
|
---|
838 | //! \brief Conversion operator to const T*.
|
---|
839 | operator const T* () const { return data_; }
|
---|
840 |
|
---|
841 | //! \brief Tests whether this instance has any elements.
|
---|
842 | bool empty (void) const
|
---|
843 | {
|
---|
844 | return size_==0;
|
---|
845 | }
|
---|
846 |
|
---|
847 | //! \brief Returns the maximum number of elements this instance can hold.
|
---|
848 | unsigned int max_size (void) const
|
---|
849 | {
|
---|
850 | return N;
|
---|
851 | }
|
---|
852 |
|
---|
853 | //! \brief Returns the maximum number of elements this instance can hold.
|
---|
854 | unsigned int capacity () const
|
---|
855 | {
|
---|
856 | return N;
|
---|
857 | }
|
---|
858 |
|
---|
859 | //! \brief Resizes the vector to the given size
|
---|
860 | void resize(unsigned int newSize, T fill = T())
|
---|
861 | {
|
---|
862 | if (newSize > N)
|
---|
863 | {
|
---|
864 | detail::errHandler(CL_MEM_OBJECT_ALLOCATION_FAILURE, __VECTOR_CAPACITY_ERR);
|
---|
865 | }
|
---|
866 | else
|
---|
867 | {
|
---|
868 | while (size_ < newSize)
|
---|
869 | {
|
---|
870 | new (&data_[size_]) T(fill);
|
---|
871 | size_++;
|
---|
872 | }
|
---|
873 | while (size_ > newSize)
|
---|
874 | {
|
---|
875 | --size_;
|
---|
876 | data_[size_].~T();
|
---|
877 | }
|
---|
878 | }
|
---|
879 | }
|
---|
880 |
|
---|
881 | /*! \brief Returns a reference to a given element.
|
---|
882 | *
|
---|
883 | * \param index which element to access. *
|
---|
884 | * \note
|
---|
885 | * The caller is responsible for ensuring index is >= 0 and < size().
|
---|
886 | */
|
---|
887 | T& operator[](int index)
|
---|
888 | {
|
---|
889 | return data_[index];
|
---|
890 | }
|
---|
891 |
|
---|
892 | /*! \brief Returns a const reference to a given element.
|
---|
893 | *
|
---|
894 | * \param index which element to access.
|
---|
895 | *
|
---|
896 | * \note
|
---|
897 | * The caller is responsible for ensuring index is >= 0 and < size().
|
---|
898 | */
|
---|
899 | const T& operator[](int index) const
|
---|
900 | {
|
---|
901 | return data_[index];
|
---|
902 | }
|
---|
903 |
|
---|
904 | /*! \brief Assigns elements of the vector based on a source iterator range.
|
---|
905 | *
|
---|
906 | * \param start Beginning iterator of source range
|
---|
907 | * \param end Enditerator of source range
|
---|
908 | *
|
---|
909 | * \note
|
---|
910 | * Will throw an exception if exceptions are enabled and size exceeded.
|
---|
911 | */
|
---|
912 | template<class I>
|
---|
913 | void assign(I start, I end)
|
---|
914 | {
|
---|
915 | clear();
|
---|
916 | while(start != end) {
|
---|
917 | push_back(*start);
|
---|
918 | start++;
|
---|
919 | }
|
---|
920 | }
|
---|
921 |
|
---|
922 | /*! \class iterator
|
---|
923 | * \brief Const iterator class for vectors
|
---|
924 | */
|
---|
925 | class iterator
|
---|
926 | {
|
---|
927 | private:
|
---|
928 | const vector<T,N> *vec_;
|
---|
929 | int index_;
|
---|
930 |
|
---|
931 | /**
|
---|
932 | * Internal iterator constructor to capture reference
|
---|
933 | * to the vector it iterates over rather than taking
|
---|
934 | * the vector by copy.
|
---|
935 | */
|
---|
936 | iterator (const vector<T,N> &vec, int index) :
|
---|
937 | vec_(&vec)
|
---|
938 | {
|
---|
939 | if( !vec.empty() ) {
|
---|
940 | index_ = index;
|
---|
941 | } else {
|
---|
942 | index_ = -1;
|
---|
943 | }
|
---|
944 | }
|
---|
945 |
|
---|
946 | public:
|
---|
947 | iterator(void) :
|
---|
948 | index_(-1),
|
---|
949 | vec_(NULL)
|
---|
950 | {
|
---|
951 | }
|
---|
952 |
|
---|
953 | iterator(const iterator& rhs) :
|
---|
954 | vec_(rhs.vec_),
|
---|
955 | index_(rhs.index_)
|
---|
956 | {
|
---|
957 | }
|
---|
958 |
|
---|
959 | ~iterator(void) {}
|
---|
960 |
|
---|
961 | static iterator begin(const cl::vector<T,N> &vec)
|
---|
962 | {
|
---|
963 | iterator i(vec, 0);
|
---|
964 |
|
---|
965 | return i;
|
---|
966 | }
|
---|
967 |
|
---|
968 | static iterator end(const cl::vector<T,N> &vec)
|
---|
969 | {
|
---|
970 | iterator i(vec, vec.size());
|
---|
971 |
|
---|
972 | return i;
|
---|
973 | }
|
---|
974 |
|
---|
975 | bool operator==(iterator i)
|
---|
976 | {
|
---|
977 | return ((vec_ == i.vec_) &&
|
---|
978 | (index_ == i.index_));
|
---|
979 | }
|
---|
980 |
|
---|
981 | bool operator!=(iterator i)
|
---|
982 | {
|
---|
983 | return (!(*this==i));
|
---|
984 | }
|
---|
985 |
|
---|
986 | iterator& operator++()
|
---|
987 | {
|
---|
988 | ++index_;
|
---|
989 | return *this;
|
---|
990 | }
|
---|
991 |
|
---|
992 | iterator operator++(int)
|
---|
993 | {
|
---|
994 | iterator retVal(*this);
|
---|
995 | ++index_;
|
---|
996 | return retVal;
|
---|
997 | }
|
---|
998 |
|
---|
999 | iterator& operator--()
|
---|
1000 | {
|
---|
1001 | --index_;
|
---|
1002 | return *this;
|
---|
1003 | }
|
---|
1004 |
|
---|
1005 | iterator operator--(int)
|
---|
1006 | {
|
---|
1007 | iterator retVal(*this);
|
---|
1008 | --index_;
|
---|
1009 | return retVal;
|
---|
1010 | }
|
---|
1011 |
|
---|
1012 | const T& operator *() const
|
---|
1013 | {
|
---|
1014 | return (*vec_)[index_];
|
---|
1015 | }
|
---|
1016 | };
|
---|
1017 |
|
---|
1018 | iterator begin(void)
|
---|
1019 | {
|
---|
1020 | return iterator::begin(*this);
|
---|
1021 | }
|
---|
1022 |
|
---|
1023 | iterator begin(void) const
|
---|
1024 | {
|
---|
1025 | return iterator::begin(*this);
|
---|
1026 | }
|
---|
1027 |
|
---|
1028 | iterator end(void)
|
---|
1029 | {
|
---|
1030 | return iterator::end(*this);
|
---|
1031 | }
|
---|
1032 |
|
---|
1033 | iterator end(void) const
|
---|
1034 | {
|
---|
1035 | return iterator::end(*this);
|
---|
1036 | }
|
---|
1037 |
|
---|
1038 | T& front(void)
|
---|
1039 | {
|
---|
1040 | return data_[0];
|
---|
1041 | }
|
---|
1042 |
|
---|
1043 | T& back(void)
|
---|
1044 | {
|
---|
1045 | return data_[size_];
|
---|
1046 | }
|
---|
1047 |
|
---|
1048 | const T& front(void) const
|
---|
1049 | {
|
---|
1050 | return data_[0];
|
---|
1051 | }
|
---|
1052 |
|
---|
1053 | const T& back(void) const
|
---|
1054 | {
|
---|
1055 | return data_[size_-1];
|
---|
1056 | }
|
---|
1057 | } CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED;
|
---|
1058 | #endif // #if !defined(__USE_DEV_VECTOR) && !defined(__NO_STD_VECTOR)
|
---|
1059 |
|
---|
1060 |
|
---|
1061 |
|
---|
1062 |
|
---|
1063 |
|
---|
1064 | namespace detail {
|
---|
1065 | #define __DEFAULT_NOT_INITIALIZED 1
|
---|
1066 | #define __DEFAULT_BEING_INITIALIZED 2
|
---|
1067 | #define __DEFAULT_INITIALIZED 4
|
---|
1068 |
|
---|
1069 | /*
|
---|
1070 | * Compare and exchange primitives are needed for handling of defaults
|
---|
1071 | */
|
---|
1072 |
|
---|
1073 | #ifdef CL_HPP_CPP11_ATOMICS_SUPPORTED
|
---|
1074 | inline int compare_exchange(std::atomic<int> * dest, int exchange, int comparand)
|
---|
1075 | #else // !CL_HPP_CPP11_ATOMICS_SUPPORTED
|
---|
1076 | inline int compare_exchange(volatile int * dest, int exchange, int comparand)
|
---|
1077 | #endif // !CL_HPP_CPP11_ATOMICS_SUPPORTED
|
---|
1078 | {
|
---|
1079 | #ifdef CL_HPP_CPP11_ATOMICS_SUPPORTED
|
---|
1080 | std::atomic_compare_exchange_strong(dest, &comparand, exchange);
|
---|
1081 | return comparand;
|
---|
1082 | #elif _MSC_VER
|
---|
1083 | return (int)(_InterlockedCompareExchange(
|
---|
1084 | (volatile long*)dest,
|
---|
1085 | (long)exchange,
|
---|
1086 | (long)comparand));
|
---|
1087 | #else // !_MSC_VER && !CL_HPP_CPP11_ATOMICS_SUPPORTED
|
---|
1088 | return (__sync_val_compare_and_swap(
|
---|
1089 | dest,
|
---|
1090 | comparand,
|
---|
1091 | exchange));
|
---|
1092 | #endif // !CL_HPP_CPP11_ATOMICS_SUPPORTED
|
---|
1093 | }
|
---|
1094 |
|
---|
1095 | inline void fence() {
|
---|
1096 | #ifdef CL_HPP_CPP11_ATOMICS_SUPPORTED
|
---|
1097 | std::atomic_thread_fence(std::memory_order_seq_cst);
|
---|
1098 | #elif _MSC_VER // !CL_HPP_CPP11_ATOMICS_SUPPORTED
|
---|
1099 | _ReadWriteBarrier();
|
---|
1100 | #else // !_MSC_VER && !CL_HPP_CPP11_ATOMICS_SUPPORTED
|
---|
1101 | __sync_synchronize();
|
---|
1102 | #endif // !CL_HPP_CPP11_ATOMICS_SUPPORTED
|
---|
1103 | }
|
---|
1104 | } // namespace detail
|
---|
1105 |
|
---|
1106 |
|
---|
1107 | /*! \brief class used to interface between C++ and
|
---|
1108 | * OpenCL C calls that require arrays of size_t values, whose
|
---|
1109 | * size is known statically.
|
---|
1110 | */
|
---|
1111 | template <int N>
|
---|
1112 | class size_t
|
---|
1113 | {
|
---|
1114 | private:
|
---|
1115 | ::size_t data_[N];
|
---|
1116 |
|
---|
1117 | public:
|
---|
1118 | //! \brief Initialize size_t to all 0s
|
---|
1119 | size_t()
|
---|
1120 | {
|
---|
1121 | for( int i = 0; i < N; ++i ) {
|
---|
1122 | data_[i] = 0;
|
---|
1123 | }
|
---|
1124 | }
|
---|
1125 |
|
---|
1126 | ::size_t& operator[](int index)
|
---|
1127 | {
|
---|
1128 | return data_[index];
|
---|
1129 | }
|
---|
1130 |
|
---|
1131 | const ::size_t& operator[](int index) const
|
---|
1132 | {
|
---|
1133 | return data_[index];
|
---|
1134 | }
|
---|
1135 |
|
---|
1136 | //! \brief Conversion operator to T*.
|
---|
1137 | operator ::size_t* () { return data_; }
|
---|
1138 |
|
---|
1139 | //! \brief Conversion operator to const T*.
|
---|
1140 | operator const ::size_t* () const { return data_; }
|
---|
1141 | };
|
---|
1142 |
|
---|
1143 | namespace detail {
|
---|
1144 |
|
---|
1145 | // Generic getInfoHelper. The final parameter is used to guide overload
|
---|
1146 | // resolution: the actual parameter passed is an int, which makes this
|
---|
1147 | // a worse conversion sequence than a specialization that declares the
|
---|
1148 | // parameter as an int.
|
---|
1149 | template<typename Functor, typename T>
|
---|
1150 | inline cl_int getInfoHelper(Functor f, cl_uint name, T* param, long)
|
---|
1151 | {
|
---|
1152 | return f(name, sizeof(T), param, NULL);
|
---|
1153 | }
|
---|
1154 |
|
---|
1155 | // Specialized getInfoHelper for VECTOR_CLASS params
|
---|
1156 | template <typename Func, typename T>
|
---|
1157 | inline cl_int getInfoHelper(Func f, cl_uint name, VECTOR_CLASS<T>* param, long)
|
---|
1158 | {
|
---|
1159 | ::size_t required;
|
---|
1160 | cl_int err = f(name, 0, NULL, &required);
|
---|
1161 | if (err != CL_SUCCESS) {
|
---|
1162 | return err;
|
---|
1163 | }
|
---|
1164 |
|
---|
1165 | T* value = (T*) alloca(required);
|
---|
1166 | err = f(name, required, value, NULL);
|
---|
1167 | if (err != CL_SUCCESS) {
|
---|
1168 | return err;
|
---|
1169 | }
|
---|
1170 |
|
---|
1171 | param->assign(&value[0], &value[required/sizeof(T)]);
|
---|
1172 | return CL_SUCCESS;
|
---|
1173 | }
|
---|
1174 |
|
---|
1175 | /* Specialization for reference-counted types. This depends on the
|
---|
1176 | * existence of Wrapper<T>::cl_type, and none of the other types having the
|
---|
1177 | * cl_type member. Note that simplify specifying the parameter as Wrapper<T>
|
---|
1178 | * does not work, because when using a derived type (e.g. Context) the generic
|
---|
1179 | * template will provide a better match.
|
---|
1180 | */
|
---|
1181 | template <typename Func, typename T>
|
---|
1182 | inline cl_int getInfoHelper(Func f, cl_uint name, VECTOR_CLASS<T>* param, int, typename T::cl_type = 0)
|
---|
1183 | {
|
---|
1184 | ::size_t required;
|
---|
1185 | cl_int err = f(name, 0, NULL, &required);
|
---|
1186 | if (err != CL_SUCCESS) {
|
---|
1187 | return err;
|
---|
1188 | }
|
---|
1189 |
|
---|
1190 | typename T::cl_type * value = (typename T::cl_type *) alloca(required);
|
---|
1191 | err = f(name, required, value, NULL);
|
---|
1192 | if (err != CL_SUCCESS) {
|
---|
1193 | return err;
|
---|
1194 | }
|
---|
1195 |
|
---|
1196 | ::size_t elements = required / sizeof(typename T::cl_type);
|
---|
1197 | param->assign(&value[0], &value[elements]);
|
---|
1198 | for (::size_t i = 0; i < elements; i++)
|
---|
1199 | {
|
---|
1200 | if (value[i] != NULL)
|
---|
1201 | {
|
---|
1202 | err = (*param)[i].retain();
|
---|
1203 | if (err != CL_SUCCESS) {
|
---|
1204 | return err;
|
---|
1205 | }
|
---|
1206 | }
|
---|
1207 | }
|
---|
1208 | return CL_SUCCESS;
|
---|
1209 | }
|
---|
1210 |
|
---|
1211 | // Specialized for getInfo<CL_PROGRAM_BINARIES>
|
---|
1212 | template <typename Func>
|
---|
1213 | inline cl_int getInfoHelper(Func f, cl_uint name, VECTOR_CLASS<char *>* param, int)
|
---|
1214 | {
|
---|
1215 | cl_int err = f(name, param->size() * sizeof(char *), &(*param)[0], NULL);
|
---|
1216 |
|
---|
1217 | if (err != CL_SUCCESS) {
|
---|
1218 | return err;
|
---|
1219 | }
|
---|
1220 |
|
---|
1221 | return CL_SUCCESS;
|
---|
1222 | }
|
---|
1223 |
|
---|
1224 | // Specialized GetInfoHelper for STRING_CLASS params
|
---|
1225 | template <typename Func>
|
---|
1226 | inline cl_int getInfoHelper(Func f, cl_uint name, STRING_CLASS* param, long)
|
---|
1227 | {
|
---|
1228 | #if defined(__NO_STD_VECTOR) || defined(__NO_STD_STRING)
|
---|
1229 | ::size_t required;
|
---|
1230 | cl_int err = f(name, 0, NULL, &required);
|
---|
1231 | if (err != CL_SUCCESS) {
|
---|
1232 | return err;
|
---|
1233 | }
|
---|
1234 |
|
---|
1235 | char* value = (char*)alloca(required);
|
---|
1236 | err = f(name, required, value, NULL);
|
---|
1237 | if (err != CL_SUCCESS) {
|
---|
1238 | return err;
|
---|
1239 | }
|
---|
1240 |
|
---|
1241 | *param = value;
|
---|
1242 | return CL_SUCCESS;
|
---|
1243 | #else
|
---|
1244 | ::size_t required;
|
---|
1245 | cl_int err = f(name, 0, NULL, &required);
|
---|
1246 | if (err != CL_SUCCESS) {
|
---|
1247 | return err;
|
---|
1248 | }
|
---|
1249 |
|
---|
1250 | if (required > 0) {
|
---|
1251 | // std::string has a constant data member
|
---|
1252 | // a char vector does not
|
---|
1253 | VECTOR_CLASS<char> value(required);
|
---|
1254 | err = f(name, required, value.data(), NULL);
|
---|
1255 | if (err != CL_SUCCESS) {
|
---|
1256 | return err;
|
---|
1257 | }
|
---|
1258 | if (param) {
|
---|
1259 | param->assign(value.begin(), value.end() - 1u);
|
---|
1260 | }
|
---|
1261 | }
|
---|
1262 | else if (param) {
|
---|
1263 | param->assign("");
|
---|
1264 | }
|
---|
1265 | #endif
|
---|
1266 | return CL_SUCCESS;
|
---|
1267 | }
|
---|
1268 |
|
---|
1269 | // Specialized GetInfoHelper for cl::size_t params
|
---|
1270 | template <typename Func, ::size_t N>
|
---|
1271 | inline cl_int getInfoHelper(Func f, cl_uint name, size_t<N>* param, long)
|
---|
1272 | {
|
---|
1273 | ::size_t required;
|
---|
1274 | cl_int err = f(name, 0, NULL, &required);
|
---|
1275 | if (err != CL_SUCCESS) {
|
---|
1276 | return err;
|
---|
1277 | }
|
---|
1278 |
|
---|
1279 | ::size_t* value = (::size_t*) alloca(required);
|
---|
1280 | err = f(name, required, value, NULL);
|
---|
1281 | if (err != CL_SUCCESS) {
|
---|
1282 | return err;
|
---|
1283 | }
|
---|
1284 |
|
---|
1285 | for(int i = 0; i < N; ++i) {
|
---|
1286 | (*param)[i] = value[i];
|
---|
1287 | }
|
---|
1288 |
|
---|
1289 | return CL_SUCCESS;
|
---|
1290 | }
|
---|
1291 |
|
---|
1292 | template<typename T> struct ReferenceHandler;
|
---|
1293 |
|
---|
1294 | /* Specialization for reference-counted types. This depends on the
|
---|
1295 | * existence of Wrapper<T>::cl_type, and none of the other types having the
|
---|
1296 | * cl_type member. Note that simplify specifying the parameter as Wrapper<T>
|
---|
1297 | * does not work, because when using a derived type (e.g. Context) the generic
|
---|
1298 | * template will provide a better match.
|
---|
1299 | */
|
---|
1300 | template<typename Func, typename T>
|
---|
1301 | inline cl_int getInfoHelper(Func f, cl_uint name, T* param, int, typename T::cl_type = 0)
|
---|
1302 | {
|
---|
1303 | typename T::cl_type value;
|
---|
1304 | cl_int err = f(name, sizeof(value), &value, NULL);
|
---|
1305 | if (err != CL_SUCCESS) {
|
---|
1306 | return err;
|
---|
1307 | }
|
---|
1308 | *param = value;
|
---|
1309 | if (value != NULL)
|
---|
1310 | {
|
---|
1311 | err = param->retain();
|
---|
1312 | if (err != CL_SUCCESS) {
|
---|
1313 | return err;
|
---|
1314 | }
|
---|
1315 | }
|
---|
1316 | return CL_SUCCESS;
|
---|
1317 | }
|
---|
1318 |
|
---|
1319 | #define __PARAM_NAME_INFO_1_0(F) \
|
---|
1320 | F(cl_platform_info, CL_PLATFORM_PROFILE, STRING_CLASS) \
|
---|
1321 | F(cl_platform_info, CL_PLATFORM_VERSION, STRING_CLASS) \
|
---|
1322 | F(cl_platform_info, CL_PLATFORM_NAME, STRING_CLASS) \
|
---|
1323 | F(cl_platform_info, CL_PLATFORM_VENDOR, STRING_CLASS) \
|
---|
1324 | F(cl_platform_info, CL_PLATFORM_EXTENSIONS, STRING_CLASS) \
|
---|
1325 | \
|
---|
1326 | F(cl_device_info, CL_DEVICE_TYPE, cl_device_type) \
|
---|
1327 | F(cl_device_info, CL_DEVICE_VENDOR_ID, cl_uint) \
|
---|
1328 | F(cl_device_info, CL_DEVICE_MAX_COMPUTE_UNITS, cl_uint) \
|
---|
1329 | F(cl_device_info, CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS, cl_uint) \
|
---|
1330 | F(cl_device_info, CL_DEVICE_MAX_WORK_GROUP_SIZE, ::size_t) \
|
---|
1331 | F(cl_device_info, CL_DEVICE_MAX_WORK_ITEM_SIZES, VECTOR_CLASS< ::size_t>) \
|
---|
1332 | F(cl_device_info, CL_DEVICE_PREFERRED_VECTOR_WIDTH_CHAR, cl_uint) \
|
---|
1333 | F(cl_device_info, CL_DEVICE_PREFERRED_VECTOR_WIDTH_SHORT, cl_uint) \
|
---|
1334 | F(cl_device_info, CL_DEVICE_PREFERRED_VECTOR_WIDTH_INT, cl_uint) \
|
---|
1335 | F(cl_device_info, CL_DEVICE_PREFERRED_VECTOR_WIDTH_LONG, cl_uint) \
|
---|
1336 | F(cl_device_info, CL_DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT, cl_uint) \
|
---|
1337 | F(cl_device_info, CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE, cl_uint) \
|
---|
1338 | F(cl_device_info, CL_DEVICE_MAX_CLOCK_FREQUENCY, cl_uint) \
|
---|
1339 | F(cl_device_info, CL_DEVICE_ADDRESS_BITS, cl_uint) \
|
---|
1340 | F(cl_device_info, CL_DEVICE_MAX_READ_IMAGE_ARGS, cl_uint) \
|
---|
1341 | F(cl_device_info, CL_DEVICE_MAX_WRITE_IMAGE_ARGS, cl_uint) \
|
---|
1342 | F(cl_device_info, CL_DEVICE_MAX_MEM_ALLOC_SIZE, cl_ulong) \
|
---|
1343 | F(cl_device_info, CL_DEVICE_IMAGE2D_MAX_WIDTH, ::size_t) \
|
---|
1344 | F(cl_device_info, CL_DEVICE_IMAGE2D_MAX_HEIGHT, ::size_t) \
|
---|
1345 | F(cl_device_info, CL_DEVICE_IMAGE3D_MAX_WIDTH, ::size_t) \
|
---|
1346 | F(cl_device_info, CL_DEVICE_IMAGE3D_MAX_HEIGHT, ::size_t) \
|
---|
1347 | F(cl_device_info, CL_DEVICE_IMAGE3D_MAX_DEPTH, ::size_t) \
|
---|
1348 | F(cl_device_info, CL_DEVICE_IMAGE_SUPPORT, cl_bool) \
|
---|
1349 | F(cl_device_info, CL_DEVICE_MAX_PARAMETER_SIZE, ::size_t) \
|
---|
1350 | F(cl_device_info, CL_DEVICE_MAX_SAMPLERS, cl_uint) \
|
---|
1351 | F(cl_device_info, CL_DEVICE_MEM_BASE_ADDR_ALIGN, cl_uint) \
|
---|
1352 | F(cl_device_info, CL_DEVICE_MIN_DATA_TYPE_ALIGN_SIZE, cl_uint) \
|
---|
1353 | F(cl_device_info, CL_DEVICE_SINGLE_FP_CONFIG, cl_device_fp_config) \
|
---|
1354 | F(cl_device_info, CL_DEVICE_DOUBLE_FP_CONFIG, cl_device_fp_config) \
|
---|
1355 | F(cl_device_info, CL_DEVICE_HALF_FP_CONFIG, cl_device_fp_config) \
|
---|
1356 | F(cl_device_info, CL_DEVICE_GLOBAL_MEM_CACHE_TYPE, cl_device_mem_cache_type) \
|
---|
1357 | F(cl_device_info, CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE, cl_uint)\
|
---|
1358 | F(cl_device_info, CL_DEVICE_GLOBAL_MEM_CACHE_SIZE, cl_ulong) \
|
---|
1359 | F(cl_device_info, CL_DEVICE_GLOBAL_MEM_SIZE, cl_ulong) \
|
---|
1360 | F(cl_device_info, CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE, cl_ulong) \
|
---|
1361 | F(cl_device_info, CL_DEVICE_MAX_CONSTANT_ARGS, cl_uint) \
|
---|
1362 | F(cl_device_info, CL_DEVICE_LOCAL_MEM_TYPE, cl_device_local_mem_type) \
|
---|
1363 | F(cl_device_info, CL_DEVICE_LOCAL_MEM_SIZE, cl_ulong) \
|
---|
1364 | F(cl_device_info, CL_DEVICE_ERROR_CORRECTION_SUPPORT, cl_bool) \
|
---|
1365 | F(cl_device_info, CL_DEVICE_PROFILING_TIMER_RESOLUTION, ::size_t) \
|
---|
1366 | F(cl_device_info, CL_DEVICE_ENDIAN_LITTLE, cl_bool) \
|
---|
1367 | F(cl_device_info, CL_DEVICE_AVAILABLE, cl_bool) \
|
---|
1368 | F(cl_device_info, CL_DEVICE_COMPILER_AVAILABLE, cl_bool) \
|
---|
1369 | F(cl_device_info, CL_DEVICE_EXECUTION_CAPABILITIES, cl_device_exec_capabilities) \
|
---|
1370 | F(cl_device_info, CL_DEVICE_QUEUE_PROPERTIES, cl_command_queue_properties) \
|
---|
1371 | F(cl_device_info, CL_DEVICE_PLATFORM, cl_platform_id) \
|
---|
1372 | F(cl_device_info, CL_DEVICE_NAME, STRING_CLASS) \
|
---|
1373 | F(cl_device_info, CL_DEVICE_VENDOR, STRING_CLASS) \
|
---|
1374 | F(cl_device_info, CL_DRIVER_VERSION, STRING_CLASS) \
|
---|
1375 | F(cl_device_info, CL_DEVICE_PROFILE, STRING_CLASS) \
|
---|
1376 | F(cl_device_info, CL_DEVICE_VERSION, STRING_CLASS) \
|
---|
1377 | F(cl_device_info, CL_DEVICE_EXTENSIONS, STRING_CLASS) \
|
---|
1378 | \
|
---|
1379 | F(cl_context_info, CL_CONTEXT_REFERENCE_COUNT, cl_uint) \
|
---|
1380 | F(cl_context_info, CL_CONTEXT_DEVICES, VECTOR_CLASS<Device>) \
|
---|
1381 | F(cl_context_info, CL_CONTEXT_PROPERTIES, VECTOR_CLASS<cl_context_properties>) \
|
---|
1382 | \
|
---|
1383 | F(cl_event_info, CL_EVENT_COMMAND_QUEUE, cl::CommandQueue) \
|
---|
1384 | F(cl_event_info, CL_EVENT_COMMAND_TYPE, cl_command_type) \
|
---|
1385 | F(cl_event_info, CL_EVENT_REFERENCE_COUNT, cl_uint) \
|
---|
1386 | F(cl_event_info, CL_EVENT_COMMAND_EXECUTION_STATUS, cl_int) \
|
---|
1387 | \
|
---|
1388 | F(cl_profiling_info, CL_PROFILING_COMMAND_QUEUED, cl_ulong) \
|
---|
1389 | F(cl_profiling_info, CL_PROFILING_COMMAND_SUBMIT, cl_ulong) \
|
---|
1390 | F(cl_profiling_info, CL_PROFILING_COMMAND_START, cl_ulong) \
|
---|
1391 | F(cl_profiling_info, CL_PROFILING_COMMAND_END, cl_ulong) \
|
---|
1392 | \
|
---|
1393 | F(cl_mem_info, CL_MEM_TYPE, cl_mem_object_type) \
|
---|
1394 | F(cl_mem_info, CL_MEM_FLAGS, cl_mem_flags) \
|
---|
1395 | F(cl_mem_info, CL_MEM_SIZE, ::size_t) \
|
---|
1396 | F(cl_mem_info, CL_MEM_HOST_PTR, void*) \
|
---|
1397 | F(cl_mem_info, CL_MEM_MAP_COUNT, cl_uint) \
|
---|
1398 | F(cl_mem_info, CL_MEM_REFERENCE_COUNT, cl_uint) \
|
---|
1399 | F(cl_mem_info, CL_MEM_CONTEXT, cl::Context) \
|
---|
1400 | \
|
---|
1401 | F(cl_image_info, CL_IMAGE_FORMAT, cl_image_format) \
|
---|
1402 | F(cl_image_info, CL_IMAGE_ELEMENT_SIZE, ::size_t) \
|
---|
1403 | F(cl_image_info, CL_IMAGE_ROW_PITCH, ::size_t) \
|
---|
1404 | F(cl_image_info, CL_IMAGE_SLICE_PITCH, ::size_t) \
|
---|
1405 | F(cl_image_info, CL_IMAGE_WIDTH, ::size_t) \
|
---|
1406 | F(cl_image_info, CL_IMAGE_HEIGHT, ::size_t) \
|
---|
1407 | F(cl_image_info, CL_IMAGE_DEPTH, ::size_t) \
|
---|
1408 | \
|
---|
1409 | F(cl_sampler_info, CL_SAMPLER_REFERENCE_COUNT, cl_uint) \
|
---|
1410 | F(cl_sampler_info, CL_SAMPLER_CONTEXT, cl::Context) \
|
---|
1411 | F(cl_sampler_info, CL_SAMPLER_NORMALIZED_COORDS, cl_bool) \
|
---|
1412 | F(cl_sampler_info, CL_SAMPLER_ADDRESSING_MODE, cl_addressing_mode) \
|
---|
1413 | F(cl_sampler_info, CL_SAMPLER_FILTER_MODE, cl_filter_mode) \
|
---|
1414 | \
|
---|
1415 | F(cl_program_info, CL_PROGRAM_REFERENCE_COUNT, cl_uint) \
|
---|
1416 | F(cl_program_info, CL_PROGRAM_CONTEXT, cl::Context) \
|
---|
1417 | F(cl_program_info, CL_PROGRAM_NUM_DEVICES, cl_uint) \
|
---|
1418 | F(cl_program_info, CL_PROGRAM_DEVICES, VECTOR_CLASS<Device>) \
|
---|
1419 | F(cl_program_info, CL_PROGRAM_SOURCE, STRING_CLASS) \
|
---|
1420 | F(cl_program_info, CL_PROGRAM_BINARY_SIZES, VECTOR_CLASS< ::size_t>) \
|
---|
1421 | F(cl_program_info, CL_PROGRAM_BINARIES, VECTOR_CLASS<char *>) \
|
---|
1422 | \
|
---|
1423 | F(cl_program_build_info, CL_PROGRAM_BUILD_STATUS, cl_build_status) \
|
---|
1424 | F(cl_program_build_info, CL_PROGRAM_BUILD_OPTIONS, STRING_CLASS) \
|
---|
1425 | F(cl_program_build_info, CL_PROGRAM_BUILD_LOG, STRING_CLASS) \
|
---|
1426 | \
|
---|
1427 | F(cl_kernel_info, CL_KERNEL_FUNCTION_NAME, STRING_CLASS) \
|
---|
1428 | F(cl_kernel_info, CL_KERNEL_NUM_ARGS, cl_uint) \
|
---|
1429 | F(cl_kernel_info, CL_KERNEL_REFERENCE_COUNT, cl_uint) \
|
---|
1430 | F(cl_kernel_info, CL_KERNEL_CONTEXT, cl::Context) \
|
---|
1431 | F(cl_kernel_info, CL_KERNEL_PROGRAM, cl::Program) \
|
---|
1432 | \
|
---|
1433 | F(cl_kernel_work_group_info, CL_KERNEL_WORK_GROUP_SIZE, ::size_t) \
|
---|
1434 | F(cl_kernel_work_group_info, CL_KERNEL_COMPILE_WORK_GROUP_SIZE, cl::size_t<3>) \
|
---|
1435 | F(cl_kernel_work_group_info, CL_KERNEL_LOCAL_MEM_SIZE, cl_ulong) \
|
---|
1436 | \
|
---|
1437 | F(cl_command_queue_info, CL_QUEUE_CONTEXT, cl::Context) \
|
---|
1438 | F(cl_command_queue_info, CL_QUEUE_DEVICE, cl::Device) \
|
---|
1439 | F(cl_command_queue_info, CL_QUEUE_REFERENCE_COUNT, cl_uint) \
|
---|
1440 | F(cl_command_queue_info, CL_QUEUE_PROPERTIES, cl_command_queue_properties)
|
---|
1441 |
|
---|
1442 | #if defined(CL_VERSION_1_1)
|
---|
1443 | #define __PARAM_NAME_INFO_1_1(F) \
|
---|
1444 | F(cl_context_info, CL_CONTEXT_NUM_DEVICES, cl_uint)\
|
---|
1445 | F(cl_device_info, CL_DEVICE_PREFERRED_VECTOR_WIDTH_HALF, cl_uint) \
|
---|
1446 | F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_CHAR, cl_uint) \
|
---|
1447 | F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_SHORT, cl_uint) \
|
---|
1448 | F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_INT, cl_uint) \
|
---|
1449 | F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG, cl_uint) \
|
---|
1450 | F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_FLOAT, cl_uint) \
|
---|
1451 | F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE, cl_uint) \
|
---|
1452 | F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_HALF, cl_uint) \
|
---|
1453 | F(cl_device_info, CL_DEVICE_HOST_UNIFIED_MEMORY, cl_bool) \
|
---|
1454 | F(cl_device_info, CL_DEVICE_OPENCL_C_VERSION, STRING_CLASS) \
|
---|
1455 | \
|
---|
1456 | F(cl_mem_info, CL_MEM_ASSOCIATED_MEMOBJECT, cl::Memory) \
|
---|
1457 | F(cl_mem_info, CL_MEM_OFFSET, ::size_t) \
|
---|
1458 | \
|
---|
1459 | F(cl_kernel_work_group_info, CL_KERNEL_PREFERRED_WORK_GROUP_SIZE_MULTIPLE, ::size_t) \
|
---|
1460 | F(cl_kernel_work_group_info, CL_KERNEL_PRIVATE_MEM_SIZE, cl_ulong) \
|
---|
1461 | \
|
---|
1462 | F(cl_event_info, CL_EVENT_CONTEXT, cl::Context)
|
---|
1463 | #endif // CL_VERSION_1_1
|
---|
1464 |
|
---|
1465 |
|
---|
1466 | #if defined(CL_VERSION_1_2)
|
---|
1467 | #define __PARAM_NAME_INFO_1_2(F) \
|
---|
1468 | F(cl_image_info, CL_IMAGE_ARRAY_SIZE, ::size_t) \
|
---|
1469 | F(cl_image_info, CL_IMAGE_BUFFER, cl::Buffer) \
|
---|
1470 | F(cl_image_info, CL_IMAGE_NUM_MIP_LEVELS, cl_uint) \
|
---|
1471 | F(cl_image_info, CL_IMAGE_NUM_SAMPLES, cl_uint) \
|
---|
1472 | \
|
---|
1473 | F(cl_program_info, CL_PROGRAM_NUM_KERNELS, ::size_t) \
|
---|
1474 | F(cl_program_info, CL_PROGRAM_KERNEL_NAMES, STRING_CLASS) \
|
---|
1475 | \
|
---|
1476 | F(cl_program_build_info, CL_PROGRAM_BINARY_TYPE, cl_program_binary_type) \
|
---|
1477 | \
|
---|
1478 | F(cl_kernel_info, CL_KERNEL_ATTRIBUTES, STRING_CLASS) \
|
---|
1479 | \
|
---|
1480 | F(cl_kernel_arg_info, CL_KERNEL_ARG_ADDRESS_QUALIFIER, cl_kernel_arg_address_qualifier) \
|
---|
1481 | F(cl_kernel_arg_info, CL_KERNEL_ARG_ACCESS_QUALIFIER, cl_kernel_arg_access_qualifier) \
|
---|
1482 | F(cl_kernel_arg_info, CL_KERNEL_ARG_TYPE_NAME, STRING_CLASS) \
|
---|
1483 | F(cl_kernel_arg_info, CL_KERNEL_ARG_TYPE_QUALIFIER, cl_kernel_arg_type_qualifier) \
|
---|
1484 | F(cl_kernel_arg_info, CL_KERNEL_ARG_NAME, STRING_CLASS) \
|
---|
1485 | \
|
---|
1486 | F(cl_device_info, CL_DEVICE_IMAGE_MAX_BUFFER_SIZE, ::size_t) \
|
---|
1487 | F(cl_device_info, CL_DEVICE_IMAGE_MAX_ARRAY_SIZE, ::size_t) \
|
---|
1488 | F(cl_device_info, CL_DEVICE_LINKER_AVAILABLE, cl_bool) \
|
---|
1489 | F(cl_device_info, CL_DEVICE_BUILT_IN_KERNELS, STRING_CLASS) \
|
---|
1490 | F(cl_device_info, CL_DEVICE_PRINTF_BUFFER_SIZE, ::size_t) \
|
---|
1491 | F(cl_device_info, CL_DEVICE_PREFERRED_INTEROP_USER_SYNC, cl_bool) \
|
---|
1492 | F(cl_device_info, CL_DEVICE_PARENT_DEVICE, cl_device_id) \
|
---|
1493 | F(cl_device_info, CL_DEVICE_PARTITION_MAX_SUB_DEVICES, cl_uint) \
|
---|
1494 | F(cl_device_info, CL_DEVICE_PARTITION_PROPERTIES, VECTOR_CLASS<cl_device_partition_property>) \
|
---|
1495 | F(cl_device_info, CL_DEVICE_PARTITION_AFFINITY_DOMAIN, cl_device_affinity_domain) \
|
---|
1496 | F(cl_device_info, CL_DEVICE_PARTITION_TYPE, VECTOR_CLASS<cl_device_partition_property>) \
|
---|
1497 | F(cl_device_info, CL_DEVICE_REFERENCE_COUNT, cl_uint)
|
---|
1498 | #endif // #if defined(CL_VERSION_1_2)
|
---|
1499 |
|
---|
1500 | #if defined(USE_CL_DEVICE_FISSION)
|
---|
1501 | #define __PARAM_NAME_DEVICE_FISSION(F) \
|
---|
1502 | F(cl_device_info, CL_DEVICE_PARENT_DEVICE_EXT, cl_device_id) \
|
---|
1503 | F(cl_device_info, CL_DEVICE_PARTITION_TYPES_EXT, VECTOR_CLASS<cl_device_partition_property_ext>) \
|
---|
1504 | F(cl_device_info, CL_DEVICE_AFFINITY_DOMAINS_EXT, VECTOR_CLASS<cl_device_partition_property_ext>) \
|
---|
1505 | F(cl_device_info, CL_DEVICE_REFERENCE_COUNT_EXT , cl_uint) \
|
---|
1506 | F(cl_device_info, CL_DEVICE_PARTITION_STYLE_EXT, VECTOR_CLASS<cl_device_partition_property_ext>)
|
---|
1507 | #endif // USE_CL_DEVICE_FISSION
|
---|
1508 |
|
---|
1509 | template <typename enum_type, cl_int Name>
|
---|
1510 | struct param_traits {};
|
---|
1511 |
|
---|
1512 | #define __CL_DECLARE_PARAM_TRAITS(token, param_name, T) \
|
---|
1513 | struct token; \
|
---|
1514 | template<> \
|
---|
1515 | struct param_traits<detail:: token,param_name> \
|
---|
1516 | { \
|
---|
1517 | enum { value = param_name }; \
|
---|
1518 | typedef T param_type; \
|
---|
1519 | };
|
---|
1520 |
|
---|
1521 | __PARAM_NAME_INFO_1_0(__CL_DECLARE_PARAM_TRAITS)
|
---|
1522 | #if defined(CL_VERSION_1_1)
|
---|
1523 | __PARAM_NAME_INFO_1_1(__CL_DECLARE_PARAM_TRAITS)
|
---|
1524 | #endif // CL_VERSION_1_1
|
---|
1525 | #if defined(CL_VERSION_1_2)
|
---|
1526 | __PARAM_NAME_INFO_1_2(__CL_DECLARE_PARAM_TRAITS)
|
---|
1527 | #endif // CL_VERSION_1_1
|
---|
1528 |
|
---|
1529 | #if defined(USE_CL_DEVICE_FISSION)
|
---|
1530 | __PARAM_NAME_DEVICE_FISSION(__CL_DECLARE_PARAM_TRAITS);
|
---|
1531 | #endif // USE_CL_DEVICE_FISSION
|
---|
1532 |
|
---|
1533 | #ifdef CL_PLATFORM_ICD_SUFFIX_KHR
|
---|
1534 | __CL_DECLARE_PARAM_TRAITS(cl_platform_info, CL_PLATFORM_ICD_SUFFIX_KHR, STRING_CLASS)
|
---|
1535 | #endif
|
---|
1536 |
|
---|
1537 | #ifdef CL_DEVICE_PROFILING_TIMER_OFFSET_AMD
|
---|
1538 | __CL_DECLARE_PARAM_TRAITS(cl_device_info, CL_DEVICE_PROFILING_TIMER_OFFSET_AMD, cl_ulong)
|
---|
1539 | #endif
|
---|
1540 |
|
---|
1541 | #ifdef CL_DEVICE_GLOBAL_FREE_MEMORY_AMD
|
---|
1542 | __CL_DECLARE_PARAM_TRAITS(cl_device_info, CL_DEVICE_GLOBAL_FREE_MEMORY_AMD, VECTOR_CLASS< ::size_t>)
|
---|
1543 | #endif
|
---|
1544 | #ifdef CL_DEVICE_SIMD_PER_COMPUTE_UNIT_AMD
|
---|
1545 | __CL_DECLARE_PARAM_TRAITS(cl_device_info, CL_DEVICE_SIMD_PER_COMPUTE_UNIT_AMD, cl_uint)
|
---|
1546 | #endif
|
---|
1547 | #ifdef CL_DEVICE_SIMD_WIDTH_AMD
|
---|
1548 | __CL_DECLARE_PARAM_TRAITS(cl_device_info, CL_DEVICE_SIMD_WIDTH_AMD, cl_uint)
|
---|
1549 | #endif
|
---|
1550 | #ifdef CL_DEVICE_SIMD_INSTRUCTION_WIDTH_AMD
|
---|
1551 | __CL_DECLARE_PARAM_TRAITS(cl_device_info, CL_DEVICE_SIMD_INSTRUCTION_WIDTH_AMD, cl_uint)
|
---|
1552 | #endif
|
---|
1553 | #ifdef CL_DEVICE_WAVEFRONT_WIDTH_AMD
|
---|
1554 | __CL_DECLARE_PARAM_TRAITS(cl_device_info, CL_DEVICE_WAVEFRONT_WIDTH_AMD, cl_uint)
|
---|
1555 | #endif
|
---|
1556 | #ifdef CL_DEVICE_GLOBAL_MEM_CHANNELS_AMD
|
---|
1557 | __CL_DECLARE_PARAM_TRAITS(cl_device_info, CL_DEVICE_GLOBAL_MEM_CHANNELS_AMD, cl_uint)
|
---|
1558 | #endif
|
---|
1559 | #ifdef CL_DEVICE_GLOBAL_MEM_CHANNEL_BANKS_AMD
|
---|
1560 | __CL_DECLARE_PARAM_TRAITS(cl_device_info, CL_DEVICE_GLOBAL_MEM_CHANNEL_BANKS_AMD, cl_uint)
|
---|
1561 | #endif
|
---|
1562 | #ifdef CL_DEVICE_GLOBAL_MEM_CHANNEL_BANK_WIDTH_AMD
|
---|
1563 | __CL_DECLARE_PARAM_TRAITS(cl_device_info, CL_DEVICE_GLOBAL_MEM_CHANNEL_BANK_WIDTH_AMD, cl_uint)
|
---|
1564 | #endif
|
---|
1565 | #ifdef CL_DEVICE_LOCAL_MEM_SIZE_PER_COMPUTE_UNIT_AMD
|
---|
1566 | __CL_DECLARE_PARAM_TRAITS(cl_device_info, CL_DEVICE_LOCAL_MEM_SIZE_PER_COMPUTE_UNIT_AMD, cl_uint)
|
---|
1567 | #endif
|
---|
1568 | #ifdef CL_DEVICE_LOCAL_MEM_BANKS_AMD
|
---|
1569 | __CL_DECLARE_PARAM_TRAITS(cl_device_info, CL_DEVICE_LOCAL_MEM_BANKS_AMD, cl_uint)
|
---|
1570 | #endif
|
---|
1571 |
|
---|
1572 | #ifdef CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV
|
---|
1573 | __CL_DECLARE_PARAM_TRAITS(cl_device_info, CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV, cl_uint)
|
---|
1574 | #endif
|
---|
1575 | #ifdef CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV
|
---|
1576 | __CL_DECLARE_PARAM_TRAITS(cl_device_info, CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV, cl_uint)
|
---|
1577 | #endif
|
---|
1578 | #ifdef CL_DEVICE_REGISTERS_PER_BLOCK_NV
|
---|
1579 | __CL_DECLARE_PARAM_TRAITS(cl_device_info, CL_DEVICE_REGISTERS_PER_BLOCK_NV, cl_uint)
|
---|
1580 | #endif
|
---|
1581 | #ifdef CL_DEVICE_WARP_SIZE_NV
|
---|
1582 | __CL_DECLARE_PARAM_TRAITS(cl_device_info, CL_DEVICE_WARP_SIZE_NV, cl_uint)
|
---|
1583 | #endif
|
---|
1584 | #ifdef CL_DEVICE_GPU_OVERLAP_NV
|
---|
1585 | __CL_DECLARE_PARAM_TRAITS(cl_device_info, CL_DEVICE_GPU_OVERLAP_NV, cl_bool)
|
---|
1586 | #endif
|
---|
1587 | #ifdef CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV
|
---|
1588 | __CL_DECLARE_PARAM_TRAITS(cl_device_info, CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV, cl_bool)
|
---|
1589 | #endif
|
---|
1590 | #ifdef CL_DEVICE_INTEGRATED_MEMORY_NV
|
---|
1591 | __CL_DECLARE_PARAM_TRAITS(cl_device_info, CL_DEVICE_INTEGRATED_MEMORY_NV, cl_bool)
|
---|
1592 | #endif
|
---|
1593 |
|
---|
1594 | // Convenience functions
|
---|
1595 |
|
---|
1596 | template <typename Func, typename T>
|
---|
1597 | inline cl_int
|
---|
1598 | getInfo(Func f, cl_uint name, T* param)
|
---|
1599 | {
|
---|
1600 | return getInfoHelper(f, name, param, 0);
|
---|
1601 | }
|
---|
1602 |
|
---|
1603 | template <typename Func, typename Arg0>
|
---|
1604 | struct GetInfoFunctor0
|
---|
1605 | {
|
---|
1606 | Func f_; const Arg0& arg0_;
|
---|
1607 | cl_int operator ()(
|
---|
1608 | cl_uint param, ::size_t size, void* value, ::size_t* size_ret)
|
---|
1609 | { return f_(arg0_, param, size, value, size_ret); }
|
---|
1610 | };
|
---|
1611 |
|
---|
1612 | template <typename Func, typename Arg0, typename Arg1>
|
---|
1613 | struct GetInfoFunctor1
|
---|
1614 | {
|
---|
1615 | Func f_; const Arg0& arg0_; const Arg1& arg1_;
|
---|
1616 | cl_int operator ()(
|
---|
1617 | cl_uint param, ::size_t size, void* value, ::size_t* size_ret)
|
---|
1618 | { return f_(arg0_, arg1_, param, size, value, size_ret); }
|
---|
1619 | };
|
---|
1620 |
|
---|
1621 | template <typename Func, typename Arg0, typename T>
|
---|
1622 | inline cl_int
|
---|
1623 | getInfo(Func f, const Arg0& arg0, cl_uint name, T* param)
|
---|
1624 | {
|
---|
1625 | GetInfoFunctor0<Func, Arg0> f0 = { f, arg0 };
|
---|
1626 | return getInfoHelper(f0, name, param, 0);
|
---|
1627 | }
|
---|
1628 |
|
---|
1629 | template <typename Func, typename Arg0, typename Arg1, typename T>
|
---|
1630 | inline cl_int
|
---|
1631 | getInfo(Func f, const Arg0& arg0, const Arg1& arg1, cl_uint name, T* param)
|
---|
1632 | {
|
---|
1633 | GetInfoFunctor1<Func, Arg0, Arg1> f0 = { f, arg0, arg1 };
|
---|
1634 | return getInfoHelper(f0, name, param, 0);
|
---|
1635 | }
|
---|
1636 |
|
---|
1637 | template<typename T>
|
---|
1638 | struct ReferenceHandler
|
---|
1639 | { };
|
---|
1640 |
|
---|
1641 | #if defined(CL_VERSION_1_2)
|
---|
1642 | /**
|
---|
1643 | * OpenCL 1.2 devices do have retain/release.
|
---|
1644 | */
|
---|
1645 | template <>
|
---|
1646 | struct ReferenceHandler<cl_device_id>
|
---|
1647 | {
|
---|
1648 | /**
|
---|
1649 | * Retain the device.
|
---|
1650 | * \param device A valid device created using createSubDevices
|
---|
1651 | * \return
|
---|
1652 | * CL_SUCCESS if the function executed successfully.
|
---|
1653 | * CL_INVALID_DEVICE if device was not a valid subdevice
|
---|
1654 | * CL_OUT_OF_RESOURCES
|
---|
1655 | * CL_OUT_OF_HOST_MEMORY
|
---|
1656 | */
|
---|
1657 | static cl_int retain(cl_device_id device)
|
---|
1658 | { return ::clRetainDevice(device); }
|
---|
1659 | /**
|
---|
1660 | * Retain the device.
|
---|
1661 | * \param device A valid device created using createSubDevices
|
---|
1662 | * \return
|
---|
1663 | * CL_SUCCESS if the function executed successfully.
|
---|
1664 | * CL_INVALID_DEVICE if device was not a valid subdevice
|
---|
1665 | * CL_OUT_OF_RESOURCES
|
---|
1666 | * CL_OUT_OF_HOST_MEMORY
|
---|
1667 | */
|
---|
1668 | static cl_int release(cl_device_id device)
|
---|
1669 | { return ::clReleaseDevice(device); }
|
---|
1670 | };
|
---|
1671 | #else // #if defined(CL_VERSION_1_2)
|
---|
1672 | /**
|
---|
1673 | * OpenCL 1.1 devices do not have retain/release.
|
---|
1674 | */
|
---|
1675 | template <>
|
---|
1676 | struct ReferenceHandler<cl_device_id>
|
---|
1677 | {
|
---|
1678 | // cl_device_id does not have retain().
|
---|
1679 | static cl_int retain(cl_device_id)
|
---|
1680 | { return CL_SUCCESS; }
|
---|
1681 | // cl_device_id does not have release().
|
---|
1682 | static cl_int release(cl_device_id)
|
---|
1683 | { return CL_SUCCESS; }
|
---|
1684 | };
|
---|
1685 | #endif // #if defined(CL_VERSION_1_2)
|
---|
1686 |
|
---|
1687 | template <>
|
---|
1688 | struct ReferenceHandler<cl_platform_id>
|
---|
1689 | {
|
---|
1690 | // cl_platform_id does not have retain().
|
---|
1691 | static cl_int retain(cl_platform_id)
|
---|
1692 | { return CL_SUCCESS; }
|
---|
1693 | // cl_platform_id does not have release().
|
---|
1694 | static cl_int release(cl_platform_id)
|
---|
1695 | { return CL_SUCCESS; }
|
---|
1696 | };
|
---|
1697 |
|
---|
1698 | template <>
|
---|
1699 | struct ReferenceHandler<cl_context>
|
---|
1700 | {
|
---|
1701 | static cl_int retain(cl_context context)
|
---|
1702 | { return ::clRetainContext(context); }
|
---|
1703 | static cl_int release(cl_context context)
|
---|
1704 | { return ::clReleaseContext(context); }
|
---|
1705 | };
|
---|
1706 |
|
---|
1707 | template <>
|
---|
1708 | struct ReferenceHandler<cl_command_queue>
|
---|
1709 | {
|
---|
1710 | static cl_int retain(cl_command_queue queue)
|
---|
1711 | { return ::clRetainCommandQueue(queue); }
|
---|
1712 | static cl_int release(cl_command_queue queue)
|
---|
1713 | { return ::clReleaseCommandQueue(queue); }
|
---|
1714 | };
|
---|
1715 |
|
---|
1716 | template <>
|
---|
1717 | struct ReferenceHandler<cl_mem>
|
---|
1718 | {
|
---|
1719 | static cl_int retain(cl_mem memory)
|
---|
1720 | { return ::clRetainMemObject(memory); }
|
---|
1721 | static cl_int release(cl_mem memory)
|
---|
1722 | { return ::clReleaseMemObject(memory); }
|
---|
1723 | };
|
---|
1724 |
|
---|
1725 | template <>
|
---|
1726 | struct ReferenceHandler<cl_sampler>
|
---|
1727 | {
|
---|
1728 | static cl_int retain(cl_sampler sampler)
|
---|
1729 | { return ::clRetainSampler(sampler); }
|
---|
1730 | static cl_int release(cl_sampler sampler)
|
---|
1731 | { return ::clReleaseSampler(sampler); }
|
---|
1732 | };
|
---|
1733 |
|
---|
1734 | template <>
|
---|
1735 | struct ReferenceHandler<cl_program>
|
---|
1736 | {
|
---|
1737 | static cl_int retain(cl_program program)
|
---|
1738 | { return ::clRetainProgram(program); }
|
---|
1739 | static cl_int release(cl_program program)
|
---|
1740 | { return ::clReleaseProgram(program); }
|
---|
1741 | };
|
---|
1742 |
|
---|
1743 | template <>
|
---|
1744 | struct ReferenceHandler<cl_kernel>
|
---|
1745 | {
|
---|
1746 | static cl_int retain(cl_kernel kernel)
|
---|
1747 | { return ::clRetainKernel(kernel); }
|
---|
1748 | static cl_int release(cl_kernel kernel)
|
---|
1749 | { return ::clReleaseKernel(kernel); }
|
---|
1750 | };
|
---|
1751 |
|
---|
1752 | template <>
|
---|
1753 | struct ReferenceHandler<cl_event>
|
---|
1754 | {
|
---|
1755 | static cl_int retain(cl_event event)
|
---|
1756 | { return ::clRetainEvent(event); }
|
---|
1757 | static cl_int release(cl_event event)
|
---|
1758 | { return ::clReleaseEvent(event); }
|
---|
1759 | };
|
---|
1760 |
|
---|
1761 |
|
---|
1762 | // Extracts version number with major in the upper 16 bits, minor in the lower 16
|
---|
1763 | static cl_uint getVersion(const char *versionInfo)
|
---|
1764 | {
|
---|
1765 | int highVersion = 0;
|
---|
1766 | int lowVersion = 0;
|
---|
1767 | int index = 7;
|
---|
1768 | while(versionInfo[index] != '.' ) {
|
---|
1769 | highVersion *= 10;
|
---|
1770 | highVersion += versionInfo[index]-'0';
|
---|
1771 | ++index;
|
---|
1772 | }
|
---|
1773 | ++index;
|
---|
1774 | while(versionInfo[index] != ' ' && versionInfo[index] != '\0') {
|
---|
1775 | lowVersion *= 10;
|
---|
1776 | lowVersion += versionInfo[index]-'0';
|
---|
1777 | ++index;
|
---|
1778 | }
|
---|
1779 | return (highVersion << 16) | lowVersion;
|
---|
1780 | }
|
---|
1781 |
|
---|
1782 | static cl_uint getPlatformVersion(cl_platform_id platform)
|
---|
1783 | {
|
---|
1784 | ::size_t size = 0;
|
---|
1785 | clGetPlatformInfo(platform, CL_PLATFORM_VERSION, 0, NULL, &size);
|
---|
1786 | char *versionInfo = (char *) alloca(size);
|
---|
1787 | clGetPlatformInfo(platform, CL_PLATFORM_VERSION, size, &versionInfo[0], &size);
|
---|
1788 | return getVersion(versionInfo);
|
---|
1789 | }
|
---|
1790 |
|
---|
1791 | static cl_uint getDevicePlatformVersion(cl_device_id device)
|
---|
1792 | {
|
---|
1793 | cl_platform_id platform;
|
---|
1794 | clGetDeviceInfo(device, CL_DEVICE_PLATFORM, sizeof(platform), &platform, NULL);
|
---|
1795 | return getPlatformVersion(platform);
|
---|
1796 | }
|
---|
1797 |
|
---|
1798 | #if defined(CL_VERSION_1_2) && defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS)
|
---|
1799 | static cl_uint getContextPlatformVersion(cl_context context)
|
---|
1800 | {
|
---|
1801 | // The platform cannot be queried directly, so we first have to grab a
|
---|
1802 | // device and obtain its context
|
---|
1803 | ::size_t size = 0;
|
---|
1804 | clGetContextInfo(context, CL_CONTEXT_DEVICES, 0, NULL, &size);
|
---|
1805 | if (size == 0)
|
---|
1806 | return 0;
|
---|
1807 | cl_device_id *devices = (cl_device_id *) alloca(size);
|
---|
1808 | clGetContextInfo(context, CL_CONTEXT_DEVICES, size, devices, NULL);
|
---|
1809 | return getDevicePlatformVersion(devices[0]);
|
---|
1810 | }
|
---|
1811 | #endif // #if defined(CL_VERSION_1_2) && defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS)
|
---|
1812 |
|
---|
1813 | template <typename T>
|
---|
1814 | class Wrapper
|
---|
1815 | {
|
---|
1816 | public:
|
---|
1817 | typedef T cl_type;
|
---|
1818 |
|
---|
1819 | protected:
|
---|
1820 | cl_type object_;
|
---|
1821 |
|
---|
1822 | public:
|
---|
1823 | Wrapper() : object_(NULL) { }
|
---|
1824 |
|
---|
1825 | Wrapper(const cl_type &obj) : object_(obj) { }
|
---|
1826 |
|
---|
1827 | ~Wrapper()
|
---|
1828 | {
|
---|
1829 | if (object_ != NULL) { release(); }
|
---|
1830 | }
|
---|
1831 |
|
---|
1832 | Wrapper(const Wrapper<cl_type>& rhs)
|
---|
1833 | {
|
---|
1834 | object_ = rhs.object_;
|
---|
1835 | if (object_ != NULL) { detail::errHandler(retain(), __RETAIN_ERR); }
|
---|
1836 | }
|
---|
1837 |
|
---|
1838 | #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
|
---|
1839 | Wrapper(Wrapper<cl_type>&& rhs) CL_HPP_NOEXCEPT
|
---|
1840 | {
|
---|
1841 | object_ = rhs.object_;
|
---|
1842 | rhs.object_ = NULL;
|
---|
1843 | }
|
---|
1844 | #endif
|
---|
1845 |
|
---|
1846 | Wrapper<cl_type>& operator = (const Wrapper<cl_type>& rhs)
|
---|
1847 | {
|
---|
1848 | if (this != &rhs) {
|
---|
1849 | if (object_ != NULL) { detail::errHandler(release(), __RELEASE_ERR); }
|
---|
1850 | object_ = rhs.object_;
|
---|
1851 | if (object_ != NULL) { detail::errHandler(retain(), __RETAIN_ERR); }
|
---|
1852 | }
|
---|
1853 | return *this;
|
---|
1854 | }
|
---|
1855 |
|
---|
1856 | #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
|
---|
1857 | Wrapper<cl_type>& operator = (Wrapper<cl_type>&& rhs)
|
---|
1858 | {
|
---|
1859 | if (this != &rhs) {
|
---|
1860 | if (object_ != NULL) { detail::errHandler(release(), __RELEASE_ERR); }
|
---|
1861 | object_ = rhs.object_;
|
---|
1862 | rhs.object_ = NULL;
|
---|
1863 | }
|
---|
1864 | return *this;
|
---|
1865 | }
|
---|
1866 | #endif
|
---|
1867 |
|
---|
1868 | Wrapper<cl_type>& operator = (const cl_type &rhs)
|
---|
1869 | {
|
---|
1870 | if (object_ != NULL) { detail::errHandler(release(), __RELEASE_ERR); }
|
---|
1871 | object_ = rhs;
|
---|
1872 | return *this;
|
---|
1873 | }
|
---|
1874 |
|
---|
1875 | cl_type operator ()() const { return object_; }
|
---|
1876 |
|
---|
1877 | cl_type& operator ()() { return object_; }
|
---|
1878 |
|
---|
1879 | protected:
|
---|
1880 | template<typename Func, typename U>
|
---|
1881 | friend inline cl_int getInfoHelper(Func, cl_uint, U*, int, typename U::cl_type);
|
---|
1882 |
|
---|
1883 | cl_int retain() const
|
---|
1884 | {
|
---|
1885 | return ReferenceHandler<cl_type>::retain(object_);
|
---|
1886 | }
|
---|
1887 |
|
---|
1888 | cl_int release() const
|
---|
1889 | {
|
---|
1890 | return ReferenceHandler<cl_type>::release(object_);
|
---|
1891 | }
|
---|
1892 | };
|
---|
1893 |
|
---|
1894 | template <>
|
---|
1895 | class Wrapper<cl_device_id>
|
---|
1896 | {
|
---|
1897 | public:
|
---|
1898 | typedef cl_device_id cl_type;
|
---|
1899 |
|
---|
1900 | protected:
|
---|
1901 | cl_type object_;
|
---|
1902 | bool referenceCountable_;
|
---|
1903 |
|
---|
1904 | static bool isReferenceCountable(cl_device_id device)
|
---|
1905 | {
|
---|
1906 | bool retVal = false;
|
---|
1907 | if (device != NULL) {
|
---|
1908 | int version = getDevicePlatformVersion(device);
|
---|
1909 | if(version > ((1 << 16) + 1)) {
|
---|
1910 | retVal = true;
|
---|
1911 | }
|
---|
1912 | }
|
---|
1913 | return retVal;
|
---|
1914 | }
|
---|
1915 |
|
---|
1916 | public:
|
---|
1917 | Wrapper() : object_(NULL), referenceCountable_(false)
|
---|
1918 | {
|
---|
1919 | }
|
---|
1920 |
|
---|
1921 | Wrapper(const cl_type &obj) : object_(obj), referenceCountable_(false)
|
---|
1922 | {
|
---|
1923 | referenceCountable_ = isReferenceCountable(obj);
|
---|
1924 | }
|
---|
1925 |
|
---|
1926 | ~Wrapper()
|
---|
1927 | {
|
---|
1928 | if (object_ != NULL) { release(); }
|
---|
1929 | }
|
---|
1930 |
|
---|
1931 | Wrapper(const Wrapper<cl_type>& rhs)
|
---|
1932 | {
|
---|
1933 | object_ = rhs.object_;
|
---|
1934 | referenceCountable_ = isReferenceCountable(object_);
|
---|
1935 | if (object_ != NULL) { detail::errHandler(retain(), __RETAIN_ERR); }
|
---|
1936 | }
|
---|
1937 |
|
---|
1938 | #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
|
---|
1939 | Wrapper(Wrapper<cl_type>&& rhs) CL_HPP_NOEXCEPT
|
---|
1940 | {
|
---|
1941 | object_ = rhs.object_;
|
---|
1942 | referenceCountable_ = rhs.referenceCountable_;
|
---|
1943 | rhs.object_ = NULL;
|
---|
1944 | rhs.referenceCountable_ = false;
|
---|
1945 | }
|
---|
1946 | #endif
|
---|
1947 |
|
---|
1948 | Wrapper<cl_type>& operator = (const Wrapper<cl_type>& rhs)
|
---|
1949 | {
|
---|
1950 | if (this != &rhs) {
|
---|
1951 | if (object_ != NULL) { detail::errHandler(release(), __RELEASE_ERR); }
|
---|
1952 | object_ = rhs.object_;
|
---|
1953 | referenceCountable_ = rhs.referenceCountable_;
|
---|
1954 | if (object_ != NULL) { detail::errHandler(retain(), __RETAIN_ERR); }
|
---|
1955 | }
|
---|
1956 | return *this;
|
---|
1957 | }
|
---|
1958 |
|
---|
1959 | #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
|
---|
1960 | Wrapper<cl_type>& operator = (Wrapper<cl_type>&& rhs)
|
---|
1961 | {
|
---|
1962 | if (this != &rhs) {
|
---|
1963 | if (object_ != NULL) { detail::errHandler(release(), __RELEASE_ERR); }
|
---|
1964 | object_ = rhs.object_;
|
---|
1965 | referenceCountable_ = rhs.referenceCountable_;
|
---|
1966 | rhs.object_ = NULL;
|
---|
1967 | rhs.referenceCountable_ = false;
|
---|
1968 | }
|
---|
1969 | return *this;
|
---|
1970 | }
|
---|
1971 | #endif
|
---|
1972 |
|
---|
1973 | Wrapper<cl_type>& operator = (const cl_type &rhs)
|
---|
1974 | {
|
---|
1975 | if (object_ != NULL) { detail::errHandler(release(), __RELEASE_ERR); }
|
---|
1976 | object_ = rhs;
|
---|
1977 | referenceCountable_ = isReferenceCountable(object_);
|
---|
1978 | return *this;
|
---|
1979 | }
|
---|
1980 |
|
---|
1981 | cl_type operator ()() const { return object_; }
|
---|
1982 |
|
---|
1983 | cl_type& operator ()() { return object_; }
|
---|
1984 |
|
---|
1985 | protected:
|
---|
1986 | template<typename Func, typename U>
|
---|
1987 | friend inline cl_int getInfoHelper(Func, cl_uint, U*, int, typename U::cl_type);
|
---|
1988 |
|
---|
1989 | template<typename Func, typename U>
|
---|
1990 | friend inline cl_int getInfoHelper(Func, cl_uint, VECTOR_CLASS<U>*, int, typename U::cl_type);
|
---|
1991 |
|
---|
1992 | cl_int retain() const
|
---|
1993 | {
|
---|
1994 | if( referenceCountable_ ) {
|
---|
1995 | return ReferenceHandler<cl_type>::retain(object_);
|
---|
1996 | }
|
---|
1997 | else {
|
---|
1998 | return CL_SUCCESS;
|
---|
1999 | }
|
---|
2000 | }
|
---|
2001 |
|
---|
2002 | cl_int release() const
|
---|
2003 | {
|
---|
2004 | if( referenceCountable_ ) {
|
---|
2005 | return ReferenceHandler<cl_type>::release(object_);
|
---|
2006 | }
|
---|
2007 | else {
|
---|
2008 | return CL_SUCCESS;
|
---|
2009 | }
|
---|
2010 | }
|
---|
2011 | };
|
---|
2012 |
|
---|
2013 | } // namespace detail
|
---|
2014 | //! \endcond
|
---|
2015 |
|
---|
2016 | /*! \stuct ImageFormat
|
---|
2017 | * \brief Adds constructors and member functions for cl_image_format.
|
---|
2018 | *
|
---|
2019 | * \see cl_image_format
|
---|
2020 | */
|
---|
2021 | struct ImageFormat : public cl_image_format
|
---|
2022 | {
|
---|
2023 | //! \brief Default constructor - performs no initialization.
|
---|
2024 | ImageFormat(){}
|
---|
2025 |
|
---|
2026 | //! \brief Initializing constructor.
|
---|
2027 | ImageFormat(cl_channel_order order, cl_channel_type type)
|
---|
2028 | {
|
---|
2029 | image_channel_order = order;
|
---|
2030 | image_channel_data_type = type;
|
---|
2031 | }
|
---|
2032 |
|
---|
2033 | //! \brief Assignment operator.
|
---|
2034 | ImageFormat& operator = (const ImageFormat& rhs)
|
---|
2035 | {
|
---|
2036 | if (this != &rhs) {
|
---|
2037 | this->image_channel_data_type = rhs.image_channel_data_type;
|
---|
2038 | this->image_channel_order = rhs.image_channel_order;
|
---|
2039 | }
|
---|
2040 | return *this;
|
---|
2041 | }
|
---|
2042 | };
|
---|
2043 |
|
---|
2044 | /*! \brief Class interface for cl_device_id.
|
---|
2045 | *
|
---|
2046 | * \note Copies of these objects are inexpensive, since they don't 'own'
|
---|
2047 | * any underlying resources or data structures.
|
---|
2048 | *
|
---|
2049 | * \see cl_device_id
|
---|
2050 | */
|
---|
2051 | class Device : public detail::Wrapper<cl_device_id>
|
---|
2052 | {
|
---|
2053 | public:
|
---|
2054 | //! \brief Default constructor - initializes to NULL.
|
---|
2055 | Device() : detail::Wrapper<cl_type>() { }
|
---|
2056 |
|
---|
2057 | /*! \brief Constructor from cl_device_id.
|
---|
2058 | *
|
---|
2059 | * This simply copies the device ID value, which is an inexpensive operation.
|
---|
2060 | */
|
---|
2061 | __CL_EXPLICIT_CONSTRUCTORS Device(const cl_device_id &device) : detail::Wrapper<cl_type>(device) { }
|
---|
2062 |
|
---|
2063 | /*! \brief Returns the first device on the default context.
|
---|
2064 | *
|
---|
2065 | * \see Context::getDefault()
|
---|
2066 | */
|
---|
2067 | static Device getDefault(cl_int * err = NULL);
|
---|
2068 |
|
---|
2069 | /*! \brief Assignment operator from cl_device_id.
|
---|
2070 | *
|
---|
2071 | * This simply copies the device ID value, which is an inexpensive operation.
|
---|
2072 | */
|
---|
2073 | Device& operator = (const cl_device_id& rhs)
|
---|
2074 | {
|
---|
2075 | detail::Wrapper<cl_type>::operator=(rhs);
|
---|
2076 | return *this;
|
---|
2077 | }
|
---|
2078 |
|
---|
2079 | /*! \brief Copy constructor to forward copy to the superclass correctly.
|
---|
2080 | * Required for MSVC.
|
---|
2081 | */
|
---|
2082 | Device(const Device& dev) : detail::Wrapper<cl_type>(dev) {}
|
---|
2083 |
|
---|
2084 | /*! \brief Copy assignment to forward copy to the superclass correctly.
|
---|
2085 | * Required for MSVC.
|
---|
2086 | */
|
---|
2087 | Device& operator = (const Device &dev)
|
---|
2088 | {
|
---|
2089 | detail::Wrapper<cl_type>::operator=(dev);
|
---|
2090 | return *this;
|
---|
2091 | }
|
---|
2092 |
|
---|
2093 | #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
|
---|
2094 | /*! \brief Move constructor to forward move to the superclass correctly.
|
---|
2095 | * Required for MSVC.
|
---|
2096 | */
|
---|
2097 | Device(Device&& dev) CL_HPP_NOEXCEPT : detail::Wrapper<cl_type>(std::move(dev)) {}
|
---|
2098 |
|
---|
2099 | /*! \brief Move assignment to forward move to the superclass correctly.
|
---|
2100 | * Required for MSVC.
|
---|
2101 | */
|
---|
2102 | Device& operator = (Device &&dev)
|
---|
2103 | {
|
---|
2104 | detail::Wrapper<cl_type>::operator=(std::move(dev));
|
---|
2105 | return *this;
|
---|
2106 | }
|
---|
2107 | #endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
|
---|
2108 |
|
---|
2109 | //! \brief Wrapper for clGetDeviceInfo().
|
---|
2110 | template <typename T>
|
---|
2111 | cl_int getInfo(cl_device_info name, T* param) const
|
---|
2112 | {
|
---|
2113 | return detail::errHandler(
|
---|
2114 | detail::getInfo(&::clGetDeviceInfo, object_, name, param),
|
---|
2115 | __GET_DEVICE_INFO_ERR);
|
---|
2116 | }
|
---|
2117 |
|
---|
2118 | //! \brief Wrapper for clGetDeviceInfo() that returns by value.
|
---|
2119 | template <cl_device_info name> typename
|
---|
2120 | detail::param_traits<detail::cl_device_info, name>::param_type
|
---|
2121 | getInfo(cl_int* err = NULL) const
|
---|
2122 | {
|
---|
2123 | typename detail::param_traits<
|
---|
2124 | detail::cl_device_info, name>::param_type param;
|
---|
2125 | cl_int result = getInfo(name, ¶m);
|
---|
2126 | if (err != NULL) {
|
---|
2127 | *err = result;
|
---|
2128 | }
|
---|
2129 | return param;
|
---|
2130 | }
|
---|
2131 |
|
---|
2132 | /**
|
---|
2133 | * CL 1.2 version
|
---|
2134 | */
|
---|
2135 | #if defined(CL_VERSION_1_2)
|
---|
2136 | //! \brief Wrapper for clCreateSubDevicesEXT().
|
---|
2137 | cl_int createSubDevices(
|
---|
2138 | const cl_device_partition_property * properties,
|
---|
2139 | VECTOR_CLASS<Device>* devices)
|
---|
2140 | {
|
---|
2141 | cl_uint n = 0;
|
---|
2142 | cl_int err = clCreateSubDevices(object_, properties, 0, NULL, &n);
|
---|
2143 | if (err != CL_SUCCESS) {
|
---|
2144 | return detail::errHandler(err, __CREATE_SUB_DEVICES);
|
---|
2145 | }
|
---|
2146 |
|
---|
2147 | cl_device_id* ids = (cl_device_id*) alloca(n * sizeof(cl_device_id));
|
---|
2148 | err = clCreateSubDevices(object_, properties, n, ids, NULL);
|
---|
2149 | if (err != CL_SUCCESS) {
|
---|
2150 | return detail::errHandler(err, __CREATE_SUB_DEVICES);
|
---|
2151 | }
|
---|
2152 |
|
---|
2153 | devices->assign(&ids[0], &ids[n]);
|
---|
2154 | return CL_SUCCESS;
|
---|
2155 | }
|
---|
2156 | #endif // #if defined(CL_VERSION_1_2)
|
---|
2157 |
|
---|
2158 | /**
|
---|
2159 | * CL 1.1 version that uses device fission.
|
---|
2160 | */
|
---|
2161 | #if defined(CL_VERSION_1_1)
|
---|
2162 | #if defined(USE_CL_DEVICE_FISSION)
|
---|
2163 | cl_int createSubDevices(
|
---|
2164 | const cl_device_partition_property_ext * properties,
|
---|
2165 | VECTOR_CLASS<Device>* devices)
|
---|
2166 | {
|
---|
2167 | typedef CL_API_ENTRY cl_int
|
---|
2168 | ( CL_API_CALL * PFN_clCreateSubDevicesEXT)(
|
---|
2169 | cl_device_id /*in_device*/,
|
---|
2170 | const cl_device_partition_property_ext * /* properties */,
|
---|
2171 | cl_uint /*num_entries*/,
|
---|
2172 | cl_device_id * /*out_devices*/,
|
---|
2173 | cl_uint * /*num_devices*/ ) CL_EXT_SUFFIX__VERSION_1_1;
|
---|
2174 |
|
---|
2175 | static PFN_clCreateSubDevicesEXT pfn_clCreateSubDevicesEXT = NULL;
|
---|
2176 | __INIT_CL_EXT_FCN_PTR(clCreateSubDevicesEXT);
|
---|
2177 |
|
---|
2178 | cl_uint n = 0;
|
---|
2179 | cl_int err = pfn_clCreateSubDevicesEXT(object_, properties, 0, NULL, &n);
|
---|
2180 | if (err != CL_SUCCESS) {
|
---|
2181 | return detail::errHandler(err, __CREATE_SUB_DEVICES);
|
---|
2182 | }
|
---|
2183 |
|
---|
2184 | cl_device_id* ids = (cl_device_id*) alloca(n * sizeof(cl_device_id));
|
---|
2185 | err = pfn_clCreateSubDevicesEXT(object_, properties, n, ids, NULL);
|
---|
2186 | if (err != CL_SUCCESS) {
|
---|
2187 | return detail::errHandler(err, __CREATE_SUB_DEVICES);
|
---|
2188 | }
|
---|
2189 |
|
---|
2190 | devices->assign(&ids[0], &ids[n]);
|
---|
2191 | return CL_SUCCESS;
|
---|
2192 | }
|
---|
2193 | #endif // #if defined(USE_CL_DEVICE_FISSION)
|
---|
2194 | #endif // #if defined(CL_VERSION_1_1)
|
---|
2195 | };
|
---|
2196 |
|
---|
2197 | /*! \brief Class interface for cl_platform_id.
|
---|
2198 | *
|
---|
2199 | * \note Copies of these objects are inexpensive, since they don't 'own'
|
---|
2200 | * any underlying resources or data structures.
|
---|
2201 | *
|
---|
2202 | * \see cl_platform_id
|
---|
2203 | */
|
---|
2204 | class Platform : public detail::Wrapper<cl_platform_id>
|
---|
2205 | {
|
---|
2206 | public:
|
---|
2207 | //! \brief Default constructor - initializes to NULL.
|
---|
2208 | Platform() : detail::Wrapper<cl_type>() { }
|
---|
2209 |
|
---|
2210 | /*! \brief Constructor from cl_platform_id.
|
---|
2211 | *
|
---|
2212 | * This simply copies the platform ID value, which is an inexpensive operation.
|
---|
2213 | */
|
---|
2214 | __CL_EXPLICIT_CONSTRUCTORS Platform(const cl_platform_id &platform) : detail::Wrapper<cl_type>(platform) { }
|
---|
2215 |
|
---|
2216 | /*! \brief Assignment operator from cl_platform_id.
|
---|
2217 | *
|
---|
2218 | * This simply copies the platform ID value, which is an inexpensive operation.
|
---|
2219 | */
|
---|
2220 | Platform& operator = (const cl_platform_id& rhs)
|
---|
2221 | {
|
---|
2222 | detail::Wrapper<cl_type>::operator=(rhs);
|
---|
2223 | return *this;
|
---|
2224 | }
|
---|
2225 |
|
---|
2226 | //! \brief Wrapper for clGetPlatformInfo().
|
---|
2227 | cl_int getInfo(cl_platform_info name, STRING_CLASS* param) const
|
---|
2228 | {
|
---|
2229 | return detail::errHandler(
|
---|
2230 | detail::getInfo(&::clGetPlatformInfo, object_, name, param),
|
---|
2231 | __GET_PLATFORM_INFO_ERR);
|
---|
2232 | }
|
---|
2233 |
|
---|
2234 | //! \brief Wrapper for clGetPlatformInfo() that returns by value.
|
---|
2235 | template <cl_platform_info name> typename
|
---|
2236 | detail::param_traits<detail::cl_platform_info, name>::param_type
|
---|
2237 | getInfo(cl_int* err = NULL) const
|
---|
2238 | {
|
---|
2239 | typename detail::param_traits<
|
---|
2240 | detail::cl_platform_info, name>::param_type param;
|
---|
2241 | cl_int result = getInfo(name, ¶m);
|
---|
2242 | if (err != NULL) {
|
---|
2243 | *err = result;
|
---|
2244 | }
|
---|
2245 | return param;
|
---|
2246 | }
|
---|
2247 |
|
---|
2248 | /*! \brief Gets a list of devices for this platform.
|
---|
2249 | *
|
---|
2250 | * Wraps clGetDeviceIDs().
|
---|
2251 | */
|
---|
2252 | cl_int getDevices(
|
---|
2253 | cl_device_type type,
|
---|
2254 | VECTOR_CLASS<Device>* devices) const
|
---|
2255 | {
|
---|
2256 | cl_uint n = 0;
|
---|
2257 | if( devices == NULL ) {
|
---|
2258 | return detail::errHandler(CL_INVALID_ARG_VALUE, __GET_DEVICE_IDS_ERR);
|
---|
2259 | }
|
---|
2260 | cl_int err = ::clGetDeviceIDs(object_, type, 0, NULL, &n);
|
---|
2261 | if (err != CL_SUCCESS && err != CL_DEVICE_NOT_FOUND) {
|
---|
2262 | return detail::errHandler(err, __GET_DEVICE_IDS_ERR);
|
---|
2263 | }
|
---|
2264 |
|
---|
2265 | if (n > 0) {
|
---|
2266 | cl_device_id* ids = (cl_device_id*) alloca(n * sizeof(cl_device_id));
|
---|
2267 | err = ::clGetDeviceIDs(object_, type, n, ids, NULL);
|
---|
2268 | if (err != CL_SUCCESS) {
|
---|
2269 | return detail::errHandler(err, __GET_DEVICE_IDS_ERR);
|
---|
2270 | }
|
---|
2271 |
|
---|
2272 | devices->assign(&ids[0], &ids[n]);
|
---|
2273 | } else {
|
---|
2274 | devices->clear();
|
---|
2275 | }
|
---|
2276 | return CL_SUCCESS;
|
---|
2277 | }
|
---|
2278 |
|
---|
2279 | #if defined(USE_DX_INTEROP)
|
---|
2280 | /*! \brief Get the list of available D3D10 devices.
|
---|
2281 | *
|
---|
2282 | * \param d3d_device_source.
|
---|
2283 | *
|
---|
2284 | * \param d3d_object.
|
---|
2285 | *
|
---|
2286 | * \param d3d_device_set.
|
---|
2287 | *
|
---|
2288 | * \param devices returns a vector of OpenCL D3D10 devices found. The cl::Device
|
---|
2289 | * values returned in devices can be used to identify a specific OpenCL
|
---|
2290 | * device. If \a devices argument is NULL, this argument is ignored.
|
---|
2291 | *
|
---|
2292 | * \return One of the following values:
|
---|
2293 | * - CL_SUCCESS if the function is executed successfully.
|
---|
2294 | *
|
---|
2295 | * The application can query specific capabilities of the OpenCL device(s)
|
---|
2296 | * returned by cl::getDevices. This can be used by the application to
|
---|
2297 | * determine which device(s) to use.
|
---|
2298 | *
|
---|
2299 | * \note In the case that exceptions are enabled and a return value
|
---|
2300 | * other than CL_SUCCESS is generated, then cl::Error exception is
|
---|
2301 | * generated.
|
---|
2302 | */
|
---|
2303 | cl_int getDevices(
|
---|
2304 | cl_d3d10_device_source_khr d3d_device_source,
|
---|
2305 | void * d3d_object,
|
---|
2306 | cl_d3d10_device_set_khr d3d_device_set,
|
---|
2307 | VECTOR_CLASS<Device>* devices) const
|
---|
2308 | {
|
---|
2309 | typedef CL_API_ENTRY cl_int (CL_API_CALL *PFN_clGetDeviceIDsFromD3D10KHR)(
|
---|
2310 | cl_platform_id platform,
|
---|
2311 | cl_d3d10_device_source_khr d3d_device_source,
|
---|
2312 | void * d3d_object,
|
---|
2313 | cl_d3d10_device_set_khr d3d_device_set,
|
---|
2314 | cl_uint num_entries,
|
---|
2315 | cl_device_id * devices,
|
---|
2316 | cl_uint* num_devices);
|
---|
2317 |
|
---|
2318 | if( devices == NULL ) {
|
---|
2319 | return detail::errHandler(CL_INVALID_ARG_VALUE, __GET_DEVICE_IDS_ERR);
|
---|
2320 | }
|
---|
2321 |
|
---|
2322 | static PFN_clGetDeviceIDsFromD3D10KHR pfn_clGetDeviceIDsFromD3D10KHR = NULL;
|
---|
2323 | __INIT_CL_EXT_FCN_PTR_PLATFORM(object_, clGetDeviceIDsFromD3D10KHR);
|
---|
2324 |
|
---|
2325 | cl_uint n = 0;
|
---|
2326 | cl_int err = pfn_clGetDeviceIDsFromD3D10KHR(
|
---|
2327 | object_,
|
---|
2328 | d3d_device_source,
|
---|
2329 | d3d_object,
|
---|
2330 | d3d_device_set,
|
---|
2331 | 0,
|
---|
2332 | NULL,
|
---|
2333 | &n);
|
---|
2334 | if (err != CL_SUCCESS) {
|
---|
2335 | return detail::errHandler(err, __GET_DEVICE_IDS_ERR);
|
---|
2336 | }
|
---|
2337 |
|
---|
2338 | cl_device_id* ids = (cl_device_id*) alloca(n * sizeof(cl_device_id));
|
---|
2339 | err = pfn_clGetDeviceIDsFromD3D10KHR(
|
---|
2340 | object_,
|
---|
2341 | d3d_device_source,
|
---|
2342 | d3d_object,
|
---|
2343 | d3d_device_set,
|
---|
2344 | n,
|
---|
2345 | ids,
|
---|
2346 | NULL);
|
---|
2347 | if (err != CL_SUCCESS) {
|
---|
2348 | return detail::errHandler(err, __GET_DEVICE_IDS_ERR);
|
---|
2349 | }
|
---|
2350 |
|
---|
2351 | devices->assign(&ids[0], &ids[n]);
|
---|
2352 | return CL_SUCCESS;
|
---|
2353 | }
|
---|
2354 | #endif
|
---|
2355 |
|
---|
2356 | /*! \brief Gets a list of available platforms.
|
---|
2357 | *
|
---|
2358 | * Wraps clGetPlatformIDs().
|
---|
2359 | */
|
---|
2360 | static cl_int get(
|
---|
2361 | VECTOR_CLASS<Platform>* platforms)
|
---|
2362 | {
|
---|
2363 | cl_uint n = 0;
|
---|
2364 |
|
---|
2365 | if( platforms == NULL ) {
|
---|
2366 | return detail::errHandler(CL_INVALID_ARG_VALUE, __GET_PLATFORM_IDS_ERR);
|
---|
2367 | }
|
---|
2368 |
|
---|
2369 | cl_int err = ::clGetPlatformIDs(0, NULL, &n);
|
---|
2370 | if (err != CL_SUCCESS) {
|
---|
2371 | return detail::errHandler(err, __GET_PLATFORM_IDS_ERR);
|
---|
2372 | }
|
---|
2373 |
|
---|
2374 | cl_platform_id* ids = (cl_platform_id*) alloca(
|
---|
2375 | n * sizeof(cl_platform_id));
|
---|
2376 | err = ::clGetPlatformIDs(n, ids, NULL);
|
---|
2377 | if (err != CL_SUCCESS) {
|
---|
2378 | return detail::errHandler(err, __GET_PLATFORM_IDS_ERR);
|
---|
2379 | }
|
---|
2380 |
|
---|
2381 | platforms->assign(&ids[0], &ids[n]);
|
---|
2382 | return CL_SUCCESS;
|
---|
2383 | }
|
---|
2384 |
|
---|
2385 | /*! \brief Gets the first available platform.
|
---|
2386 | *
|
---|
2387 | * Wraps clGetPlatformIDs(), returning the first result.
|
---|
2388 | */
|
---|
2389 | static cl_int get(
|
---|
2390 | Platform * platform)
|
---|
2391 | {
|
---|
2392 | cl_uint n = 0;
|
---|
2393 |
|
---|
2394 | if( platform == NULL ) {
|
---|
2395 | return detail::errHandler(CL_INVALID_ARG_VALUE, __GET_PLATFORM_IDS_ERR);
|
---|
2396 | }
|
---|
2397 |
|
---|
2398 | cl_int err = ::clGetPlatformIDs(0, NULL, &n);
|
---|
2399 | if (err != CL_SUCCESS) {
|
---|
2400 | return detail::errHandler(err, __GET_PLATFORM_IDS_ERR);
|
---|
2401 | }
|
---|
2402 |
|
---|
2403 | cl_platform_id* ids = (cl_platform_id*) alloca(
|
---|
2404 | n * sizeof(cl_platform_id));
|
---|
2405 | err = ::clGetPlatformIDs(n, ids, NULL);
|
---|
2406 | if (err != CL_SUCCESS) {
|
---|
2407 | return detail::errHandler(err, __GET_PLATFORM_IDS_ERR);
|
---|
2408 | }
|
---|
2409 |
|
---|
2410 | *platform = ids[0];
|
---|
2411 | return CL_SUCCESS;
|
---|
2412 | }
|
---|
2413 |
|
---|
2414 | /*! \brief Gets the first available platform, returning it by value.
|
---|
2415 | *
|
---|
2416 | * Wraps clGetPlatformIDs(), returning the first result.
|
---|
2417 | */
|
---|
2418 | static Platform get(
|
---|
2419 | cl_int * errResult = NULL)
|
---|
2420 | {
|
---|
2421 | Platform platform;
|
---|
2422 | cl_uint n = 0;
|
---|
2423 | cl_int err = ::clGetPlatformIDs(0, NULL, &n);
|
---|
2424 | if (err != CL_SUCCESS) {
|
---|
2425 | detail::errHandler(err, __GET_PLATFORM_IDS_ERR);
|
---|
2426 | if (errResult != NULL) {
|
---|
2427 | *errResult = err;
|
---|
2428 | }
|
---|
2429 | return Platform();
|
---|
2430 | }
|
---|
2431 |
|
---|
2432 | cl_platform_id* ids = (cl_platform_id*) alloca(
|
---|
2433 | n * sizeof(cl_platform_id));
|
---|
2434 | err = ::clGetPlatformIDs(n, ids, NULL);
|
---|
2435 |
|
---|
2436 | if (err != CL_SUCCESS) {
|
---|
2437 | detail::errHandler(err, __GET_PLATFORM_IDS_ERR);
|
---|
2438 | if (errResult != NULL) {
|
---|
2439 | *errResult = err;
|
---|
2440 | }
|
---|
2441 | return Platform();
|
---|
2442 | }
|
---|
2443 |
|
---|
2444 |
|
---|
2445 | return Platform(ids[0]);
|
---|
2446 | }
|
---|
2447 |
|
---|
2448 | static Platform getDefault(
|
---|
2449 | cl_int *errResult = NULL )
|
---|
2450 | {
|
---|
2451 | return get(errResult);
|
---|
2452 | }
|
---|
2453 |
|
---|
2454 |
|
---|
2455 | #if defined(CL_VERSION_1_2)
|
---|
2456 | //! \brief Wrapper for clUnloadCompiler().
|
---|
2457 | cl_int
|
---|
2458 | unloadCompiler()
|
---|
2459 | {
|
---|
2460 | return ::clUnloadPlatformCompiler(object_);
|
---|
2461 | }
|
---|
2462 | #endif // #if defined(CL_VERSION_1_2)
|
---|
2463 | }; // class Platform
|
---|
2464 |
|
---|
2465 | /**
|
---|
2466 | * Deprecated APIs for 1.2
|
---|
2467 | */
|
---|
2468 | #if defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS) || (defined(CL_VERSION_1_1) && !defined(CL_VERSION_1_2))
|
---|
2469 | /**
|
---|
2470 | * Unload the OpenCL compiler.
|
---|
2471 | * \note Deprecated for OpenCL 1.2. Use Platform::unloadCompiler instead.
|
---|
2472 | */
|
---|
2473 | inline CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_int
|
---|
2474 | UnloadCompiler() CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED;
|
---|
2475 | inline cl_int
|
---|
2476 | UnloadCompiler()
|
---|
2477 | {
|
---|
2478 | return ::clUnloadCompiler();
|
---|
2479 | }
|
---|
2480 | #endif // #if defined(CL_VERSION_1_1)
|
---|
2481 |
|
---|
2482 | /*! \brief Class interface for cl_context.
|
---|
2483 | *
|
---|
2484 | * \note Copies of these objects are shallow, meaning that the copy will refer
|
---|
2485 | * to the same underlying cl_context as the original. For details, see
|
---|
2486 | * clRetainContext() and clReleaseContext().
|
---|
2487 | *
|
---|
2488 | * \see cl_context
|
---|
2489 | */
|
---|
2490 | class Context
|
---|
2491 | : public detail::Wrapper<cl_context>
|
---|
2492 | {
|
---|
2493 | private:
|
---|
2494 |
|
---|
2495 | #ifdef CL_HPP_CPP11_ATOMICS_SUPPORTED
|
---|
2496 | static std::atomic<int> default_initialized_;
|
---|
2497 | #else // !CL_HPP_CPP11_ATOMICS_SUPPORTED
|
---|
2498 | static volatile int default_initialized_;
|
---|
2499 | #endif // !CL_HPP_CPP11_ATOMICS_SUPPORTED
|
---|
2500 | static Context default_;
|
---|
2501 | static volatile cl_int default_error_;
|
---|
2502 | public:
|
---|
2503 | /*! \brief Constructs a context including a list of specified devices.
|
---|
2504 | *
|
---|
2505 | * Wraps clCreateContext().
|
---|
2506 | */
|
---|
2507 | Context(
|
---|
2508 | const VECTOR_CLASS<Device>& devices,
|
---|
2509 | cl_context_properties* properties = NULL,
|
---|
2510 | void (CL_CALLBACK * notifyFptr)(
|
---|
2511 | const char *,
|
---|
2512 | const void *,
|
---|
2513 | ::size_t,
|
---|
2514 | void *) = NULL,
|
---|
2515 | void* data = NULL,
|
---|
2516 | cl_int* err = NULL)
|
---|
2517 | {
|
---|
2518 | cl_int error;
|
---|
2519 |
|
---|
2520 | ::size_t numDevices = devices.size();
|
---|
2521 | cl_device_id* deviceIDs = (cl_device_id*) alloca(numDevices * sizeof(cl_device_id));
|
---|
2522 | for( ::size_t deviceIndex = 0; deviceIndex < numDevices; ++deviceIndex ) {
|
---|
2523 | deviceIDs[deviceIndex] = (devices[deviceIndex])();
|
---|
2524 | }
|
---|
2525 |
|
---|
2526 | object_ = ::clCreateContext(
|
---|
2527 | properties, (cl_uint) numDevices,
|
---|
2528 | deviceIDs,
|
---|
2529 | notifyFptr, data, &error);
|
---|
2530 |
|
---|
2531 | detail::errHandler(error, __CREATE_CONTEXT_ERR);
|
---|
2532 | if (err != NULL) {
|
---|
2533 | *err = error;
|
---|
2534 | }
|
---|
2535 | }
|
---|
2536 |
|
---|
2537 | Context(
|
---|
2538 | const Device& device,
|
---|
2539 | cl_context_properties* properties = NULL,
|
---|
2540 | void (CL_CALLBACK * notifyFptr)(
|
---|
2541 | const char *,
|
---|
2542 | const void *,
|
---|
2543 | ::size_t,
|
---|
2544 | void *) = NULL,
|
---|
2545 | void* data = NULL,
|
---|
2546 | cl_int* err = NULL)
|
---|
2547 | {
|
---|
2548 | cl_int error;
|
---|
2549 |
|
---|
2550 | cl_device_id deviceID = device();
|
---|
2551 |
|
---|
2552 | object_ = ::clCreateContext(
|
---|
2553 | properties, 1,
|
---|
2554 | &deviceID,
|
---|
2555 | notifyFptr, data, &error);
|
---|
2556 |
|
---|
2557 | detail::errHandler(error, __CREATE_CONTEXT_ERR);
|
---|
2558 | if (err != NULL) {
|
---|
2559 | *err = error;
|
---|
2560 | }
|
---|
2561 | }
|
---|
2562 |
|
---|
2563 | /*! \brief Constructs a context including all or a subset of devices of a specified type.
|
---|
2564 | *
|
---|
2565 | * Wraps clCreateContextFromType().
|
---|
2566 | */
|
---|
2567 | Context(
|
---|
2568 | cl_device_type type,
|
---|
2569 | cl_context_properties* properties = NULL,
|
---|
2570 | void (CL_CALLBACK * notifyFptr)(
|
---|
2571 | const char *,
|
---|
2572 | const void *,
|
---|
2573 | ::size_t,
|
---|
2574 | void *) = NULL,
|
---|
2575 | void* data = NULL,
|
---|
2576 | cl_int* err = NULL)
|
---|
2577 | {
|
---|
2578 | cl_int error;
|
---|
2579 |
|
---|
2580 | #if !defined(__APPLE__) && !defined(__MACOS)
|
---|
2581 | cl_context_properties prop[4] = {CL_CONTEXT_PLATFORM, 0, 0, 0 };
|
---|
2582 |
|
---|
2583 | if (properties == NULL) {
|
---|
2584 | // Get a valid platform ID as we cannot send in a blank one
|
---|
2585 | VECTOR_CLASS<Platform> platforms;
|
---|
2586 | error = Platform::get(&platforms);
|
---|
2587 | if (error != CL_SUCCESS) {
|
---|
2588 | detail::errHandler(error, __CREATE_CONTEXT_FROM_TYPE_ERR);
|
---|
2589 | if (err != NULL) {
|
---|
2590 | *err = error;
|
---|
2591 | }
|
---|
2592 | return;
|
---|
2593 | }
|
---|
2594 |
|
---|
2595 | // Check the platforms we found for a device of our specified type
|
---|
2596 | cl_context_properties platform_id = 0;
|
---|
2597 | for (unsigned int i = 0; i < platforms.size(); i++) {
|
---|
2598 |
|
---|
2599 | VECTOR_CLASS<Device> devices;
|
---|
2600 |
|
---|
2601 | #if defined(__CL_ENABLE_EXCEPTIONS)
|
---|
2602 | try {
|
---|
2603 | #endif
|
---|
2604 |
|
---|
2605 | error = platforms[i].getDevices(type, &devices);
|
---|
2606 |
|
---|
2607 | #if defined(__CL_ENABLE_EXCEPTIONS)
|
---|
2608 | } catch (Error &) {}
|
---|
2609 | // Catch if exceptions are enabled as we don't want to exit if first platform has no devices of type
|
---|
2610 | // We do error checking next anyway, and can throw there if needed
|
---|
2611 | #endif
|
---|
2612 |
|
---|
2613 | // Only squash CL_SUCCESS and CL_DEVICE_NOT_FOUND
|
---|
2614 | if (error != CL_SUCCESS && error != CL_DEVICE_NOT_FOUND) {
|
---|
2615 | detail::errHandler(error, __CREATE_CONTEXT_FROM_TYPE_ERR);
|
---|
2616 | if (err != NULL) {
|
---|
2617 | *err = error;
|
---|
2618 | }
|
---|
2619 | }
|
---|
2620 |
|
---|
2621 | if (devices.size() > 0) {
|
---|
2622 | platform_id = (cl_context_properties)platforms[i]();
|
---|
2623 | break;
|
---|
2624 | }
|
---|
2625 | }
|
---|
2626 |
|
---|
2627 | if (platform_id == 0) {
|
---|
2628 | detail::errHandler(CL_DEVICE_NOT_FOUND, __CREATE_CONTEXT_FROM_TYPE_ERR);
|
---|
2629 | if (err != NULL) {
|
---|
2630 | *err = CL_DEVICE_NOT_FOUND;
|
---|
2631 | }
|
---|
2632 | return;
|
---|
2633 | }
|
---|
2634 |
|
---|
2635 | prop[1] = platform_id;
|
---|
2636 | properties = &prop[0];
|
---|
2637 | }
|
---|
2638 | #endif
|
---|
2639 | object_ = ::clCreateContextFromType(
|
---|
2640 | properties, type, notifyFptr, data, &error);
|
---|
2641 |
|
---|
2642 | detail::errHandler(error, __CREATE_CONTEXT_FROM_TYPE_ERR);
|
---|
2643 | if (err != NULL) {
|
---|
2644 | *err = error;
|
---|
2645 | }
|
---|
2646 | }
|
---|
2647 |
|
---|
2648 | /*! \brief Copy constructor to forward copy to the superclass correctly.
|
---|
2649 | * Required for MSVC.
|
---|
2650 | */
|
---|
2651 | Context(const Context& ctx) : detail::Wrapper<cl_type>(ctx) {}
|
---|
2652 |
|
---|
2653 | /*! \brief Copy assignment to forward copy to the superclass correctly.
|
---|
2654 | * Required for MSVC.
|
---|
2655 | */
|
---|
2656 | Context& operator = (const Context &ctx)
|
---|
2657 | {
|
---|
2658 | detail::Wrapper<cl_type>::operator=(ctx);
|
---|
2659 | return *this;
|
---|
2660 | }
|
---|
2661 |
|
---|
2662 | #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
|
---|
2663 | /*! \brief Move constructor to forward move to the superclass correctly.
|
---|
2664 | * Required for MSVC.
|
---|
2665 | */
|
---|
2666 | Context(Context&& ctx) CL_HPP_NOEXCEPT : detail::Wrapper<cl_type>(std::move(ctx)) {}
|
---|
2667 |
|
---|
2668 | /*! \brief Move assignment to forward move to the superclass correctly.
|
---|
2669 | * Required for MSVC.
|
---|
2670 | */
|
---|
2671 | Context& operator = (Context &&ctx)
|
---|
2672 | {
|
---|
2673 | detail::Wrapper<cl_type>::operator=(std::move(ctx));
|
---|
2674 | return *this;
|
---|
2675 | }
|
---|
2676 | #endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
|
---|
2677 |
|
---|
2678 | /*! \brief Returns a singleton context including all devices of CL_DEVICE_TYPE_DEFAULT.
|
---|
2679 | *
|
---|
2680 | * \note All calls to this function return the same cl_context as the first.
|
---|
2681 | */
|
---|
2682 | static Context getDefault(cl_int * err = NULL)
|
---|
2683 | {
|
---|
2684 | int state = detail::compare_exchange(
|
---|
2685 | &default_initialized_,
|
---|
2686 | __DEFAULT_BEING_INITIALIZED, __DEFAULT_NOT_INITIALIZED);
|
---|
2687 |
|
---|
2688 | if (state & __DEFAULT_INITIALIZED) {
|
---|
2689 | if (err != NULL) {
|
---|
2690 | *err = default_error_;
|
---|
2691 | }
|
---|
2692 | return default_;
|
---|
2693 | }
|
---|
2694 |
|
---|
2695 | if (state & __DEFAULT_BEING_INITIALIZED) {
|
---|
2696 | // Assume writes will propagate eventually...
|
---|
2697 | while(default_initialized_ != __DEFAULT_INITIALIZED) {
|
---|
2698 | detail::fence();
|
---|
2699 | }
|
---|
2700 |
|
---|
2701 | if (err != NULL) {
|
---|
2702 | *err = default_error_;
|
---|
2703 | }
|
---|
2704 | return default_;
|
---|
2705 | }
|
---|
2706 |
|
---|
2707 | cl_int error;
|
---|
2708 | default_ = Context(
|
---|
2709 | CL_DEVICE_TYPE_DEFAULT,
|
---|
2710 | NULL,
|
---|
2711 | NULL,
|
---|
2712 | NULL,
|
---|
2713 | &error);
|
---|
2714 |
|
---|
2715 | detail::fence();
|
---|
2716 |
|
---|
2717 | default_error_ = error;
|
---|
2718 | // Assume writes will propagate eventually...
|
---|
2719 | default_initialized_ = __DEFAULT_INITIALIZED;
|
---|
2720 |
|
---|
2721 | detail::fence();
|
---|
2722 |
|
---|
2723 | if (err != NULL) {
|
---|
2724 | *err = default_error_;
|
---|
2725 | }
|
---|
2726 | return default_;
|
---|
2727 |
|
---|
2728 | }
|
---|
2729 |
|
---|
2730 | //! \brief Default constructor - initializes to NULL.
|
---|
2731 | Context() : detail::Wrapper<cl_type>() { }
|
---|
2732 |
|
---|
2733 | /*! \brief Constructor from cl_context - takes ownership.
|
---|
2734 | *
|
---|
2735 | * This effectively transfers ownership of a refcount on the cl_context
|
---|
2736 | * into the new Context object.
|
---|
2737 | */
|
---|
2738 | __CL_EXPLICIT_CONSTRUCTORS Context(const cl_context& context) : detail::Wrapper<cl_type>(context) { }
|
---|
2739 |
|
---|
2740 | /*! \brief Assignment operator from cl_context - takes ownership.
|
---|
2741 | *
|
---|
2742 | * This effectively transfers ownership of a refcount on the rhs and calls
|
---|
2743 | * clReleaseContext() on the value previously held by this instance.
|
---|
2744 | */
|
---|
2745 | Context& operator = (const cl_context& rhs)
|
---|
2746 | {
|
---|
2747 | detail::Wrapper<cl_type>::operator=(rhs);
|
---|
2748 | return *this;
|
---|
2749 | }
|
---|
2750 |
|
---|
2751 | //! \brief Wrapper for clGetContextInfo().
|
---|
2752 | template <typename T>
|
---|
2753 | cl_int getInfo(cl_context_info name, T* param) const
|
---|
2754 | {
|
---|
2755 | return detail::errHandler(
|
---|
2756 | detail::getInfo(&::clGetContextInfo, object_, name, param),
|
---|
2757 | __GET_CONTEXT_INFO_ERR);
|
---|
2758 | }
|
---|
2759 |
|
---|
2760 | //! \brief Wrapper for clGetContextInfo() that returns by value.
|
---|
2761 | template <cl_context_info name> typename
|
---|
2762 | detail::param_traits<detail::cl_context_info, name>::param_type
|
---|
2763 | getInfo(cl_int* err = NULL) const
|
---|
2764 | {
|
---|
2765 | typename detail::param_traits<
|
---|
2766 | detail::cl_context_info, name>::param_type param;
|
---|
2767 | cl_int result = getInfo(name, ¶m);
|
---|
2768 | if (err != NULL) {
|
---|
2769 | *err = result;
|
---|
2770 | }
|
---|
2771 | return param;
|
---|
2772 | }
|
---|
2773 |
|
---|
2774 | /*! \brief Gets a list of supported image formats.
|
---|
2775 | *
|
---|
2776 | * Wraps clGetSupportedImageFormats().
|
---|
2777 | */
|
---|
2778 | cl_int getSupportedImageFormats(
|
---|
2779 | cl_mem_flags flags,
|
---|
2780 | cl_mem_object_type type,
|
---|
2781 | VECTOR_CLASS<ImageFormat>* formats) const
|
---|
2782 | {
|
---|
2783 | cl_uint numEntries;
|
---|
2784 |
|
---|
2785 | if (!formats) {
|
---|
2786 | return CL_SUCCESS;
|
---|
2787 | }
|
---|
2788 |
|
---|
2789 | cl_int err = ::clGetSupportedImageFormats(
|
---|
2790 | object_,
|
---|
2791 | flags,
|
---|
2792 | type,
|
---|
2793 | 0,
|
---|
2794 | NULL,
|
---|
2795 | &numEntries);
|
---|
2796 | if (err != CL_SUCCESS) {
|
---|
2797 | return detail::errHandler(err, __GET_SUPPORTED_IMAGE_FORMATS_ERR);
|
---|
2798 | }
|
---|
2799 |
|
---|
2800 | if (numEntries > 0) {
|
---|
2801 | ImageFormat* value = (ImageFormat*)
|
---|
2802 | alloca(numEntries * sizeof(ImageFormat));
|
---|
2803 | err = ::clGetSupportedImageFormats(
|
---|
2804 | object_,
|
---|
2805 | flags,
|
---|
2806 | type,
|
---|
2807 | numEntries,
|
---|
2808 | (cl_image_format*)value,
|
---|
2809 | NULL);
|
---|
2810 | if (err != CL_SUCCESS) {
|
---|
2811 | return detail::errHandler(err, __GET_SUPPORTED_IMAGE_FORMATS_ERR);
|
---|
2812 | }
|
---|
2813 |
|
---|
2814 | formats->assign(&value[0], &value[numEntries]);
|
---|
2815 | }
|
---|
2816 | else {
|
---|
2817 | formats->clear();
|
---|
2818 | }
|
---|
2819 | return CL_SUCCESS;
|
---|
2820 | }
|
---|
2821 | };
|
---|
2822 |
|
---|
2823 | inline Device Device::getDefault(cl_int * err)
|
---|
2824 | {
|
---|
2825 | cl_int error;
|
---|
2826 | Device device;
|
---|
2827 |
|
---|
2828 | Context context = Context::getDefault(&error);
|
---|
2829 | detail::errHandler(error, __CREATE_CONTEXT_ERR);
|
---|
2830 |
|
---|
2831 | if (error != CL_SUCCESS) {
|
---|
2832 | if (err != NULL) {
|
---|
2833 | *err = error;
|
---|
2834 | }
|
---|
2835 | }
|
---|
2836 | else {
|
---|
2837 | device = context.getInfo<CL_CONTEXT_DEVICES>()[0];
|
---|
2838 | if (err != NULL) {
|
---|
2839 | *err = CL_SUCCESS;
|
---|
2840 | }
|
---|
2841 | }
|
---|
2842 |
|
---|
2843 | return device;
|
---|
2844 | }
|
---|
2845 |
|
---|
2846 | #ifdef CL_HPP_CPP11_ATOMICS_SUPPORTED
|
---|
2847 | CL_WEAK_ATTRIB_PREFIX std::atomic<int> CL_WEAK_ATTRIB_SUFFIX Context::default_initialized_;
|
---|
2848 | #else // !CL_HPP_CPP11_ATOMICS_SUPPORTED
|
---|
2849 | CL_WEAK_ATTRIB_PREFIX volatile int CL_WEAK_ATTRIB_SUFFIX Context::default_initialized_ = __DEFAULT_NOT_INITIALIZED;
|
---|
2850 | #endif // !CL_HPP_CPP11_ATOMICS_SUPPORTED
|
---|
2851 |
|
---|
2852 | CL_WEAK_ATTRIB_PREFIX Context CL_WEAK_ATTRIB_SUFFIX Context::default_;
|
---|
2853 | CL_WEAK_ATTRIB_PREFIX volatile cl_int CL_WEAK_ATTRIB_SUFFIX Context::default_error_ = CL_SUCCESS;
|
---|
2854 |
|
---|
2855 | /*! \brief Class interface for cl_event.
|
---|
2856 | *
|
---|
2857 | * \note Copies of these objects are shallow, meaning that the copy will refer
|
---|
2858 | * to the same underlying cl_event as the original. For details, see
|
---|
2859 | * clRetainEvent() and clReleaseEvent().
|
---|
2860 | *
|
---|
2861 | * \see cl_event
|
---|
2862 | */
|
---|
2863 | class Event : public detail::Wrapper<cl_event>
|
---|
2864 | {
|
---|
2865 | public:
|
---|
2866 | //! \brief Default constructor - initializes to NULL.
|
---|
2867 | Event() : detail::Wrapper<cl_type>() { }
|
---|
2868 |
|
---|
2869 | /*! \brief Constructor from cl_event - takes ownership.
|
---|
2870 | *
|
---|
2871 | * This effectively transfers ownership of a refcount on the cl_event
|
---|
2872 | * into the new Event object.
|
---|
2873 | */
|
---|
2874 | __CL_EXPLICIT_CONSTRUCTORS Event(const cl_event& event) : detail::Wrapper<cl_type>(event) { }
|
---|
2875 |
|
---|
2876 | /*! \brief Assignment operator from cl_event - takes ownership.
|
---|
2877 | *
|
---|
2878 | * This effectively transfers ownership of a refcount on the rhs and calls
|
---|
2879 | * clReleaseEvent() on the value previously held by this instance.
|
---|
2880 | */
|
---|
2881 | Event& operator = (const cl_event& rhs)
|
---|
2882 | {
|
---|
2883 | detail::Wrapper<cl_type>::operator=(rhs);
|
---|
2884 | return *this;
|
---|
2885 | }
|
---|
2886 |
|
---|
2887 | //! \brief Wrapper for clGetEventInfo().
|
---|
2888 | template <typename T>
|
---|
2889 | cl_int getInfo(cl_event_info name, T* param) const
|
---|
2890 | {
|
---|
2891 | return detail::errHandler(
|
---|
2892 | detail::getInfo(&::clGetEventInfo, object_, name, param),
|
---|
2893 | __GET_EVENT_INFO_ERR);
|
---|
2894 | }
|
---|
2895 |
|
---|
2896 | //! \brief Wrapper for clGetEventInfo() that returns by value.
|
---|
2897 | template <cl_event_info name> typename
|
---|
2898 | detail::param_traits<detail::cl_event_info, name>::param_type
|
---|
2899 | getInfo(cl_int* err = NULL) const
|
---|
2900 | {
|
---|
2901 | typename detail::param_traits<
|
---|
2902 | detail::cl_event_info, name>::param_type param;
|
---|
2903 | cl_int result = getInfo(name, ¶m);
|
---|
2904 | if (err != NULL) {
|
---|
2905 | *err = result;
|
---|
2906 | }
|
---|
2907 | return param;
|
---|
2908 | }
|
---|
2909 |
|
---|
2910 | //! \brief Wrapper for clGetEventProfilingInfo().
|
---|
2911 | template <typename T>
|
---|
2912 | cl_int getProfilingInfo(cl_profiling_info name, T* param) const
|
---|
2913 | {
|
---|
2914 | return detail::errHandler(detail::getInfo(
|
---|
2915 | &::clGetEventProfilingInfo, object_, name, param),
|
---|
2916 | __GET_EVENT_PROFILE_INFO_ERR);
|
---|
2917 | }
|
---|
2918 |
|
---|
2919 | //! \brief Wrapper for clGetEventProfilingInfo() that returns by value.
|
---|
2920 | template <cl_profiling_info name> typename
|
---|
2921 | detail::param_traits<detail::cl_profiling_info, name>::param_type
|
---|
2922 | getProfilingInfo(cl_int* err = NULL) const
|
---|
2923 | {
|
---|
2924 | typename detail::param_traits<
|
---|
2925 | detail::cl_profiling_info, name>::param_type param;
|
---|
2926 | cl_int result = getProfilingInfo(name, ¶m);
|
---|
2927 | if (err != NULL) {
|
---|
2928 | *err = result;
|
---|
2929 | }
|
---|
2930 | return param;
|
---|
2931 | }
|
---|
2932 |
|
---|
2933 | /*! \brief Blocks the calling thread until this event completes.
|
---|
2934 | *
|
---|
2935 | * Wraps clWaitForEvents().
|
---|
2936 | */
|
---|
2937 | cl_int wait() const
|
---|
2938 | {
|
---|
2939 | return detail::errHandler(
|
---|
2940 | ::clWaitForEvents(1, &object_),
|
---|
2941 | __WAIT_FOR_EVENTS_ERR);
|
---|
2942 | }
|
---|
2943 |
|
---|
2944 | #if defined(CL_VERSION_1_1)
|
---|
2945 | /*! \brief Registers a user callback function for a specific command execution status.
|
---|
2946 | *
|
---|
2947 | * Wraps clSetEventCallback().
|
---|
2948 | */
|
---|
2949 | cl_int setCallback(
|
---|
2950 | cl_int type,
|
---|
2951 | void (CL_CALLBACK * pfn_notify)(cl_event, cl_int, void *),
|
---|
2952 | void * user_data = NULL)
|
---|
2953 | {
|
---|
2954 | return detail::errHandler(
|
---|
2955 | ::clSetEventCallback(
|
---|
2956 | object_,
|
---|
2957 | type,
|
---|
2958 | pfn_notify,
|
---|
2959 | user_data),
|
---|
2960 | __SET_EVENT_CALLBACK_ERR);
|
---|
2961 | }
|
---|
2962 | #endif
|
---|
2963 |
|
---|
2964 | /*! \brief Blocks the calling thread until every event specified is complete.
|
---|
2965 | *
|
---|
2966 | * Wraps clWaitForEvents().
|
---|
2967 | */
|
---|
2968 | static cl_int
|
---|
2969 | waitForEvents(const VECTOR_CLASS<Event>& events)
|
---|
2970 | {
|
---|
2971 | return detail::errHandler(
|
---|
2972 | ::clWaitForEvents(
|
---|
2973 | (cl_uint) events.size(), (events.size() > 0) ? (cl_event*)&events.front() : NULL),
|
---|
2974 | __WAIT_FOR_EVENTS_ERR);
|
---|
2975 | }
|
---|
2976 | };
|
---|
2977 |
|
---|
2978 | #if defined(CL_VERSION_1_1)
|
---|
2979 | /*! \brief Class interface for user events (a subset of cl_event's).
|
---|
2980 | *
|
---|
2981 | * See Event for details about copy semantics, etc.
|
---|
2982 | */
|
---|
2983 | class UserEvent : public Event
|
---|
2984 | {
|
---|
2985 | public:
|
---|
2986 | /*! \brief Constructs a user event on a given context.
|
---|
2987 | *
|
---|
2988 | * Wraps clCreateUserEvent().
|
---|
2989 | */
|
---|
2990 | UserEvent(
|
---|
2991 | const Context& context,
|
---|
2992 | cl_int * err = NULL)
|
---|
2993 | {
|
---|
2994 | cl_int error;
|
---|
2995 | object_ = ::clCreateUserEvent(
|
---|
2996 | context(),
|
---|
2997 | &error);
|
---|
2998 |
|
---|
2999 | detail::errHandler(error, __CREATE_USER_EVENT_ERR);
|
---|
3000 | if (err != NULL) {
|
---|
3001 | *err = error;
|
---|
3002 | }
|
---|
3003 | }
|
---|
3004 |
|
---|
3005 | //! \brief Default constructor - initializes to NULL.
|
---|
3006 | UserEvent() : Event() { }
|
---|
3007 |
|
---|
3008 | /*! \brief Sets the execution status of a user event object.
|
---|
3009 | *
|
---|
3010 | * Wraps clSetUserEventStatus().
|
---|
3011 | */
|
---|
3012 | cl_int setStatus(cl_int status)
|
---|
3013 | {
|
---|
3014 | return detail::errHandler(
|
---|
3015 | ::clSetUserEventStatus(object_,status),
|
---|
3016 | __SET_USER_EVENT_STATUS_ERR);
|
---|
3017 | }
|
---|
3018 | };
|
---|
3019 | #endif
|
---|
3020 |
|
---|
3021 | /*! \brief Blocks the calling thread until every event specified is complete.
|
---|
3022 | *
|
---|
3023 | * Wraps clWaitForEvents().
|
---|
3024 | */
|
---|
3025 | inline static cl_int
|
---|
3026 | WaitForEvents(const VECTOR_CLASS<Event>& events)
|
---|
3027 | {
|
---|
3028 | return detail::errHandler(
|
---|
3029 | ::clWaitForEvents(
|
---|
3030 | (cl_uint) events.size(), (events.size() > 0) ? (cl_event*)&events.front() : NULL),
|
---|
3031 | __WAIT_FOR_EVENTS_ERR);
|
---|
3032 | }
|
---|
3033 |
|
---|
3034 | /*! \brief Class interface for cl_mem.
|
---|
3035 | *
|
---|
3036 | * \note Copies of these objects are shallow, meaning that the copy will refer
|
---|
3037 | * to the same underlying cl_mem as the original. For details, see
|
---|
3038 | * clRetainMemObject() and clReleaseMemObject().
|
---|
3039 | *
|
---|
3040 | * \see cl_mem
|
---|
3041 | */
|
---|
3042 | class Memory : public detail::Wrapper<cl_mem>
|
---|
3043 | {
|
---|
3044 | public:
|
---|
3045 | //! \brief Default constructor - initializes to NULL.
|
---|
3046 | Memory() : detail::Wrapper<cl_type>() { }
|
---|
3047 |
|
---|
3048 | /*! \brief Constructor from cl_mem - takes ownership.
|
---|
3049 | *
|
---|
3050 | * This effectively transfers ownership of a refcount on the cl_mem
|
---|
3051 | * into the new Memory object.
|
---|
3052 | */
|
---|
3053 | __CL_EXPLICIT_CONSTRUCTORS Memory(const cl_mem& memory) : detail::Wrapper<cl_type>(memory) { }
|
---|
3054 |
|
---|
3055 | /*! \brief Assignment operator from cl_mem - takes ownership.
|
---|
3056 | *
|
---|
3057 | * This effectively transfers ownership of a refcount on the rhs and calls
|
---|
3058 | * clReleaseMemObject() on the value previously held by this instance.
|
---|
3059 | */
|
---|
3060 | Memory& operator = (const cl_mem& rhs)
|
---|
3061 | {
|
---|
3062 | detail::Wrapper<cl_type>::operator=(rhs);
|
---|
3063 | return *this;
|
---|
3064 | }
|
---|
3065 |
|
---|
3066 | /*! \brief Copy constructor to forward copy to the superclass correctly.
|
---|
3067 | * Required for MSVC.
|
---|
3068 | */
|
---|
3069 | Memory(const Memory& mem) : detail::Wrapper<cl_type>(mem) {}
|
---|
3070 |
|
---|
3071 | /*! \brief Copy assignment to forward copy to the superclass correctly.
|
---|
3072 | * Required for MSVC.
|
---|
3073 | */
|
---|
3074 | Memory& operator = (const Memory &mem)
|
---|
3075 | {
|
---|
3076 | detail::Wrapper<cl_type>::operator=(mem);
|
---|
3077 | return *this;
|
---|
3078 | }
|
---|
3079 |
|
---|
3080 | #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
|
---|
3081 | /*! \brief Move constructor to forward move to the superclass correctly.
|
---|
3082 | * Required for MSVC.
|
---|
3083 | */
|
---|
3084 | Memory(Memory&& mem) CL_HPP_NOEXCEPT : detail::Wrapper<cl_type>(std::move(mem)) {}
|
---|
3085 |
|
---|
3086 | /*! \brief Move assignment to forward move to the superclass correctly.
|
---|
3087 | * Required for MSVC.
|
---|
3088 | */
|
---|
3089 | Memory& operator = (Memory &&mem)
|
---|
3090 | {
|
---|
3091 | detail::Wrapper<cl_type>::operator=(std::move(mem));
|
---|
3092 | return *this;
|
---|
3093 | }
|
---|
3094 | #endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
|
---|
3095 |
|
---|
3096 | //! \brief Wrapper for clGetMemObjectInfo().
|
---|
3097 | template <typename T>
|
---|
3098 | cl_int getInfo(cl_mem_info name, T* param) const
|
---|
3099 | {
|
---|
3100 | return detail::errHandler(
|
---|
3101 | detail::getInfo(&::clGetMemObjectInfo, object_, name, param),
|
---|
3102 | __GET_MEM_OBJECT_INFO_ERR);
|
---|
3103 | }
|
---|
3104 |
|
---|
3105 | //! \brief Wrapper for clGetMemObjectInfo() that returns by value.
|
---|
3106 | template <cl_mem_info name> typename
|
---|
3107 | detail::param_traits<detail::cl_mem_info, name>::param_type
|
---|
3108 | getInfo(cl_int* err = NULL) const
|
---|
3109 | {
|
---|
3110 | typename detail::param_traits<
|
---|
3111 | detail::cl_mem_info, name>::param_type param;
|
---|
3112 | cl_int result = getInfo(name, ¶m);
|
---|
3113 | if (err != NULL) {
|
---|
3114 | *err = result;
|
---|
3115 | }
|
---|
3116 | return param;
|
---|
3117 | }
|
---|
3118 |
|
---|
3119 | #if defined(CL_VERSION_1_1)
|
---|
3120 | /*! \brief Registers a callback function to be called when the memory object
|
---|
3121 | * is no longer needed.
|
---|
3122 | *
|
---|
3123 | * Wraps clSetMemObjectDestructorCallback().
|
---|
3124 | *
|
---|
3125 | * Repeated calls to this function, for a given cl_mem value, will append
|
---|
3126 | * to the list of functions called (in reverse order) when memory object's
|
---|
3127 | * resources are freed and the memory object is deleted.
|
---|
3128 | *
|
---|
3129 | * \note
|
---|
3130 | * The registered callbacks are associated with the underlying cl_mem
|
---|
3131 | * value - not the Memory class instance.
|
---|
3132 | */
|
---|
3133 | cl_int setDestructorCallback(
|
---|
3134 | void (CL_CALLBACK * pfn_notify)(cl_mem, void *),
|
---|
3135 | void * user_data = NULL)
|
---|
3136 | {
|
---|
3137 | return detail::errHandler(
|
---|
3138 | ::clSetMemObjectDestructorCallback(
|
---|
3139 | object_,
|
---|
3140 | pfn_notify,
|
---|
3141 | user_data),
|
---|
3142 | __SET_MEM_OBJECT_DESTRUCTOR_CALLBACK_ERR);
|
---|
3143 | }
|
---|
3144 | #endif
|
---|
3145 |
|
---|
3146 | };
|
---|
3147 |
|
---|
3148 | // Pre-declare copy functions
|
---|
3149 | class Buffer;
|
---|
3150 | template< typename IteratorType >
|
---|
3151 | cl_int copy( IteratorType startIterator, IteratorType endIterator, cl::Buffer &buffer );
|
---|
3152 | template< typename IteratorType >
|
---|
3153 | cl_int copy( const cl::Buffer &buffer, IteratorType startIterator, IteratorType endIterator );
|
---|
3154 | template< typename IteratorType >
|
---|
3155 | cl_int copy( const CommandQueue &queue, IteratorType startIterator, IteratorType endIterator, cl::Buffer &buffer );
|
---|
3156 | template< typename IteratorType >
|
---|
3157 | cl_int copy( const CommandQueue &queue, const cl::Buffer &buffer, IteratorType startIterator, IteratorType endIterator );
|
---|
3158 |
|
---|
3159 |
|
---|
3160 | /*! \brief Class interface for Buffer Memory Objects.
|
---|
3161 | *
|
---|
3162 | * See Memory for details about copy semantics, etc.
|
---|
3163 | *
|
---|
3164 | * \see Memory
|
---|
3165 | */
|
---|
3166 | class Buffer : public Memory
|
---|
3167 | {
|
---|
3168 | public:
|
---|
3169 |
|
---|
3170 | /*! \brief Constructs a Buffer in a specified context.
|
---|
3171 | *
|
---|
3172 | * Wraps clCreateBuffer().
|
---|
3173 | *
|
---|
3174 | * \param host_ptr Storage to be used if the CL_MEM_USE_HOST_PTR flag was
|
---|
3175 | * specified. Note alignment & exclusivity requirements.
|
---|
3176 | */
|
---|
3177 | Buffer(
|
---|
3178 | const Context& context,
|
---|
3179 | cl_mem_flags flags,
|
---|
3180 | ::size_t size,
|
---|
3181 | void* host_ptr = NULL,
|
---|
3182 | cl_int* err = NULL)
|
---|
3183 | {
|
---|
3184 | cl_int error;
|
---|
3185 | object_ = ::clCreateBuffer(context(), flags, size, host_ptr, &error);
|
---|
3186 |
|
---|
3187 | detail::errHandler(error, __CREATE_BUFFER_ERR);
|
---|
3188 | if (err != NULL) {
|
---|
3189 | *err = error;
|
---|
3190 | }
|
---|
3191 | }
|
---|
3192 |
|
---|
3193 | /*! \brief Constructs a Buffer in the default context.
|
---|
3194 | *
|
---|
3195 | * Wraps clCreateBuffer().
|
---|
3196 | *
|
---|
3197 | * \param host_ptr Storage to be used if the CL_MEM_USE_HOST_PTR flag was
|
---|
3198 | * specified. Note alignment & exclusivity requirements.
|
---|
3199 | *
|
---|
3200 | * \see Context::getDefault()
|
---|
3201 | */
|
---|
3202 | Buffer(
|
---|
3203 | cl_mem_flags flags,
|
---|
3204 | ::size_t size,
|
---|
3205 | void* host_ptr = NULL,
|
---|
3206 | cl_int* err = NULL)
|
---|
3207 | {
|
---|
3208 | cl_int error;
|
---|
3209 |
|
---|
3210 | Context context = Context::getDefault(err);
|
---|
3211 |
|
---|
3212 | object_ = ::clCreateBuffer(context(), flags, size, host_ptr, &error);
|
---|
3213 |
|
---|
3214 | detail::errHandler(error, __CREATE_BUFFER_ERR);
|
---|
3215 | if (err != NULL) {
|
---|
3216 | *err = error;
|
---|
3217 | }
|
---|
3218 | }
|
---|
3219 |
|
---|
3220 | /*!
|
---|
3221 | * \brief Construct a Buffer from a host container via iterators.
|
---|
3222 | * IteratorType must be random access.
|
---|
3223 | * If useHostPtr is specified iterators must represent contiguous data.
|
---|
3224 | */
|
---|
3225 | template< typename IteratorType >
|
---|
3226 | Buffer(
|
---|
3227 | IteratorType startIterator,
|
---|
3228 | IteratorType endIterator,
|
---|
3229 | bool readOnly,
|
---|
3230 | bool useHostPtr = false,
|
---|
3231 | cl_int* err = NULL)
|
---|
3232 | {
|
---|
3233 | typedef typename std::iterator_traits<IteratorType>::value_type DataType;
|
---|
3234 | cl_int error;
|
---|
3235 |
|
---|
3236 | cl_mem_flags flags = 0;
|
---|
3237 | if( readOnly ) {
|
---|
3238 | flags |= CL_MEM_READ_ONLY;
|
---|
3239 | }
|
---|
3240 | else {
|
---|
3241 | flags |= CL_MEM_READ_WRITE;
|
---|
3242 | }
|
---|
3243 | if( useHostPtr ) {
|
---|
3244 | flags |= CL_MEM_USE_HOST_PTR;
|
---|
3245 | }
|
---|
3246 |
|
---|
3247 | ::size_t size = sizeof(DataType)*(endIterator - startIterator);
|
---|
3248 |
|
---|
3249 | Context context = Context::getDefault(err);
|
---|
3250 |
|
---|
3251 | if( useHostPtr ) {
|
---|
3252 | object_ = ::clCreateBuffer(context(), flags, size, static_cast<DataType*>(&*startIterator), &error);
|
---|
3253 | } else {
|
---|
3254 | object_ = ::clCreateBuffer(context(), flags, size, 0, &error);
|
---|
3255 | }
|
---|
3256 |
|
---|
3257 | detail::errHandler(error, __CREATE_BUFFER_ERR);
|
---|
3258 | if (err != NULL) {
|
---|
3259 | *err = error;
|
---|
3260 | }
|
---|
3261 |
|
---|
3262 | if( !useHostPtr ) {
|
---|
3263 | error = cl::copy(startIterator, endIterator, *this);
|
---|
3264 | detail::errHandler(error, __CREATE_BUFFER_ERR);
|
---|
3265 | if (err != NULL) {
|
---|
3266 | *err = error;
|
---|
3267 | }
|
---|
3268 | }
|
---|
3269 | }
|
---|
3270 |
|
---|
3271 | /*!
|
---|
3272 | * \brief Construct a Buffer from a host container via iterators using a specified context.
|
---|
3273 | * IteratorType must be random access.
|
---|
3274 | * If useHostPtr is specified iterators must represent contiguous data.
|
---|
3275 | */
|
---|
3276 | template< typename IteratorType >
|
---|
3277 | Buffer(const Context &context, IteratorType startIterator, IteratorType endIterator,
|
---|
3278 | bool readOnly, bool useHostPtr = false, cl_int* err = NULL);
|
---|
3279 |
|
---|
3280 | /*!
|
---|
3281 | * \brief Construct a Buffer from a host container via iterators using a specified queue.
|
---|
3282 | * If useHostPtr is specified iterators must represent contiguous data.
|
---|
3283 | */
|
---|
3284 | template< typename IteratorType >
|
---|
3285 | Buffer(const CommandQueue &queue, IteratorType startIterator, IteratorType endIterator,
|
---|
3286 | bool readOnly, bool useHostPtr = false, cl_int* err = NULL);
|
---|
3287 |
|
---|
3288 | //! \brief Default constructor - initializes to NULL.
|
---|
3289 | Buffer() : Memory() { }
|
---|
3290 |
|
---|
3291 | /*! \brief Constructor from cl_mem - takes ownership.
|
---|
3292 | *
|
---|
3293 | * See Memory for further details.
|
---|
3294 | */
|
---|
3295 | __CL_EXPLICIT_CONSTRUCTORS Buffer(const cl_mem& buffer) : Memory(buffer) { }
|
---|
3296 |
|
---|
3297 | /*! \brief Assignment from cl_mem - performs shallow copy.
|
---|
3298 | *
|
---|
3299 | * See Memory for further details.
|
---|
3300 | */
|
---|
3301 | Buffer& operator = (const cl_mem& rhs)
|
---|
3302 | {
|
---|
3303 | Memory::operator=(rhs);
|
---|
3304 | return *this;
|
---|
3305 | }
|
---|
3306 |
|
---|
3307 | /*! \brief Copy constructor to forward copy to the superclass correctly.
|
---|
3308 | * Required for MSVC.
|
---|
3309 | */
|
---|
3310 | Buffer(const Buffer& buf) : Memory(buf) {}
|
---|
3311 |
|
---|
3312 | /*! \brief Copy assignment to forward copy to the superclass correctly.
|
---|
3313 | * Required for MSVC.
|
---|
3314 | */
|
---|
3315 | Buffer& operator = (const Buffer &buf)
|
---|
3316 | {
|
---|
3317 | Memory::operator=(buf);
|
---|
3318 | return *this;
|
---|
3319 | }
|
---|
3320 |
|
---|
3321 | #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
|
---|
3322 | /*! \brief Move constructor to forward move to the superclass correctly.
|
---|
3323 | * Required for MSVC.
|
---|
3324 | */
|
---|
3325 | Buffer(Buffer&& buf) CL_HPP_NOEXCEPT : Memory(std::move(buf)) {}
|
---|
3326 |
|
---|
3327 | /*! \brief Move assignment to forward move to the superclass correctly.
|
---|
3328 | * Required for MSVC.
|
---|
3329 | */
|
---|
3330 | Buffer& operator = (Buffer &&buf)
|
---|
3331 | {
|
---|
3332 | Memory::operator=(std::move(buf));
|
---|
3333 | return *this;
|
---|
3334 | }
|
---|
3335 | #endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
|
---|
3336 |
|
---|
3337 | #if defined(CL_VERSION_1_1)
|
---|
3338 | /*! \brief Creates a new buffer object from this.
|
---|
3339 | *
|
---|
3340 | * Wraps clCreateSubBuffer().
|
---|
3341 | */
|
---|
3342 | Buffer createSubBuffer(
|
---|
3343 | cl_mem_flags flags,
|
---|
3344 | cl_buffer_create_type buffer_create_type,
|
---|
3345 | const void * buffer_create_info,
|
---|
3346 | cl_int * err = NULL)
|
---|
3347 | {
|
---|
3348 | Buffer result;
|
---|
3349 | cl_int error;
|
---|
3350 | result.object_ = ::clCreateSubBuffer(
|
---|
3351 | object_,
|
---|
3352 | flags,
|
---|
3353 | buffer_create_type,
|
---|
3354 | buffer_create_info,
|
---|
3355 | &error);
|
---|
3356 |
|
---|
3357 | detail::errHandler(error, __CREATE_SUBBUFFER_ERR);
|
---|
3358 | if (err != NULL) {
|
---|
3359 | *err = error;
|
---|
3360 | }
|
---|
3361 |
|
---|
3362 | return result;
|
---|
3363 | }
|
---|
3364 | #endif
|
---|
3365 | };
|
---|
3366 |
|
---|
3367 | #if defined (USE_DX_INTEROP)
|
---|
3368 | /*! \brief Class interface for creating OpenCL buffers from ID3D10Buffer's.
|
---|
3369 | *
|
---|
3370 | * This is provided to facilitate interoperability with Direct3D.
|
---|
3371 | *
|
---|
3372 | * See Memory for details about copy semantics, etc.
|
---|
3373 | *
|
---|
3374 | * \see Memory
|
---|
3375 | */
|
---|
3376 | class BufferD3D10 : public Buffer
|
---|
3377 | {
|
---|
3378 | public:
|
---|
3379 | typedef CL_API_ENTRY cl_mem (CL_API_CALL *PFN_clCreateFromD3D10BufferKHR)(
|
---|
3380 | cl_context context, cl_mem_flags flags, ID3D10Buffer* buffer,
|
---|
3381 | cl_int* errcode_ret);
|
---|
3382 |
|
---|
3383 | /*! \brief Constructs a BufferD3D10, in a specified context, from a
|
---|
3384 | * given ID3D10Buffer.
|
---|
3385 | *
|
---|
3386 | * Wraps clCreateFromD3D10BufferKHR().
|
---|
3387 | */
|
---|
3388 | BufferD3D10(
|
---|
3389 | const Context& context,
|
---|
3390 | cl_mem_flags flags,
|
---|
3391 | ID3D10Buffer* bufobj,
|
---|
3392 | cl_int * err = NULL)
|
---|
3393 | {
|
---|
3394 | static PFN_clCreateFromD3D10BufferKHR pfn_clCreateFromD3D10BufferKHR = NULL;
|
---|
3395 |
|
---|
3396 | #if defined(CL_VERSION_1_2)
|
---|
3397 | vector<cl_context_properties> props = context.getInfo<CL_CONTEXT_PROPERTIES>();
|
---|
3398 | cl_platform platform = -1;
|
---|
3399 | for( int i = 0; i < props.size(); ++i ) {
|
---|
3400 | if( props[i] == CL_CONTEXT_PLATFORM ) {
|
---|
3401 | platform = props[i+1];
|
---|
3402 | }
|
---|
3403 | }
|
---|
3404 | __INIT_CL_EXT_FCN_PTR_PLATFORM(platform, clCreateFromD3D10BufferKHR);
|
---|
3405 | #endif
|
---|
3406 | #if defined(CL_VERSION_1_1)
|
---|
3407 | __INIT_CL_EXT_FCN_PTR(clCreateFromD3D10BufferKHR);
|
---|
3408 | #endif
|
---|
3409 |
|
---|
3410 | cl_int error;
|
---|
3411 | object_ = pfn_clCreateFromD3D10BufferKHR(
|
---|
3412 | context(),
|
---|
3413 | flags,
|
---|
3414 | bufobj,
|
---|
3415 | &error);
|
---|
3416 |
|
---|
3417 | detail::errHandler(error, __CREATE_GL_BUFFER_ERR);
|
---|
3418 | if (err != NULL) {
|
---|
3419 | *err = error;
|
---|
3420 | }
|
---|
3421 | }
|
---|
3422 |
|
---|
3423 | //! \brief Default constructor - initializes to NULL.
|
---|
3424 | BufferD3D10() : Buffer() { }
|
---|
3425 |
|
---|
3426 | /*! \brief Constructor from cl_mem - takes ownership.
|
---|
3427 | *
|
---|
3428 | * See Memory for further details.
|
---|
3429 | */
|
---|
3430 | __CL_EXPLICIT_CONSTRUCTORS BufferD3D10(const cl_mem& buffer) : Buffer(buffer) { }
|
---|
3431 |
|
---|
3432 | /*! \brief Assignment from cl_mem - performs shallow copy.
|
---|
3433 | *
|
---|
3434 | * See Memory for further details.
|
---|
3435 | */
|
---|
3436 | BufferD3D10& operator = (const cl_mem& rhs)
|
---|
3437 | {
|
---|
3438 | Buffer::operator=(rhs);
|
---|
3439 | return *this;
|
---|
3440 | }
|
---|
3441 |
|
---|
3442 | /*! \brief Copy constructor to forward copy to the superclass correctly.
|
---|
3443 | * Required for MSVC.
|
---|
3444 | */
|
---|
3445 | BufferD3D10(const BufferD3D10& buf) : Buffer(buf) {}
|
---|
3446 |
|
---|
3447 | /*! \brief Copy assignment to forward copy to the superclass correctly.
|
---|
3448 | * Required for MSVC.
|
---|
3449 | */
|
---|
3450 | BufferD3D10& operator = (const BufferD3D10 &buf)
|
---|
3451 | {
|
---|
3452 | Buffer::operator=(buf);
|
---|
3453 | return *this;
|
---|
3454 | }
|
---|
3455 |
|
---|
3456 | #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
|
---|
3457 | /*! \brief Move constructor to forward move to the superclass correctly.
|
---|
3458 | * Required for MSVC.
|
---|
3459 | */
|
---|
3460 | BufferD3D10(BufferD3D10&& buf) CL_HPP_NOEXCEPT : Buffer(std::move(buf)) {}
|
---|
3461 |
|
---|
3462 | /*! \brief Move assignment to forward move to the superclass correctly.
|
---|
3463 | * Required for MSVC.
|
---|
3464 | */
|
---|
3465 | BufferD3D10& operator = (BufferD3D10 &&buf)
|
---|
3466 | {
|
---|
3467 | Buffer::operator=(std::move(buf));
|
---|
3468 | return *this;
|
---|
3469 | }
|
---|
3470 | #endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
|
---|
3471 | };
|
---|
3472 | #endif
|
---|
3473 |
|
---|
3474 | /*! \brief Class interface for GL Buffer Memory Objects.
|
---|
3475 | *
|
---|
3476 | * This is provided to facilitate interoperability with OpenGL.
|
---|
3477 | *
|
---|
3478 | * See Memory for details about copy semantics, etc.
|
---|
3479 | *
|
---|
3480 | * \see Memory
|
---|
3481 | */
|
---|
3482 | class BufferGL : public Buffer
|
---|
3483 | {
|
---|
3484 | public:
|
---|
3485 | /*! \brief Constructs a BufferGL in a specified context, from a given
|
---|
3486 | * GL buffer.
|
---|
3487 | *
|
---|
3488 | * Wraps clCreateFromGLBuffer().
|
---|
3489 | */
|
---|
3490 | BufferGL(
|
---|
3491 | const Context& context,
|
---|
3492 | cl_mem_flags flags,
|
---|
3493 | cl_GLuint bufobj,
|
---|
3494 | cl_int * err = NULL)
|
---|
3495 | {
|
---|
3496 | cl_int error;
|
---|
3497 | object_ = ::clCreateFromGLBuffer(
|
---|
3498 | context(),
|
---|
3499 | flags,
|
---|
3500 | bufobj,
|
---|
3501 | &error);
|
---|
3502 |
|
---|
3503 | detail::errHandler(error, __CREATE_GL_BUFFER_ERR);
|
---|
3504 | if (err != NULL) {
|
---|
3505 | *err = error;
|
---|
3506 | }
|
---|
3507 | }
|
---|
3508 |
|
---|
3509 | //! \brief Default constructor - initializes to NULL.
|
---|
3510 | BufferGL() : Buffer() { }
|
---|
3511 |
|
---|
3512 | /*! \brief Constructor from cl_mem - takes ownership.
|
---|
3513 | *
|
---|
3514 | * See Memory for further details.
|
---|
3515 | */
|
---|
3516 | __CL_EXPLICIT_CONSTRUCTORS BufferGL(const cl_mem& buffer) : Buffer(buffer) { }
|
---|
3517 |
|
---|
3518 | /*! \brief Assignment from cl_mem - performs shallow copy.
|
---|
3519 | *
|
---|
3520 | * See Memory for further details.
|
---|
3521 | */
|
---|
3522 | BufferGL& operator = (const cl_mem& rhs)
|
---|
3523 | {
|
---|
3524 | Buffer::operator=(rhs);
|
---|
3525 | return *this;
|
---|
3526 | }
|
---|
3527 |
|
---|
3528 | /*! \brief Copy constructor to forward copy to the superclass correctly.
|
---|
3529 | * Required for MSVC.
|
---|
3530 | */
|
---|
3531 | BufferGL(const BufferGL& buf) : Buffer(buf) {}
|
---|
3532 |
|
---|
3533 | /*! \brief Copy assignment to forward copy to the superclass correctly.
|
---|
3534 | * Required for MSVC.
|
---|
3535 | */
|
---|
3536 | BufferGL& operator = (const BufferGL &buf)
|
---|
3537 | {
|
---|
3538 | Buffer::operator=(buf);
|
---|
3539 | return *this;
|
---|
3540 | }
|
---|
3541 |
|
---|
3542 | #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
|
---|
3543 | /*! \brief Move constructor to forward move to the superclass correctly.
|
---|
3544 | * Required for MSVC.
|
---|
3545 | */
|
---|
3546 | BufferGL(BufferGL&& buf) CL_HPP_NOEXCEPT : Buffer(std::move(buf)) {}
|
---|
3547 |
|
---|
3548 | /*! \brief Move assignment to forward move to the superclass correctly.
|
---|
3549 | * Required for MSVC.
|
---|
3550 | */
|
---|
3551 | BufferGL& operator = (BufferGL &&buf)
|
---|
3552 | {
|
---|
3553 | Buffer::operator=(std::move(buf));
|
---|
3554 | return *this;
|
---|
3555 | }
|
---|
3556 | #endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
|
---|
3557 |
|
---|
3558 | //! \brief Wrapper for clGetGLObjectInfo().
|
---|
3559 | cl_int getObjectInfo(
|
---|
3560 | cl_gl_object_type *type,
|
---|
3561 | cl_GLuint * gl_object_name)
|
---|
3562 | {
|
---|
3563 | return detail::errHandler(
|
---|
3564 | ::clGetGLObjectInfo(object_,type,gl_object_name),
|
---|
3565 | __GET_GL_OBJECT_INFO_ERR);
|
---|
3566 | }
|
---|
3567 | };
|
---|
3568 |
|
---|
3569 | /*! \brief C++ base class for Image Memory objects.
|
---|
3570 | *
|
---|
3571 | * See Memory for details about copy semantics, etc.
|
---|
3572 | *
|
---|
3573 | * \see Memory
|
---|
3574 | */
|
---|
3575 | class Image : public Memory
|
---|
3576 | {
|
---|
3577 | protected:
|
---|
3578 | //! \brief Default constructor - initializes to NULL.
|
---|
3579 | Image() : Memory() { }
|
---|
3580 |
|
---|
3581 | /*! \brief Constructor from cl_mem - takes ownership.
|
---|
3582 | *
|
---|
3583 | * See Memory for further details.
|
---|
3584 | */
|
---|
3585 | __CL_EXPLICIT_CONSTRUCTORS Image(const cl_mem& image) : Memory(image) { }
|
---|
3586 |
|
---|
3587 | /*! \brief Assignment from cl_mem - performs shallow copy.
|
---|
3588 | *
|
---|
3589 | * See Memory for further details.
|
---|
3590 | */
|
---|
3591 | Image& operator = (const cl_mem& rhs)
|
---|
3592 | {
|
---|
3593 | Memory::operator=(rhs);
|
---|
3594 | return *this;
|
---|
3595 | }
|
---|
3596 |
|
---|
3597 | /*! \brief Copy constructor to forward copy to the superclass correctly.
|
---|
3598 | * Required for MSVC.
|
---|
3599 | */
|
---|
3600 | Image(const Image& img) : Memory(img) {}
|
---|
3601 |
|
---|
3602 | /*! \brief Copy assignment to forward copy to the superclass correctly.
|
---|
3603 | * Required for MSVC.
|
---|
3604 | */
|
---|
3605 | Image& operator = (const Image &img)
|
---|
3606 | {
|
---|
3607 | Memory::operator=(img);
|
---|
3608 | return *this;
|
---|
3609 | }
|
---|
3610 |
|
---|
3611 | #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
|
---|
3612 | /*! \brief Move constructor to forward move to the superclass correctly.
|
---|
3613 | * Required for MSVC.
|
---|
3614 | */
|
---|
3615 | Image(Image&& img) CL_HPP_NOEXCEPT : Memory(std::move(img)) {}
|
---|
3616 |
|
---|
3617 | /*! \brief Move assignment to forward move to the superclass correctly.
|
---|
3618 | * Required for MSVC.
|
---|
3619 | */
|
---|
3620 | Image& operator = (Image &&img)
|
---|
3621 | {
|
---|
3622 | Memory::operator=(std::move(img));
|
---|
3623 | return *this;
|
---|
3624 | }
|
---|
3625 | #endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
|
---|
3626 |
|
---|
3627 | public:
|
---|
3628 | //! \brief Wrapper for clGetImageInfo().
|
---|
3629 | template <typename T>
|
---|
3630 | cl_int getImageInfo(cl_image_info name, T* param) const
|
---|
3631 | {
|
---|
3632 | return detail::errHandler(
|
---|
3633 | detail::getInfo(&::clGetImageInfo, object_, name, param),
|
---|
3634 | __GET_IMAGE_INFO_ERR);
|
---|
3635 | }
|
---|
3636 |
|
---|
3637 | //! \brief Wrapper for clGetImageInfo() that returns by value.
|
---|
3638 | template <cl_image_info name> typename
|
---|
3639 | detail::param_traits<detail::cl_image_info, name>::param_type
|
---|
3640 | getImageInfo(cl_int* err = NULL) const
|
---|
3641 | {
|
---|
3642 | typename detail::param_traits<
|
---|
3643 | detail::cl_image_info, name>::param_type param;
|
---|
3644 | cl_int result = getImageInfo(name, ¶m);
|
---|
3645 | if (err != NULL) {
|
---|
3646 | *err = result;
|
---|
3647 | }
|
---|
3648 | return param;
|
---|
3649 | }
|
---|
3650 | };
|
---|
3651 |
|
---|
3652 | #if defined(CL_VERSION_1_2)
|
---|
3653 | /*! \brief Class interface for 1D Image Memory objects.
|
---|
3654 | *
|
---|
3655 | * See Memory for details about copy semantics, etc.
|
---|
3656 | *
|
---|
3657 | * \see Memory
|
---|
3658 | */
|
---|
3659 | class Image1D : public Image
|
---|
3660 | {
|
---|
3661 | public:
|
---|
3662 | /*! \brief Constructs a 1D Image in a specified context.
|
---|
3663 | *
|
---|
3664 | * Wraps clCreateImage().
|
---|
3665 | */
|
---|
3666 | Image1D(
|
---|
3667 | const Context& context,
|
---|
3668 | cl_mem_flags flags,
|
---|
3669 | ImageFormat format,
|
---|
3670 | ::size_t width,
|
---|
3671 | void* host_ptr = NULL,
|
---|
3672 | cl_int* err = NULL)
|
---|
3673 | {
|
---|
3674 | cl_int error;
|
---|
3675 | cl_image_desc desc =
|
---|
3676 | {
|
---|
3677 | CL_MEM_OBJECT_IMAGE1D,
|
---|
3678 | width,
|
---|
3679 | 0, 0, 0, 0, 0, 0, 0, 0
|
---|
3680 | };
|
---|
3681 | object_ = ::clCreateImage(
|
---|
3682 | context(),
|
---|
3683 | flags,
|
---|
3684 | &format,
|
---|
3685 | &desc,
|
---|
3686 | host_ptr,
|
---|
3687 | &error);
|
---|
3688 |
|
---|
3689 | detail::errHandler(error, __CREATE_IMAGE_ERR);
|
---|
3690 | if (err != NULL) {
|
---|
3691 | *err = error;
|
---|
3692 | }
|
---|
3693 | }
|
---|
3694 |
|
---|
3695 | //! \brief Default constructor - initializes to NULL.
|
---|
3696 | Image1D() { }
|
---|
3697 |
|
---|
3698 | /*! \brief Constructor from cl_mem - takes ownership.
|
---|
3699 | *
|
---|
3700 | * See Memory for further details.
|
---|
3701 | */
|
---|
3702 | __CL_EXPLICIT_CONSTRUCTORS Image1D(const cl_mem& image1D) : Image(image1D) { }
|
---|
3703 |
|
---|
3704 | /*! \brief Assignment from cl_mem - performs shallow copy.
|
---|
3705 | *
|
---|
3706 | * See Memory for further details.
|
---|
3707 | */
|
---|
3708 | Image1D& operator = (const cl_mem& rhs)
|
---|
3709 | {
|
---|
3710 | Image::operator=(rhs);
|
---|
3711 | return *this;
|
---|
3712 | }
|
---|
3713 |
|
---|
3714 | /*! \brief Copy constructor to forward copy to the superclass correctly.
|
---|
3715 | * Required for MSVC.
|
---|
3716 | */
|
---|
3717 | Image1D(const Image1D& img) : Image(img) {}
|
---|
3718 |
|
---|
3719 | /*! \brief Copy assignment to forward copy to the superclass correctly.
|
---|
3720 | * Required for MSVC.
|
---|
3721 | */
|
---|
3722 | Image1D& operator = (const Image1D &img)
|
---|
3723 | {
|
---|
3724 | Image::operator=(img);
|
---|
3725 | return *this;
|
---|
3726 | }
|
---|
3727 |
|
---|
3728 | #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
|
---|
3729 | /*! \brief Move constructor to forward move to the superclass correctly.
|
---|
3730 | * Required for MSVC.
|
---|
3731 | */
|
---|
3732 | Image1D(Image1D&& img) CL_HPP_NOEXCEPT : Image(std::move(img)) {}
|
---|
3733 |
|
---|
3734 | /*! \brief Move assignment to forward move to the superclass correctly.
|
---|
3735 | * Required for MSVC.
|
---|
3736 | */
|
---|
3737 | Image1D& operator = (Image1D &&img)
|
---|
3738 | {
|
---|
3739 | Image::operator=(std::move(img));
|
---|
3740 | return *this;
|
---|
3741 | }
|
---|
3742 | #endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
|
---|
3743 | };
|
---|
3744 |
|
---|
3745 | /*! \class Image1DBuffer
|
---|
3746 | * \brief Image interface for 1D buffer images.
|
---|
3747 | */
|
---|
3748 | class Image1DBuffer : public Image
|
---|
3749 | {
|
---|
3750 | public:
|
---|
3751 | Image1DBuffer(
|
---|
3752 | const Context& context,
|
---|
3753 | cl_mem_flags flags,
|
---|
3754 | ImageFormat format,
|
---|
3755 | ::size_t width,
|
---|
3756 | const Buffer &buffer,
|
---|
3757 | cl_int* err = NULL)
|
---|
3758 | {
|
---|
3759 | cl_int error;
|
---|
3760 | cl_image_desc desc =
|
---|
3761 | {
|
---|
3762 | CL_MEM_OBJECT_IMAGE1D_BUFFER,
|
---|
3763 | width,
|
---|
3764 | 0, 0, 0, 0, 0, 0, 0,
|
---|
3765 | buffer()
|
---|
3766 | };
|
---|
3767 | object_ = ::clCreateImage(
|
---|
3768 | context(),
|
---|
3769 | flags,
|
---|
3770 | &format,
|
---|
3771 | &desc,
|
---|
3772 | NULL,
|
---|
3773 | &error);
|
---|
3774 |
|
---|
3775 | detail::errHandler(error, __CREATE_IMAGE_ERR);
|
---|
3776 | if (err != NULL) {
|
---|
3777 | *err = error;
|
---|
3778 | }
|
---|
3779 | }
|
---|
3780 |
|
---|
3781 | Image1DBuffer() { }
|
---|
3782 |
|
---|
3783 | __CL_EXPLICIT_CONSTRUCTORS Image1DBuffer(const cl_mem& image1D) : Image(image1D) { }
|
---|
3784 |
|
---|
3785 | Image1DBuffer& operator = (const cl_mem& rhs)
|
---|
3786 | {
|
---|
3787 | Image::operator=(rhs);
|
---|
3788 | return *this;
|
---|
3789 | }
|
---|
3790 |
|
---|
3791 | /*! \brief Copy constructor to forward copy to the superclass correctly.
|
---|
3792 | * Required for MSVC.
|
---|
3793 | */
|
---|
3794 | Image1DBuffer(const Image1DBuffer& img) : Image(img) {}
|
---|
3795 |
|
---|
3796 | /*! \brief Copy assignment to forward copy to the superclass correctly.
|
---|
3797 | * Required for MSVC.
|
---|
3798 | */
|
---|
3799 | Image1DBuffer& operator = (const Image1DBuffer &img)
|
---|
3800 | {
|
---|
3801 | Image::operator=(img);
|
---|
3802 | return *this;
|
---|
3803 | }
|
---|
3804 |
|
---|
3805 | #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
|
---|
3806 | /*! \brief Move constructor to forward move to the superclass correctly.
|
---|
3807 | * Required for MSVC.
|
---|
3808 | */
|
---|
3809 | Image1DBuffer(Image1DBuffer&& img) CL_HPP_NOEXCEPT : Image(std::move(img)) {}
|
---|
3810 |
|
---|
3811 | /*! \brief Move assignment to forward move to the superclass correctly.
|
---|
3812 | * Required for MSVC.
|
---|
3813 | */
|
---|
3814 | Image1DBuffer& operator = (Image1DBuffer &&img)
|
---|
3815 | {
|
---|
3816 | Image::operator=(std::move(img));
|
---|
3817 | return *this;
|
---|
3818 | }
|
---|
3819 | #endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
|
---|
3820 | };
|
---|
3821 |
|
---|
3822 | /*! \class Image1DArray
|
---|
3823 | * \brief Image interface for arrays of 1D images.
|
---|
3824 | */
|
---|
3825 | class Image1DArray : public Image
|
---|
3826 | {
|
---|
3827 | public:
|
---|
3828 | Image1DArray(
|
---|
3829 | const Context& context,
|
---|
3830 | cl_mem_flags flags,
|
---|
3831 | ImageFormat format,
|
---|
3832 | ::size_t arraySize,
|
---|
3833 | ::size_t width,
|
---|
3834 | ::size_t rowPitch,
|
---|
3835 | void* host_ptr = NULL,
|
---|
3836 | cl_int* err = NULL)
|
---|
3837 | {
|
---|
3838 | cl_int error;
|
---|
3839 | cl_image_desc desc =
|
---|
3840 | {
|
---|
3841 | CL_MEM_OBJECT_IMAGE1D_ARRAY,
|
---|
3842 | width,
|
---|
3843 | 0, 0, // height, depth (unused)
|
---|
3844 | arraySize,
|
---|
3845 | rowPitch,
|
---|
3846 | 0, 0, 0, 0
|
---|
3847 | };
|
---|
3848 | object_ = ::clCreateImage(
|
---|
3849 | context(),
|
---|
3850 | flags,
|
---|
3851 | &format,
|
---|
3852 | &desc,
|
---|
3853 | host_ptr,
|
---|
3854 | &error);
|
---|
3855 |
|
---|
3856 | detail::errHandler(error, __CREATE_IMAGE_ERR);
|
---|
3857 | if (err != NULL) {
|
---|
3858 | *err = error;
|
---|
3859 | }
|
---|
3860 | }
|
---|
3861 |
|
---|
3862 | Image1DArray() { }
|
---|
3863 |
|
---|
3864 | __CL_EXPLICIT_CONSTRUCTORS Image1DArray(const cl_mem& imageArray) : Image(imageArray) { }
|
---|
3865 |
|
---|
3866 | Image1DArray& operator = (const cl_mem& rhs)
|
---|
3867 | {
|
---|
3868 | Image::operator=(rhs);
|
---|
3869 | return *this;
|
---|
3870 | }
|
---|
3871 |
|
---|
3872 | /*! \brief Copy constructor to forward copy to the superclass correctly.
|
---|
3873 | * Required for MSVC.
|
---|
3874 | */
|
---|
3875 | Image1DArray(const Image1DArray& img) : Image(img) {}
|
---|
3876 |
|
---|
3877 | /*! \brief Copy assignment to forward copy to the superclass correctly.
|
---|
3878 | * Required for MSVC.
|
---|
3879 | */
|
---|
3880 | Image1DArray& operator = (const Image1DArray &img)
|
---|
3881 | {
|
---|
3882 | Image::operator=(img);
|
---|
3883 | return *this;
|
---|
3884 | }
|
---|
3885 |
|
---|
3886 | #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
|
---|
3887 | /*! \brief Move constructor to forward move to the superclass correctly.
|
---|
3888 | * Required for MSVC.
|
---|
3889 | */
|
---|
3890 | Image1DArray(Image1DArray&& img) CL_HPP_NOEXCEPT : Image(std::move(img)) {}
|
---|
3891 |
|
---|
3892 | /*! \brief Move assignment to forward move to the superclass correctly.
|
---|
3893 | * Required for MSVC.
|
---|
3894 | */
|
---|
3895 | Image1DArray& operator = (Image1DArray &&img)
|
---|
3896 | {
|
---|
3897 | Image::operator=(std::move(img));
|
---|
3898 | return *this;
|
---|
3899 | }
|
---|
3900 | #endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
|
---|
3901 | };
|
---|
3902 | #endif // #if defined(CL_VERSION_1_2)
|
---|
3903 |
|
---|
3904 |
|
---|
3905 | /*! \brief Class interface for 2D Image Memory objects.
|
---|
3906 | *
|
---|
3907 | * See Memory for details about copy semantics, etc.
|
---|
3908 | *
|
---|
3909 | * \see Memory
|
---|
3910 | */
|
---|
3911 | class Image2D : public Image
|
---|
3912 | {
|
---|
3913 | public:
|
---|
3914 | /*! \brief Constructs a 1D Image in a specified context.
|
---|
3915 | *
|
---|
3916 | * Wraps clCreateImage().
|
---|
3917 | */
|
---|
3918 | Image2D(
|
---|
3919 | const Context& context,
|
---|
3920 | cl_mem_flags flags,
|
---|
3921 | ImageFormat format,
|
---|
3922 | ::size_t width,
|
---|
3923 | ::size_t height,
|
---|
3924 | ::size_t row_pitch = 0,
|
---|
3925 | void* host_ptr = NULL,
|
---|
3926 | cl_int* err = NULL)
|
---|
3927 | {
|
---|
3928 | cl_int error;
|
---|
3929 | bool useCreateImage;
|
---|
3930 |
|
---|
3931 | #if defined(CL_VERSION_1_2) && defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS)
|
---|
3932 | // Run-time decision based on the actual platform
|
---|
3933 | {
|
---|
3934 | cl_uint version = detail::getContextPlatformVersion(context());
|
---|
3935 | useCreateImage = (version >= 0x10002); // OpenCL 1.2 or above
|
---|
3936 | }
|
---|
3937 | #elif defined(CL_VERSION_1_2)
|
---|
3938 | useCreateImage = true;
|
---|
3939 | #else
|
---|
3940 | useCreateImage = false;
|
---|
3941 | #endif
|
---|
3942 |
|
---|
3943 | #if defined(CL_VERSION_1_2)
|
---|
3944 | if (useCreateImage)
|
---|
3945 | {
|
---|
3946 | cl_image_desc desc =
|
---|
3947 | {
|
---|
3948 | CL_MEM_OBJECT_IMAGE2D,
|
---|
3949 | width,
|
---|
3950 | height,
|
---|
3951 | 0, 0, // depth, array size (unused)
|
---|
3952 | row_pitch,
|
---|
3953 | 0, 0, 0, 0
|
---|
3954 | };
|
---|
3955 | object_ = ::clCreateImage(
|
---|
3956 | context(),
|
---|
3957 | flags,
|
---|
3958 | &format,
|
---|
3959 | &desc,
|
---|
3960 | host_ptr,
|
---|
3961 | &error);
|
---|
3962 |
|
---|
3963 | detail::errHandler(error, __CREATE_IMAGE_ERR);
|
---|
3964 | if (err != NULL) {
|
---|
3965 | *err = error;
|
---|
3966 | }
|
---|
3967 | }
|
---|
3968 | #endif // #if defined(CL_VERSION_1_2)
|
---|
3969 | #if !defined(CL_VERSION_1_2) || defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS)
|
---|
3970 | if (!useCreateImage)
|
---|
3971 | {
|
---|
3972 | object_ = ::clCreateImage2D(
|
---|
3973 | context(), flags,&format, width, height, row_pitch, host_ptr, &error);
|
---|
3974 |
|
---|
3975 | detail::errHandler(error, __CREATE_IMAGE2D_ERR);
|
---|
3976 | if (err != NULL) {
|
---|
3977 | *err = error;
|
---|
3978 | }
|
---|
3979 | }
|
---|
3980 | #endif // #if !defined(CL_VERSION_1_2) || defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS)
|
---|
3981 | }
|
---|
3982 |
|
---|
3983 | //! \brief Default constructor - initializes to NULL.
|
---|
3984 | Image2D() { }
|
---|
3985 |
|
---|
3986 | /*! \brief Constructor from cl_mem - takes ownership.
|
---|
3987 | *
|
---|
3988 | * See Memory for further details.
|
---|
3989 | */
|
---|
3990 | __CL_EXPLICIT_CONSTRUCTORS Image2D(const cl_mem& image2D) : Image(image2D) { }
|
---|
3991 |
|
---|
3992 | /*! \brief Assignment from cl_mem - performs shallow copy.
|
---|
3993 | *
|
---|
3994 | * See Memory for further details.
|
---|
3995 | */
|
---|
3996 | Image2D& operator = (const cl_mem& rhs)
|
---|
3997 | {
|
---|
3998 | Image::operator=(rhs);
|
---|
3999 | return *this;
|
---|
4000 | }
|
---|
4001 |
|
---|
4002 | /*! \brief Copy constructor to forward copy to the superclass correctly.
|
---|
4003 | * Required for MSVC.
|
---|
4004 | */
|
---|
4005 | Image2D(const Image2D& img) : Image(img) {}
|
---|
4006 |
|
---|
4007 | /*! \brief Copy assignment to forward copy to the superclass correctly.
|
---|
4008 | * Required for MSVC.
|
---|
4009 | */
|
---|
4010 | Image2D& operator = (const Image2D &img)
|
---|
4011 | {
|
---|
4012 | Image::operator=(img);
|
---|
4013 | return *this;
|
---|
4014 | }
|
---|
4015 |
|
---|
4016 | #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
|
---|
4017 | /*! \brief Move constructor to forward move to the superclass correctly.
|
---|
4018 | * Required for MSVC.
|
---|
4019 | */
|
---|
4020 | Image2D(Image2D&& img) CL_HPP_NOEXCEPT : Image(std::move(img)) {}
|
---|
4021 |
|
---|
4022 | /*! \brief Move assignment to forward move to the superclass correctly.
|
---|
4023 | * Required for MSVC.
|
---|
4024 | */
|
---|
4025 | Image2D& operator = (Image2D &&img)
|
---|
4026 | {
|
---|
4027 | Image::operator=(std::move(img));
|
---|
4028 | return *this;
|
---|
4029 | }
|
---|
4030 | #endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
|
---|
4031 | };
|
---|
4032 |
|
---|
4033 |
|
---|
4034 | #if !defined(CL_VERSION_1_2)
|
---|
4035 | /*! \brief Class interface for GL 2D Image Memory objects.
|
---|
4036 | *
|
---|
4037 | * This is provided to facilitate interoperability with OpenGL.
|
---|
4038 | *
|
---|
4039 | * See Memory for details about copy semantics, etc.
|
---|
4040 | *
|
---|
4041 | * \see Memory
|
---|
4042 | * \note Deprecated for OpenCL 1.2. Please use ImageGL instead.
|
---|
4043 | */
|
---|
4044 | class CL_EXT_PREFIX__VERSION_1_1_DEPRECATED Image2DGL CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED : public Image2D
|
---|
4045 | {
|
---|
4046 | public:
|
---|
4047 | /*! \brief Constructs an Image2DGL in a specified context, from a given
|
---|
4048 | * GL Texture.
|
---|
4049 | *
|
---|
4050 | * Wraps clCreateFromGLTexture2D().
|
---|
4051 | */
|
---|
4052 | Image2DGL(
|
---|
4053 | const Context& context,
|
---|
4054 | cl_mem_flags flags,
|
---|
4055 | cl_GLenum target,
|
---|
4056 | cl_GLint miplevel,
|
---|
4057 | cl_GLuint texobj,
|
---|
4058 | cl_int * err = NULL)
|
---|
4059 | {
|
---|
4060 | cl_int error;
|
---|
4061 | object_ = ::clCreateFromGLTexture2D(
|
---|
4062 | context(),
|
---|
4063 | flags,
|
---|
4064 | target,
|
---|
4065 | miplevel,
|
---|
4066 | texobj,
|
---|
4067 | &error);
|
---|
4068 |
|
---|
4069 | detail::errHandler(error, __CREATE_GL_TEXTURE_2D_ERR);
|
---|
4070 | if (err != NULL) {
|
---|
4071 | *err = error;
|
---|
4072 | }
|
---|
4073 |
|
---|
4074 | }
|
---|
4075 |
|
---|
4076 | //! \brief Default constructor - initializes to NULL.
|
---|
4077 | Image2DGL() : Image2D() { }
|
---|
4078 |
|
---|
4079 | /*! \brief Constructor from cl_mem - takes ownership.
|
---|
4080 | *
|
---|
4081 | * See Memory for further details.
|
---|
4082 | */
|
---|
4083 | __CL_EXPLICIT_CONSTRUCTORS Image2DGL(const cl_mem& image) : Image2D(image) { }
|
---|
4084 |
|
---|
4085 | /*! \brief Assignment from cl_mem - performs shallow copy.
|
---|
4086 | *
|
---|
4087 | * See Memory for further details.
|
---|
4088 | */
|
---|
4089 | Image2DGL& operator = (const cl_mem& rhs)
|
---|
4090 | {
|
---|
4091 | Image2D::operator=(rhs);
|
---|
4092 | return *this;
|
---|
4093 | }
|
---|
4094 |
|
---|
4095 | /*! \brief Copy constructor to forward copy to the superclass correctly.
|
---|
4096 | * Required for MSVC.
|
---|
4097 | */
|
---|
4098 | Image2DGL(const Image2DGL& img) : Image2D(img) {}
|
---|
4099 |
|
---|
4100 | /*! \brief Copy assignment to forward copy to the superclass correctly.
|
---|
4101 | * Required for MSVC.
|
---|
4102 | */
|
---|
4103 | Image2DGL& operator = (const Image2DGL &img)
|
---|
4104 | {
|
---|
4105 | Image2D::operator=(img);
|
---|
4106 | return *this;
|
---|
4107 | }
|
---|
4108 |
|
---|
4109 | #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
|
---|
4110 | /*! \brief Move constructor to forward move to the superclass correctly.
|
---|
4111 | * Required for MSVC.
|
---|
4112 | */
|
---|
4113 | Image2DGL(Image2DGL&& img) CL_HPP_NOEXCEPT : Image2D(std::move(img)) {}
|
---|
4114 |
|
---|
4115 | /*! \brief Move assignment to forward move to the superclass correctly.
|
---|
4116 | * Required for MSVC.
|
---|
4117 | */
|
---|
4118 | Image2DGL& operator = (Image2DGL &&img)
|
---|
4119 | {
|
---|
4120 | Image2D::operator=(std::move(img));
|
---|
4121 | return *this;
|
---|
4122 | }
|
---|
4123 | #endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
|
---|
4124 | };
|
---|
4125 | #endif // #if !defined(CL_VERSION_1_2)
|
---|
4126 |
|
---|
4127 | #if defined(CL_VERSION_1_2)
|
---|
4128 | /*! \class Image2DArray
|
---|
4129 | * \brief Image interface for arrays of 2D images.
|
---|
4130 | */
|
---|
4131 | class Image2DArray : public Image
|
---|
4132 | {
|
---|
4133 | public:
|
---|
4134 | Image2DArray(
|
---|
4135 | const Context& context,
|
---|
4136 | cl_mem_flags flags,
|
---|
4137 | ImageFormat format,
|
---|
4138 | ::size_t arraySize,
|
---|
4139 | ::size_t width,
|
---|
4140 | ::size_t height,
|
---|
4141 | ::size_t rowPitch,
|
---|
4142 | ::size_t slicePitch,
|
---|
4143 | void* host_ptr = NULL,
|
---|
4144 | cl_int* err = NULL)
|
---|
4145 | {
|
---|
4146 | cl_int error;
|
---|
4147 | cl_image_desc desc =
|
---|
4148 | {
|
---|
4149 | CL_MEM_OBJECT_IMAGE2D_ARRAY,
|
---|
4150 | width,
|
---|
4151 | height,
|
---|
4152 | 0, // depth (unused)
|
---|
4153 | arraySize,
|
---|
4154 | rowPitch,
|
---|
4155 | slicePitch,
|
---|
4156 | 0, 0, 0
|
---|
4157 | };
|
---|
4158 | object_ = ::clCreateImage(
|
---|
4159 | context(),
|
---|
4160 | flags,
|
---|
4161 | &format,
|
---|
4162 | &desc,
|
---|
4163 | host_ptr,
|
---|
4164 | &error);
|
---|
4165 |
|
---|
4166 | detail::errHandler(error, __CREATE_IMAGE_ERR);
|
---|
4167 | if (err != NULL) {
|
---|
4168 | *err = error;
|
---|
4169 | }
|
---|
4170 | }
|
---|
4171 |
|
---|
4172 | Image2DArray() { }
|
---|
4173 |
|
---|
4174 | __CL_EXPLICIT_CONSTRUCTORS Image2DArray(const cl_mem& imageArray) : Image(imageArray) { }
|
---|
4175 |
|
---|
4176 | Image2DArray& operator = (const cl_mem& rhs)
|
---|
4177 | {
|
---|
4178 | Image::operator=(rhs);
|
---|
4179 | return *this;
|
---|
4180 | }
|
---|
4181 |
|
---|
4182 | /*! \brief Copy constructor to forward copy to the superclass correctly.
|
---|
4183 | * Required for MSVC.
|
---|
4184 | */
|
---|
4185 | Image2DArray(const Image2DArray& img) : Image(img) {}
|
---|
4186 |
|
---|
4187 | /*! \brief Copy assignment to forward copy to the superclass correctly.
|
---|
4188 | * Required for MSVC.
|
---|
4189 | */
|
---|
4190 | Image2DArray& operator = (const Image2DArray &img)
|
---|
4191 | {
|
---|
4192 | Image::operator=(img);
|
---|
4193 | return *this;
|
---|
4194 | }
|
---|
4195 |
|
---|
4196 | #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
|
---|
4197 | /*! \brief Move constructor to forward move to the superclass correctly.
|
---|
4198 | * Required for MSVC.
|
---|
4199 | */
|
---|
4200 | Image2DArray(Image2DArray&& img) CL_HPP_NOEXCEPT : Image(std::move(img)) {}
|
---|
4201 |
|
---|
4202 | /*! \brief Move assignment to forward move to the superclass correctly.
|
---|
4203 | * Required for MSVC.
|
---|
4204 | */
|
---|
4205 | Image2DArray& operator = (Image2DArray &&img)
|
---|
4206 | {
|
---|
4207 | Image::operator=(std::move(img));
|
---|
4208 | return *this;
|
---|
4209 | }
|
---|
4210 | #endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
|
---|
4211 | };
|
---|
4212 | #endif // #if defined(CL_VERSION_1_2)
|
---|
4213 |
|
---|
4214 | /*! \brief Class interface for 3D Image Memory objects.
|
---|
4215 | *
|
---|
4216 | * See Memory for details about copy semantics, etc.
|
---|
4217 | *
|
---|
4218 | * \see Memory
|
---|
4219 | */
|
---|
4220 | class Image3D : public Image
|
---|
4221 | {
|
---|
4222 | public:
|
---|
4223 | /*! \brief Constructs a 3D Image in a specified context.
|
---|
4224 | *
|
---|
4225 | * Wraps clCreateImage().
|
---|
4226 | */
|
---|
4227 | Image3D(
|
---|
4228 | const Context& context,
|
---|
4229 | cl_mem_flags flags,
|
---|
4230 | ImageFormat format,
|
---|
4231 | ::size_t width,
|
---|
4232 | ::size_t height,
|
---|
4233 | ::size_t depth,
|
---|
4234 | ::size_t row_pitch = 0,
|
---|
4235 | ::size_t slice_pitch = 0,
|
---|
4236 | void* host_ptr = NULL,
|
---|
4237 | cl_int* err = NULL)
|
---|
4238 | {
|
---|
4239 | cl_int error;
|
---|
4240 | bool useCreateImage;
|
---|
4241 |
|
---|
4242 | #if defined(CL_VERSION_1_2) && defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS)
|
---|
4243 | // Run-time decision based on the actual platform
|
---|
4244 | {
|
---|
4245 | cl_uint version = detail::getContextPlatformVersion(context());
|
---|
4246 | useCreateImage = (version >= 0x10002); // OpenCL 1.2 or above
|
---|
4247 | }
|
---|
4248 | #elif defined(CL_VERSION_1_2)
|
---|
4249 | useCreateImage = true;
|
---|
4250 | #else
|
---|
4251 | useCreateImage = false;
|
---|
4252 | #endif
|
---|
4253 |
|
---|
4254 | #if defined(CL_VERSION_1_2)
|
---|
4255 | if (useCreateImage)
|
---|
4256 | {
|
---|
4257 | cl_image_desc desc =
|
---|
4258 | {
|
---|
4259 | CL_MEM_OBJECT_IMAGE3D,
|
---|
4260 | width,
|
---|
4261 | height,
|
---|
4262 | depth,
|
---|
4263 | 0, // array size (unused)
|
---|
4264 | row_pitch,
|
---|
4265 | slice_pitch,
|
---|
4266 | 0, 0, 0
|
---|
4267 | };
|
---|
4268 | object_ = ::clCreateImage(
|
---|
4269 | context(),
|
---|
4270 | flags,
|
---|
4271 | &format,
|
---|
4272 | &desc,
|
---|
4273 | host_ptr,
|
---|
4274 | &error);
|
---|
4275 |
|
---|
4276 | detail::errHandler(error, __CREATE_IMAGE_ERR);
|
---|
4277 | if (err != NULL) {
|
---|
4278 | *err = error;
|
---|
4279 | }
|
---|
4280 | }
|
---|
4281 | #endif // #if defined(CL_VERSION_1_2)
|
---|
4282 | #if !defined(CL_VERSION_1_2) || defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS)
|
---|
4283 | if (!useCreateImage)
|
---|
4284 | {
|
---|
4285 | object_ = ::clCreateImage3D(
|
---|
4286 | context(), flags, &format, width, height, depth, row_pitch,
|
---|
4287 | slice_pitch, host_ptr, &error);
|
---|
4288 |
|
---|
4289 | detail::errHandler(error, __CREATE_IMAGE3D_ERR);
|
---|
4290 | if (err != NULL) {
|
---|
4291 | *err = error;
|
---|
4292 | }
|
---|
4293 | }
|
---|
4294 | #endif // #if !defined(CL_VERSION_1_2) || defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS)
|
---|
4295 | }
|
---|
4296 |
|
---|
4297 | //! \brief Default constructor - initializes to NULL.
|
---|
4298 | Image3D() : Image() { }
|
---|
4299 |
|
---|
4300 | /*! \brief Constructor from cl_mem - takes ownership.
|
---|
4301 | *
|
---|
4302 | * See Memory for further details.
|
---|
4303 | */
|
---|
4304 | __CL_EXPLICIT_CONSTRUCTORS Image3D(const cl_mem& image3D) : Image(image3D) { }
|
---|
4305 |
|
---|
4306 | /*! \brief Assignment from cl_mem - performs shallow copy.
|
---|
4307 | *
|
---|
4308 | * See Memory for further details.
|
---|
4309 | */
|
---|
4310 | Image3D& operator = (const cl_mem& rhs)
|
---|
4311 | {
|
---|
4312 | Image::operator=(rhs);
|
---|
4313 | return *this;
|
---|
4314 | }
|
---|
4315 |
|
---|
4316 | /*! \brief Copy constructor to forward copy to the superclass correctly.
|
---|
4317 | * Required for MSVC.
|
---|
4318 | */
|
---|
4319 | Image3D(const Image3D& img) : Image(img) {}
|
---|
4320 |
|
---|
4321 | /*! \brief Copy assignment to forward copy to the superclass correctly.
|
---|
4322 | * Required for MSVC.
|
---|
4323 | */
|
---|
4324 | Image3D& operator = (const Image3D &img)
|
---|
4325 | {
|
---|
4326 | Image::operator=(img);
|
---|
4327 | return *this;
|
---|
4328 | }
|
---|
4329 |
|
---|
4330 | #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
|
---|
4331 | /*! \brief Move constructor to forward move to the superclass correctly.
|
---|
4332 | * Required for MSVC.
|
---|
4333 | */
|
---|
4334 | Image3D(Image3D&& img) CL_HPP_NOEXCEPT : Image(std::move(img)) {}
|
---|
4335 |
|
---|
4336 | /*! \brief Move assignment to forward move to the superclass correctly.
|
---|
4337 | * Required for MSVC.
|
---|
4338 | */
|
---|
4339 | Image3D& operator = (Image3D &&img)
|
---|
4340 | {
|
---|
4341 | Image::operator=(std::move(img));
|
---|
4342 | return *this;
|
---|
4343 | }
|
---|
4344 | #endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
|
---|
4345 | };
|
---|
4346 |
|
---|
4347 | #if !defined(CL_VERSION_1_2)
|
---|
4348 | /*! \brief Class interface for GL 3D Image Memory objects.
|
---|
4349 | *
|
---|
4350 | * This is provided to facilitate interoperability with OpenGL.
|
---|
4351 | *
|
---|
4352 | * See Memory for details about copy semantics, etc.
|
---|
4353 | *
|
---|
4354 | * \see Memory
|
---|
4355 | */
|
---|
4356 | class Image3DGL : public Image3D
|
---|
4357 | {
|
---|
4358 | public:
|
---|
4359 | /*! \brief Constructs an Image3DGL in a specified context, from a given
|
---|
4360 | * GL Texture.
|
---|
4361 | *
|
---|
4362 | * Wraps clCreateFromGLTexture3D().
|
---|
4363 | */
|
---|
4364 | Image3DGL(
|
---|
4365 | const Context& context,
|
---|
4366 | cl_mem_flags flags,
|
---|
4367 | cl_GLenum target,
|
---|
4368 | cl_GLint miplevel,
|
---|
4369 | cl_GLuint texobj,
|
---|
4370 | cl_int * err = NULL)
|
---|
4371 | {
|
---|
4372 | cl_int error;
|
---|
4373 | object_ = ::clCreateFromGLTexture3D(
|
---|
4374 | context(),
|
---|
4375 | flags,
|
---|
4376 | target,
|
---|
4377 | miplevel,
|
---|
4378 | texobj,
|
---|
4379 | &error);
|
---|
4380 |
|
---|
4381 | detail::errHandler(error, __CREATE_GL_TEXTURE_3D_ERR);
|
---|
4382 | if (err != NULL) {
|
---|
4383 | *err = error;
|
---|
4384 | }
|
---|
4385 | }
|
---|
4386 |
|
---|
4387 | //! \brief Default constructor - initializes to NULL.
|
---|
4388 | Image3DGL() : Image3D() { }
|
---|
4389 |
|
---|
4390 | /*! \brief Constructor from cl_mem - takes ownership.
|
---|
4391 | *
|
---|
4392 | * See Memory for further details.
|
---|
4393 | */
|
---|
4394 | __CL_EXPLICIT_CONSTRUCTORS Image3DGL(const cl_mem& image) : Image3D(image) { }
|
---|
4395 |
|
---|
4396 | /*! \brief Assignment from cl_mem - performs shallow copy.
|
---|
4397 | *
|
---|
4398 | * See Memory for further details.
|
---|
4399 | */
|
---|
4400 | Image3DGL& operator = (const cl_mem& rhs)
|
---|
4401 | {
|
---|
4402 | Image3D::operator=(rhs);
|
---|
4403 | return *this;
|
---|
4404 | }
|
---|
4405 |
|
---|
4406 | /*! \brief Copy constructor to forward copy to the superclass correctly.
|
---|
4407 | * Required for MSVC.
|
---|
4408 | */
|
---|
4409 | Image3DGL(const Image3DGL& img) : Image3D(img) {}
|
---|
4410 |
|
---|
4411 | /*! \brief Copy assignment to forward copy to the superclass correctly.
|
---|
4412 | * Required for MSVC.
|
---|
4413 | */
|
---|
4414 | Image3DGL& operator = (const Image3DGL &img)
|
---|
4415 | {
|
---|
4416 | Image3D::operator=(img);
|
---|
4417 | return *this;
|
---|
4418 | }
|
---|
4419 |
|
---|
4420 | #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
|
---|
4421 | /*! \brief Move constructor to forward move to the superclass correctly.
|
---|
4422 | * Required for MSVC.
|
---|
4423 | */
|
---|
4424 | Image3DGL(Image3DGL&& img) CL_HPP_NOEXCEPT : Image3D(std::move(img)) {}
|
---|
4425 |
|
---|
4426 | /*! \brief Move assignment to forward move to the superclass correctly.
|
---|
4427 | * Required for MSVC.
|
---|
4428 | */
|
---|
4429 | Image3DGL& operator = (Image3DGL &&img)
|
---|
4430 | {
|
---|
4431 | Image3D::operator=(std::move(img));
|
---|
4432 | return *this;
|
---|
4433 | }
|
---|
4434 | #endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
|
---|
4435 | };
|
---|
4436 | #endif // #if !defined(CL_VERSION_1_2)
|
---|
4437 |
|
---|
4438 | #if defined(CL_VERSION_1_2)
|
---|
4439 | /*! \class ImageGL
|
---|
4440 | * \brief general image interface for GL interop.
|
---|
4441 | * We abstract the 2D and 3D GL images into a single instance here
|
---|
4442 | * that wraps all GL sourced images on the grounds that setup information
|
---|
4443 | * was performed by OpenCL anyway.
|
---|
4444 | */
|
---|
4445 | class ImageGL : public Image
|
---|
4446 | {
|
---|
4447 | public:
|
---|
4448 | ImageGL(
|
---|
4449 | const Context& context,
|
---|
4450 | cl_mem_flags flags,
|
---|
4451 | cl_GLenum target,
|
---|
4452 | cl_GLint miplevel,
|
---|
4453 | cl_GLuint texobj,
|
---|
4454 | cl_int * err = NULL)
|
---|
4455 | {
|
---|
4456 | cl_int error;
|
---|
4457 | object_ = ::clCreateFromGLTexture(
|
---|
4458 | context(),
|
---|
4459 | flags,
|
---|
4460 | target,
|
---|
4461 | miplevel,
|
---|
4462 | texobj,
|
---|
4463 | &error);
|
---|
4464 |
|
---|
4465 | detail::errHandler(error, __CREATE_GL_TEXTURE_ERR);
|
---|
4466 | if (err != NULL) {
|
---|
4467 | *err = error;
|
---|
4468 | }
|
---|
4469 | }
|
---|
4470 |
|
---|
4471 | ImageGL() : Image() { }
|
---|
4472 |
|
---|
4473 | __CL_EXPLICIT_CONSTRUCTORS ImageGL(const cl_mem& image) : Image(image) { }
|
---|
4474 |
|
---|
4475 | ImageGL& operator = (const cl_mem& rhs)
|
---|
4476 | {
|
---|
4477 | Image::operator=(rhs);
|
---|
4478 | return *this;
|
---|
4479 | }
|
---|
4480 |
|
---|
4481 | /*! \brief Copy constructor to forward copy to the superclass correctly.
|
---|
4482 | * Required for MSVC.
|
---|
4483 | */
|
---|
4484 | ImageGL(const ImageGL& img) : Image(img) {}
|
---|
4485 |
|
---|
4486 | /*! \brief Copy assignment to forward copy to the superclass correctly.
|
---|
4487 | * Required for MSVC.
|
---|
4488 | */
|
---|
4489 | ImageGL& operator = (const ImageGL &img)
|
---|
4490 | {
|
---|
4491 | Image::operator=(img);
|
---|
4492 | return *this;
|
---|
4493 | }
|
---|
4494 |
|
---|
4495 | #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
|
---|
4496 | /*! \brief Move constructor to forward move to the superclass correctly.
|
---|
4497 | * Required for MSVC.
|
---|
4498 | */
|
---|
4499 | ImageGL(ImageGL&& img) CL_HPP_NOEXCEPT : Image(std::move(img)) {}
|
---|
4500 |
|
---|
4501 | /*! \brief Move assignment to forward move to the superclass correctly.
|
---|
4502 | * Required for MSVC.
|
---|
4503 | */
|
---|
4504 | ImageGL& operator = (ImageGL &&img)
|
---|
4505 | {
|
---|
4506 | Image::operator=(std::move(img));
|
---|
4507 | return *this;
|
---|
4508 | }
|
---|
4509 | #endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
|
---|
4510 | };
|
---|
4511 | #endif // #if defined(CL_VERSION_1_2)
|
---|
4512 |
|
---|
4513 | /*! \brief Class interface for GL Render Buffer Memory Objects.
|
---|
4514 | *
|
---|
4515 | * This is provided to facilitate interoperability with OpenGL.
|
---|
4516 | *
|
---|
4517 | * See Memory for details about copy semantics, etc.
|
---|
4518 | *
|
---|
4519 | * \see Memory
|
---|
4520 | */
|
---|
4521 | class BufferRenderGL :
|
---|
4522 | #if defined(CL_VERSION_1_2)
|
---|
4523 | public ImageGL
|
---|
4524 | #else // #if defined(CL_VERSION_1_2)
|
---|
4525 | public Image2DGL
|
---|
4526 | #endif //#if defined(CL_VERSION_1_2)
|
---|
4527 | {
|
---|
4528 | public:
|
---|
4529 | /*! \brief Constructs a BufferRenderGL in a specified context, from a given
|
---|
4530 | * GL Renderbuffer.
|
---|
4531 | *
|
---|
4532 | * Wraps clCreateFromGLRenderbuffer().
|
---|
4533 | */
|
---|
4534 | BufferRenderGL(
|
---|
4535 | const Context& context,
|
---|
4536 | cl_mem_flags flags,
|
---|
4537 | cl_GLuint bufobj,
|
---|
4538 | cl_int * err = NULL)
|
---|
4539 | {
|
---|
4540 | cl_int error;
|
---|
4541 | object_ = ::clCreateFromGLRenderbuffer(
|
---|
4542 | context(),
|
---|
4543 | flags,
|
---|
4544 | bufobj,
|
---|
4545 | &error);
|
---|
4546 |
|
---|
4547 | detail::errHandler(error, __CREATE_GL_RENDER_BUFFER_ERR);
|
---|
4548 | if (err != NULL) {
|
---|
4549 | *err = error;
|
---|
4550 | }
|
---|
4551 | }
|
---|
4552 |
|
---|
4553 | //! \brief Default constructor - initializes to NULL.
|
---|
4554 | #if defined(CL_VERSION_1_2)
|
---|
4555 | BufferRenderGL() : ImageGL() {};
|
---|
4556 | #else // #if defined(CL_VERSION_1_2)
|
---|
4557 | BufferRenderGL() : Image2DGL() {};
|
---|
4558 | #endif //#if defined(CL_VERSION_1_2)
|
---|
4559 |
|
---|
4560 | /*! \brief Constructor from cl_mem - takes ownership.
|
---|
4561 | *
|
---|
4562 | * See Memory for further details.
|
---|
4563 | */
|
---|
4564 | #if defined(CL_VERSION_1_2)
|
---|
4565 | __CL_EXPLICIT_CONSTRUCTORS BufferRenderGL(const cl_mem& buffer) : ImageGL(buffer) { }
|
---|
4566 | #else // #if defined(CL_VERSION_1_2)
|
---|
4567 | __CL_EXPLICIT_CONSTRUCTORS BufferRenderGL(const cl_mem& buffer) : Image2DGL(buffer) { }
|
---|
4568 | #endif //#if defined(CL_VERSION_1_2)
|
---|
4569 |
|
---|
4570 |
|
---|
4571 | /*! \brief Assignment from cl_mem - performs shallow copy.
|
---|
4572 | *
|
---|
4573 | * See Memory for further details.
|
---|
4574 | */
|
---|
4575 | BufferRenderGL& operator = (const cl_mem& rhs)
|
---|
4576 | {
|
---|
4577 | #if defined(CL_VERSION_1_2)
|
---|
4578 | ImageGL::operator=(rhs);
|
---|
4579 | #else // #if defined(CL_VERSION_1_2)
|
---|
4580 | Image2DGL::operator=(rhs);
|
---|
4581 | #endif //#if defined(CL_VERSION_1_2)
|
---|
4582 |
|
---|
4583 | return *this;
|
---|
4584 | }
|
---|
4585 |
|
---|
4586 | /*! \brief Copy constructor to forward copy to the superclass correctly.
|
---|
4587 | * Required for MSVC.
|
---|
4588 | */
|
---|
4589 | #if defined(CL_VERSION_1_2)
|
---|
4590 | BufferRenderGL(const BufferRenderGL& buf) : ImageGL(buf) {}
|
---|
4591 | #else // #if defined(CL_VERSION_1_2)
|
---|
4592 | BufferRenderGL(const BufferRenderGL& buf) : Image2DGL(buf) {}
|
---|
4593 | #endif //#if defined(CL_VERSION_1_2)
|
---|
4594 |
|
---|
4595 | /*! \brief Copy assignment to forward copy to the superclass correctly.
|
---|
4596 | * Required for MSVC.
|
---|
4597 | */
|
---|
4598 | BufferRenderGL& operator = (const BufferRenderGL &rhs)
|
---|
4599 | {
|
---|
4600 | #if defined(CL_VERSION_1_2)
|
---|
4601 | ImageGL::operator=(rhs);
|
---|
4602 | #else // #if defined(CL_VERSION_1_2)
|
---|
4603 | Image2DGL::operator=(rhs);
|
---|
4604 | #endif //#if defined(CL_VERSION_1_2)
|
---|
4605 | return *this;
|
---|
4606 | }
|
---|
4607 |
|
---|
4608 | #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
|
---|
4609 | /*! \brief Move constructor to forward move to the superclass correctly.
|
---|
4610 | * Required for MSVC.
|
---|
4611 | */
|
---|
4612 | #if defined(CL_VERSION_1_2)
|
---|
4613 | BufferRenderGL(BufferRenderGL&& buf) CL_HPP_NOEXCEPT : ImageGL(std::move(buf)) {}
|
---|
4614 | #else // #if defined(CL_VERSION_1_2)
|
---|
4615 | BufferRenderGL(BufferRenderGL&& buf) CL_HPP_NOEXCEPT : Image2DGL(std::move(buf)) {}
|
---|
4616 | #endif //#if defined(CL_VERSION_1_2)
|
---|
4617 |
|
---|
4618 |
|
---|
4619 | /*! \brief Move assignment to forward move to the superclass correctly.
|
---|
4620 | * Required for MSVC.
|
---|
4621 | */
|
---|
4622 | BufferRenderGL& operator = (BufferRenderGL &&buf)
|
---|
4623 | {
|
---|
4624 | #if defined(CL_VERSION_1_2)
|
---|
4625 | ImageGL::operator=(std::move(buf));
|
---|
4626 | #else // #if defined(CL_VERSION_1_2)
|
---|
4627 | Image2DGL::operator=(std::move(buf));
|
---|
4628 | #endif //#if defined(CL_VERSION_1_2)
|
---|
4629 |
|
---|
4630 | return *this;
|
---|
4631 | }
|
---|
4632 | #endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
|
---|
4633 |
|
---|
4634 | //! \brief Wrapper for clGetGLObjectInfo().
|
---|
4635 | cl_int getObjectInfo(
|
---|
4636 | cl_gl_object_type *type,
|
---|
4637 | cl_GLuint * gl_object_name)
|
---|
4638 | {
|
---|
4639 | return detail::errHandler(
|
---|
4640 | ::clGetGLObjectInfo(object_, type, gl_object_name),
|
---|
4641 | __GET_GL_OBJECT_INFO_ERR);
|
---|
4642 | }
|
---|
4643 | };
|
---|
4644 |
|
---|
4645 | /*! \brief Class interface for cl_sampler.
|
---|
4646 | *
|
---|
4647 | * \note Copies of these objects are shallow, meaning that the copy will refer
|
---|
4648 | * to the same underlying cl_sampler as the original. For details, see
|
---|
4649 | * clRetainSampler() and clReleaseSampler().
|
---|
4650 | *
|
---|
4651 | * \see cl_sampler
|
---|
4652 | */
|
---|
4653 | class Sampler : public detail::Wrapper<cl_sampler>
|
---|
4654 | {
|
---|
4655 | public:
|
---|
4656 | //! \brief Default constructor - initializes to NULL.
|
---|
4657 | Sampler() { }
|
---|
4658 |
|
---|
4659 | /*! \brief Constructs a Sampler in a specified context.
|
---|
4660 | *
|
---|
4661 | * Wraps clCreateSampler().
|
---|
4662 | */
|
---|
4663 | Sampler(
|
---|
4664 | const Context& context,
|
---|
4665 | cl_bool normalized_coords,
|
---|
4666 | cl_addressing_mode addressing_mode,
|
---|
4667 | cl_filter_mode filter_mode,
|
---|
4668 | cl_int* err = NULL)
|
---|
4669 | {
|
---|
4670 | cl_int error;
|
---|
4671 | object_ = ::clCreateSampler(
|
---|
4672 | context(),
|
---|
4673 | normalized_coords,
|
---|
4674 | addressing_mode,
|
---|
4675 | filter_mode,
|
---|
4676 | &error);
|
---|
4677 |
|
---|
4678 | detail::errHandler(error, __CREATE_SAMPLER_ERR);
|
---|
4679 | if (err != NULL) {
|
---|
4680 | *err = error;
|
---|
4681 | }
|
---|
4682 | }
|
---|
4683 |
|
---|
4684 | /*! \brief Constructor from cl_sampler - takes ownership.
|
---|
4685 | *
|
---|
4686 | * This effectively transfers ownership of a refcount on the cl_sampler
|
---|
4687 | * into the new Sampler object.
|
---|
4688 | */
|
---|
4689 | __CL_EXPLICIT_CONSTRUCTORS Sampler(const cl_sampler& sampler) : detail::Wrapper<cl_type>(sampler) { }
|
---|
4690 |
|
---|
4691 | /*! \brief Assignment operator from cl_sampler - takes ownership.
|
---|
4692 | *
|
---|
4693 | * This effectively transfers ownership of a refcount on the rhs and calls
|
---|
4694 | * clReleaseSampler() on the value previously held by this instance.
|
---|
4695 | */
|
---|
4696 | Sampler& operator = (const cl_sampler& rhs)
|
---|
4697 | {
|
---|
4698 | detail::Wrapper<cl_type>::operator=(rhs);
|
---|
4699 | return *this;
|
---|
4700 | }
|
---|
4701 |
|
---|
4702 | /*! \brief Copy constructor to forward copy to the superclass correctly.
|
---|
4703 | * Required for MSVC.
|
---|
4704 | */
|
---|
4705 | Sampler(const Sampler& sam) : detail::Wrapper<cl_type>(sam) {}
|
---|
4706 |
|
---|
4707 | /*! \brief Copy assignment to forward copy to the superclass correctly.
|
---|
4708 | * Required for MSVC.
|
---|
4709 | */
|
---|
4710 | Sampler& operator = (const Sampler &sam)
|
---|
4711 | {
|
---|
4712 | detail::Wrapper<cl_type>::operator=(sam);
|
---|
4713 | return *this;
|
---|
4714 | }
|
---|
4715 |
|
---|
4716 | #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
|
---|
4717 | /*! \brief Move constructor to forward move to the superclass correctly.
|
---|
4718 | * Required for MSVC.
|
---|
4719 | */
|
---|
4720 | Sampler(Sampler&& sam) CL_HPP_NOEXCEPT : detail::Wrapper<cl_type>(std::move(sam)) {}
|
---|
4721 |
|
---|
4722 | /*! \brief Move assignment to forward move to the superclass correctly.
|
---|
4723 | * Required for MSVC.
|
---|
4724 | */
|
---|
4725 | Sampler& operator = (Sampler &&sam)
|
---|
4726 | {
|
---|
4727 | detail::Wrapper<cl_type>::operator=(std::move(sam));
|
---|
4728 | return *this;
|
---|
4729 | }
|
---|
4730 | #endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
|
---|
4731 |
|
---|
4732 | //! \brief Wrapper for clGetSamplerInfo().
|
---|
4733 | template <typename T>
|
---|
4734 | cl_int getInfo(cl_sampler_info name, T* param) const
|
---|
4735 | {
|
---|
4736 | return detail::errHandler(
|
---|
4737 | detail::getInfo(&::clGetSamplerInfo, object_, name, param),
|
---|
4738 | __GET_SAMPLER_INFO_ERR);
|
---|
4739 | }
|
---|
4740 |
|
---|
4741 | //! \brief Wrapper for clGetSamplerInfo() that returns by value.
|
---|
4742 | template <cl_sampler_info name> typename
|
---|
4743 | detail::param_traits<detail::cl_sampler_info, name>::param_type
|
---|
4744 | getInfo(cl_int* err = NULL) const
|
---|
4745 | {
|
---|
4746 | typename detail::param_traits<
|
---|
4747 | detail::cl_sampler_info, name>::param_type param;
|
---|
4748 | cl_int result = getInfo(name, ¶m);
|
---|
4749 | if (err != NULL) {
|
---|
4750 | *err = result;
|
---|
4751 | }
|
---|
4752 | return param;
|
---|
4753 | }
|
---|
4754 | };
|
---|
4755 |
|
---|
4756 | class Program;
|
---|
4757 | class CommandQueue;
|
---|
4758 | class Kernel;
|
---|
4759 |
|
---|
4760 | //! \brief Class interface for specifying NDRange values.
|
---|
4761 | class NDRange
|
---|
4762 | {
|
---|
4763 | private:
|
---|
4764 | size_t<3> sizes_;
|
---|
4765 | cl_uint dimensions_;
|
---|
4766 |
|
---|
4767 | public:
|
---|
4768 | //! \brief Default constructor - resulting range has zero dimensions.
|
---|
4769 | NDRange()
|
---|
4770 | : dimensions_(0)
|
---|
4771 | { }
|
---|
4772 |
|
---|
4773 | //! \brief Constructs one-dimensional range.
|
---|
4774 | NDRange(::size_t size0)
|
---|
4775 | : dimensions_(1)
|
---|
4776 | {
|
---|
4777 | sizes_[0] = size0;
|
---|
4778 | }
|
---|
4779 |
|
---|
4780 | //! \brief Constructs two-dimensional range.
|
---|
4781 | NDRange(::size_t size0, ::size_t size1)
|
---|
4782 | : dimensions_(2)
|
---|
4783 | {
|
---|
4784 | sizes_[0] = size0;
|
---|
4785 | sizes_[1] = size1;
|
---|
4786 | }
|
---|
4787 |
|
---|
4788 | //! \brief Constructs three-dimensional range.
|
---|
4789 | NDRange(::size_t size0, ::size_t size1, ::size_t size2)
|
---|
4790 | : dimensions_(3)
|
---|
4791 | {
|
---|
4792 | sizes_[0] = size0;
|
---|
4793 | sizes_[1] = size1;
|
---|
4794 | sizes_[2] = size2;
|
---|
4795 | }
|
---|
4796 |
|
---|
4797 | /*! \brief Conversion operator to const ::size_t *.
|
---|
4798 | *
|
---|
4799 | * \returns a pointer to the size of the first dimension.
|
---|
4800 | */
|
---|
4801 | operator const ::size_t*() const {
|
---|
4802 | return (const ::size_t*) sizes_;
|
---|
4803 | }
|
---|
4804 |
|
---|
4805 | //! \brief Queries the number of dimensions in the range.
|
---|
4806 | ::size_t dimensions() const { return dimensions_; }
|
---|
4807 | };
|
---|
4808 |
|
---|
4809 | //! \brief A zero-dimensional range.
|
---|
4810 | static const NDRange NullRange;
|
---|
4811 |
|
---|
4812 | //! \brief Local address wrapper for use with Kernel::setArg
|
---|
4813 | struct LocalSpaceArg
|
---|
4814 | {
|
---|
4815 | ::size_t size_;
|
---|
4816 | };
|
---|
4817 |
|
---|
4818 | namespace detail {
|
---|
4819 |
|
---|
4820 | template <typename T>
|
---|
4821 | struct KernelArgumentHandler
|
---|
4822 | {
|
---|
4823 | static ::size_t size(const T&) { return sizeof(T); }
|
---|
4824 | static const T* ptr(const T& value) { return &value; }
|
---|
4825 | };
|
---|
4826 |
|
---|
4827 | template <>
|
---|
4828 | struct KernelArgumentHandler<LocalSpaceArg>
|
---|
4829 | {
|
---|
4830 | static ::size_t size(const LocalSpaceArg& value) { return value.size_; }
|
---|
4831 | static const void* ptr(const LocalSpaceArg&) { return NULL; }
|
---|
4832 | };
|
---|
4833 |
|
---|
4834 | }
|
---|
4835 | //! \endcond
|
---|
4836 |
|
---|
4837 | /*! __local
|
---|
4838 | * \brief Helper function for generating LocalSpaceArg objects.
|
---|
4839 | * Deprecated. Replaced with Local.
|
---|
4840 | */
|
---|
4841 | inline CL_EXT_PREFIX__VERSION_1_1_DEPRECATED LocalSpaceArg
|
---|
4842 | __local(::size_t size) CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED;
|
---|
4843 | inline LocalSpaceArg
|
---|
4844 | __local(::size_t size)
|
---|
4845 | {
|
---|
4846 | LocalSpaceArg ret = { size };
|
---|
4847 | return ret;
|
---|
4848 | }
|
---|
4849 |
|
---|
4850 | /*! Local
|
---|
4851 | * \brief Helper function for generating LocalSpaceArg objects.
|
---|
4852 | */
|
---|
4853 | inline LocalSpaceArg
|
---|
4854 | Local(::size_t size)
|
---|
4855 | {
|
---|
4856 | LocalSpaceArg ret = { size };
|
---|
4857 | return ret;
|
---|
4858 | }
|
---|
4859 |
|
---|
4860 | //class KernelFunctor;
|
---|
4861 |
|
---|
4862 | /*! \brief Class interface for cl_kernel.
|
---|
4863 | *
|
---|
4864 | * \note Copies of these objects are shallow, meaning that the copy will refer
|
---|
4865 | * to the same underlying cl_kernel as the original. For details, see
|
---|
4866 | * clRetainKernel() and clReleaseKernel().
|
---|
4867 | *
|
---|
4868 | * \see cl_kernel
|
---|
4869 | */
|
---|
4870 | class Kernel : public detail::Wrapper<cl_kernel>
|
---|
4871 | {
|
---|
4872 | public:
|
---|
4873 | inline Kernel(const Program& program, const char* name, cl_int* err = NULL);
|
---|
4874 |
|
---|
4875 | //! \brief Default constructor - initializes to NULL.
|
---|
4876 | Kernel() { }
|
---|
4877 |
|
---|
4878 | /*! \brief Constructor from cl_kernel - takes ownership.
|
---|
4879 | *
|
---|
4880 | * This effectively transfers ownership of a refcount on the cl_kernel
|
---|
4881 | * into the new Kernel object.
|
---|
4882 | */
|
---|
4883 | __CL_EXPLICIT_CONSTRUCTORS Kernel(const cl_kernel& kernel) : detail::Wrapper<cl_type>(kernel) { }
|
---|
4884 |
|
---|
4885 | /*! \brief Assignment operator from cl_kernel - takes ownership.
|
---|
4886 | *
|
---|
4887 | * This effectively transfers ownership of a refcount on the rhs and calls
|
---|
4888 | * clReleaseKernel() on the value previously held by this instance.
|
---|
4889 | */
|
---|
4890 | Kernel& operator = (const cl_kernel& rhs)
|
---|
4891 | {
|
---|
4892 | detail::Wrapper<cl_type>::operator=(rhs);
|
---|
4893 | return *this;
|
---|
4894 | }
|
---|
4895 |
|
---|
4896 | /*! \brief Copy constructor to forward copy to the superclass correctly.
|
---|
4897 | * Required for MSVC.
|
---|
4898 | */
|
---|
4899 | Kernel(const Kernel& kernel) : detail::Wrapper<cl_type>(kernel) {}
|
---|
4900 |
|
---|
4901 | /*! \brief Copy assignment to forward copy to the superclass correctly.
|
---|
4902 | * Required for MSVC.
|
---|
4903 | */
|
---|
4904 | Kernel& operator = (const Kernel &kernel)
|
---|
4905 | {
|
---|
4906 | detail::Wrapper<cl_type>::operator=(kernel);
|
---|
4907 | return *this;
|
---|
4908 | }
|
---|
4909 |
|
---|
4910 | #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
|
---|
4911 | /*! \brief Move constructor to forward move to the superclass correctly.
|
---|
4912 | * Required for MSVC.
|
---|
4913 | */
|
---|
4914 | Kernel(Kernel&& kernel) CL_HPP_NOEXCEPT : detail::Wrapper<cl_type>(std::move(kernel)) {}
|
---|
4915 |
|
---|
4916 | /*! \brief Move assignment to forward move to the superclass correctly.
|
---|
4917 | * Required for MSVC.
|
---|
4918 | */
|
---|
4919 | Kernel& operator = (Kernel &&kernel)
|
---|
4920 | {
|
---|
4921 | detail::Wrapper<cl_type>::operator=(std::move(kernel));
|
---|
4922 | return *this;
|
---|
4923 | }
|
---|
4924 | #endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
|
---|
4925 |
|
---|
4926 | template <typename T>
|
---|
4927 | cl_int getInfo(cl_kernel_info name, T* param) const
|
---|
4928 | {
|
---|
4929 | return detail::errHandler(
|
---|
4930 | detail::getInfo(&::clGetKernelInfo, object_, name, param),
|
---|
4931 | __GET_KERNEL_INFO_ERR);
|
---|
4932 | }
|
---|
4933 |
|
---|
4934 | template <cl_kernel_info name> typename
|
---|
4935 | detail::param_traits<detail::cl_kernel_info, name>::param_type
|
---|
4936 | getInfo(cl_int* err = NULL) const
|
---|
4937 | {
|
---|
4938 | typename detail::param_traits<
|
---|
4939 | detail::cl_kernel_info, name>::param_type param;
|
---|
4940 | cl_int result = getInfo(name, ¶m);
|
---|
4941 | if (err != NULL) {
|
---|
4942 | *err = result;
|
---|
4943 | }
|
---|
4944 | return param;
|
---|
4945 | }
|
---|
4946 |
|
---|
4947 | #if defined(CL_VERSION_1_2)
|
---|
4948 | template <typename T>
|
---|
4949 | cl_int getArgInfo(cl_uint argIndex, cl_kernel_arg_info name, T* param) const
|
---|
4950 | {
|
---|
4951 | return detail::errHandler(
|
---|
4952 | detail::getInfo(&::clGetKernelArgInfo, object_, argIndex, name, param),
|
---|
4953 | __GET_KERNEL_ARG_INFO_ERR);
|
---|
4954 | }
|
---|
4955 |
|
---|
4956 | template <cl_kernel_arg_info name> typename
|
---|
4957 | detail::param_traits<detail::cl_kernel_arg_info, name>::param_type
|
---|
4958 | getArgInfo(cl_uint argIndex, cl_int* err = NULL) const
|
---|
4959 | {
|
---|
4960 | typename detail::param_traits<
|
---|
4961 | detail::cl_kernel_arg_info, name>::param_type param;
|
---|
4962 | cl_int result = getArgInfo(argIndex, name, ¶m);
|
---|
4963 | if (err != NULL) {
|
---|
4964 | *err = result;
|
---|
4965 | }
|
---|
4966 | return param;
|
---|
4967 | }
|
---|
4968 | #endif // #if defined(CL_VERSION_1_2)
|
---|
4969 |
|
---|
4970 | template <typename T>
|
---|
4971 | cl_int getWorkGroupInfo(
|
---|
4972 | const Device& device, cl_kernel_work_group_info name, T* param) const
|
---|
4973 | {
|
---|
4974 | return detail::errHandler(
|
---|
4975 | detail::getInfo(
|
---|
4976 | &::clGetKernelWorkGroupInfo, object_, device(), name, param),
|
---|
4977 | __GET_KERNEL_WORK_GROUP_INFO_ERR);
|
---|
4978 | }
|
---|
4979 |
|
---|
4980 | template <cl_kernel_work_group_info name> typename
|
---|
4981 | detail::param_traits<detail::cl_kernel_work_group_info, name>::param_type
|
---|
4982 | getWorkGroupInfo(const Device& device, cl_int* err = NULL) const
|
---|
4983 | {
|
---|
4984 | typename detail::param_traits<
|
---|
4985 | detail::cl_kernel_work_group_info, name>::param_type param;
|
---|
4986 | cl_int result = getWorkGroupInfo(device, name, ¶m);
|
---|
4987 | if (err != NULL) {
|
---|
4988 | *err = result;
|
---|
4989 | }
|
---|
4990 | return param;
|
---|
4991 | }
|
---|
4992 |
|
---|
4993 | template <typename T>
|
---|
4994 | cl_int setArg(cl_uint index, const T &value)
|
---|
4995 | {
|
---|
4996 | return detail::errHandler(
|
---|
4997 | ::clSetKernelArg(
|
---|
4998 | object_,
|
---|
4999 | index,
|
---|
5000 | detail::KernelArgumentHandler<T>::size(value),
|
---|
5001 | detail::KernelArgumentHandler<T>::ptr(value)),
|
---|
5002 | __SET_KERNEL_ARGS_ERR);
|
---|
5003 | }
|
---|
5004 |
|
---|
5005 | cl_int setArg(cl_uint index, ::size_t size, const void* argPtr)
|
---|
5006 | {
|
---|
5007 | return detail::errHandler(
|
---|
5008 | ::clSetKernelArg(object_, index, size, argPtr),
|
---|
5009 | __SET_KERNEL_ARGS_ERR);
|
---|
5010 | }
|
---|
5011 | };
|
---|
5012 |
|
---|
5013 | /*! \class Program
|
---|
5014 | * \brief Program interface that implements cl_program.
|
---|
5015 | */
|
---|
5016 | class Program : public detail::Wrapper<cl_program>
|
---|
5017 | {
|
---|
5018 | public:
|
---|
5019 | typedef VECTOR_CLASS<std::pair<const void*, ::size_t> > Binaries;
|
---|
5020 | typedef VECTOR_CLASS<std::pair<const char*, ::size_t> > Sources;
|
---|
5021 |
|
---|
5022 | Program(
|
---|
5023 | const STRING_CLASS& source,
|
---|
5024 | bool build = false,
|
---|
5025 | cl_int* err = NULL)
|
---|
5026 | {
|
---|
5027 | cl_int error;
|
---|
5028 |
|
---|
5029 | const char * strings = source.c_str();
|
---|
5030 | const ::size_t length = source.size();
|
---|
5031 |
|
---|
5032 | Context context = Context::getDefault(err);
|
---|
5033 |
|
---|
5034 | object_ = ::clCreateProgramWithSource(
|
---|
5035 | context(), (cl_uint)1, &strings, &length, &error);
|
---|
5036 |
|
---|
5037 | detail::errHandler(error, __CREATE_PROGRAM_WITH_SOURCE_ERR);
|
---|
5038 |
|
---|
5039 | if (error == CL_SUCCESS && build) {
|
---|
5040 |
|
---|
5041 | error = ::clBuildProgram(
|
---|
5042 | object_,
|
---|
5043 | 0,
|
---|
5044 | NULL,
|
---|
5045 | "",
|
---|
5046 | NULL,
|
---|
5047 | NULL);
|
---|
5048 |
|
---|
5049 | detail::errHandler(error, __BUILD_PROGRAM_ERR);
|
---|
5050 | }
|
---|
5051 |
|
---|
5052 | if (err != NULL) {
|
---|
5053 | *err = error;
|
---|
5054 | }
|
---|
5055 | }
|
---|
5056 |
|
---|
5057 | Program(
|
---|
5058 | const Context& context,
|
---|
5059 | const STRING_CLASS& source,
|
---|
5060 | bool build = false,
|
---|
5061 | cl_int* err = NULL)
|
---|
5062 | {
|
---|
5063 | cl_int error;
|
---|
5064 |
|
---|
5065 | const char * strings = source.c_str();
|
---|
5066 | const ::size_t length = source.size();
|
---|
5067 |
|
---|
5068 | object_ = ::clCreateProgramWithSource(
|
---|
5069 | context(), (cl_uint)1, &strings, &length, &error);
|
---|
5070 |
|
---|
5071 | detail::errHandler(error, __CREATE_PROGRAM_WITH_SOURCE_ERR);
|
---|
5072 |
|
---|
5073 | if (error == CL_SUCCESS && build) {
|
---|
5074 |
|
---|
5075 | error = ::clBuildProgram(
|
---|
5076 | object_,
|
---|
5077 | 0,
|
---|
5078 | NULL,
|
---|
5079 | "",
|
---|
5080 | NULL,
|
---|
5081 | NULL);
|
---|
5082 |
|
---|
5083 | detail::errHandler(error, __BUILD_PROGRAM_ERR);
|
---|
5084 | }
|
---|
5085 |
|
---|
5086 | if (err != NULL) {
|
---|
5087 | *err = error;
|
---|
5088 | }
|
---|
5089 | }
|
---|
5090 |
|
---|
5091 | Program(
|
---|
5092 | const Context& context,
|
---|
5093 | const Sources& sources,
|
---|
5094 | cl_int* err = NULL)
|
---|
5095 | {
|
---|
5096 | cl_int error;
|
---|
5097 |
|
---|
5098 | const ::size_t n = (::size_t)sources.size();
|
---|
5099 | ::size_t* lengths = (::size_t*) alloca(n * sizeof(::size_t));
|
---|
5100 | const char** strings = (const char**) alloca(n * sizeof(const char*));
|
---|
5101 |
|
---|
5102 | for (::size_t i = 0; i < n; ++i) {
|
---|
5103 | strings[i] = sources[(int)i].first;
|
---|
5104 | lengths[i] = sources[(int)i].second;
|
---|
5105 | }
|
---|
5106 |
|
---|
5107 | object_ = ::clCreateProgramWithSource(
|
---|
5108 | context(), (cl_uint)n, strings, lengths, &error);
|
---|
5109 |
|
---|
5110 | detail::errHandler(error, __CREATE_PROGRAM_WITH_SOURCE_ERR);
|
---|
5111 | if (err != NULL) {
|
---|
5112 | *err = error;
|
---|
5113 | }
|
---|
5114 | }
|
---|
5115 |
|
---|
5116 | /**
|
---|
5117 | * Construct a program object from a list of devices and a per-device list of binaries.
|
---|
5118 | * \param context A valid OpenCL context in which to construct the program.
|
---|
5119 | * \param devices A vector of OpenCL device objects for which the program will be created.
|
---|
5120 | * \param binaries A vector of pairs of a pointer to a binary object and its length.
|
---|
5121 | * \param binaryStatus An optional vector that on completion will be resized to
|
---|
5122 | * match the size of binaries and filled with values to specify if each binary
|
---|
5123 | * was successfully loaded.
|
---|
5124 | * Set to CL_SUCCESS if the binary was successfully loaded.
|
---|
5125 | * Set to CL_INVALID_VALUE if the length is 0 or the binary pointer is NULL.
|
---|
5126 | * Set to CL_INVALID_BINARY if the binary provided is not valid for the matching device.
|
---|
5127 | * \param err if non-NULL will be set to CL_SUCCESS on successful operation or one of the following errors:
|
---|
5128 | * CL_INVALID_CONTEXT if context is not a valid context.
|
---|
5129 | * CL_INVALID_VALUE if the length of devices is zero; or if the length of binaries does not match the length of devices;
|
---|
5130 | * or if any entry in binaries is NULL or has length 0.
|
---|
5131 | * CL_INVALID_DEVICE if OpenCL devices listed in devices are not in the list of devices associated with context.
|
---|
5132 | * CL_INVALID_BINARY if an invalid program binary was encountered for any device. binaryStatus will return specific status for each device.
|
---|
5133 | * CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources required by the OpenCL implementation on the host.
|
---|
5134 | */
|
---|
5135 | Program(
|
---|
5136 | const Context& context,
|
---|
5137 | const VECTOR_CLASS<Device>& devices,
|
---|
5138 | const Binaries& binaries,
|
---|
5139 | VECTOR_CLASS<cl_int>* binaryStatus = NULL,
|
---|
5140 | cl_int* err = NULL)
|
---|
5141 | {
|
---|
5142 | cl_int error;
|
---|
5143 |
|
---|
5144 | const ::size_t numDevices = devices.size();
|
---|
5145 |
|
---|
5146 | // Catch size mismatch early and return
|
---|
5147 | if(binaries.size() != numDevices) {
|
---|
5148 | error = CL_INVALID_VALUE;
|
---|
5149 | detail::errHandler(error, __CREATE_PROGRAM_WITH_BINARY_ERR);
|
---|
5150 | if (err != NULL) {
|
---|
5151 | *err = error;
|
---|
5152 | }
|
---|
5153 | return;
|
---|
5154 | }
|
---|
5155 |
|
---|
5156 | ::size_t* lengths = (::size_t*) alloca(numDevices * sizeof(::size_t));
|
---|
5157 | const unsigned char** images = (const unsigned char**) alloca(numDevices * sizeof(const unsigned char**));
|
---|
5158 |
|
---|
5159 | for (::size_t i = 0; i < numDevices; ++i) {
|
---|
5160 | images[i] = (const unsigned char*)binaries[i].first;
|
---|
5161 | lengths[i] = binaries[(int)i].second;
|
---|
5162 | }
|
---|
5163 |
|
---|
5164 | cl_device_id* deviceIDs = (cl_device_id*) alloca(numDevices * sizeof(cl_device_id));
|
---|
5165 | for( ::size_t deviceIndex = 0; deviceIndex < numDevices; ++deviceIndex ) {
|
---|
5166 | deviceIDs[deviceIndex] = (devices[deviceIndex])();
|
---|
5167 | }
|
---|
5168 |
|
---|
5169 | if(binaryStatus) {
|
---|
5170 | binaryStatus->resize(numDevices);
|
---|
5171 | }
|
---|
5172 |
|
---|
5173 | object_ = ::clCreateProgramWithBinary(
|
---|
5174 | context(), (cl_uint) devices.size(),
|
---|
5175 | deviceIDs,
|
---|
5176 | lengths, images, (binaryStatus != NULL && numDevices > 0)
|
---|
5177 | ? &binaryStatus->front()
|
---|
5178 | : NULL, &error);
|
---|
5179 |
|
---|
5180 | detail::errHandler(error, __CREATE_PROGRAM_WITH_BINARY_ERR);
|
---|
5181 | if (err != NULL) {
|
---|
5182 | *err = error;
|
---|
5183 | }
|
---|
5184 | }
|
---|
5185 |
|
---|
5186 |
|
---|
5187 | #if defined(CL_VERSION_1_2)
|
---|
5188 | /**
|
---|
5189 | * Create program using builtin kernels.
|
---|
5190 | * \param kernelNames Semi-colon separated list of builtin kernel names
|
---|
5191 | */
|
---|
5192 | Program(
|
---|
5193 | const Context& context,
|
---|
5194 | const VECTOR_CLASS<Device>& devices,
|
---|
5195 | const STRING_CLASS& kernelNames,
|
---|
5196 | cl_int* err = NULL)
|
---|
5197 | {
|
---|
5198 | cl_int error;
|
---|
5199 |
|
---|
5200 |
|
---|
5201 | ::size_t numDevices = devices.size();
|
---|
5202 | cl_device_id* deviceIDs = (cl_device_id*) alloca(numDevices * sizeof(cl_device_id));
|
---|
5203 | for( ::size_t deviceIndex = 0; deviceIndex < numDevices; ++deviceIndex ) {
|
---|
5204 | deviceIDs[deviceIndex] = (devices[deviceIndex])();
|
---|
5205 | }
|
---|
5206 |
|
---|
5207 | object_ = ::clCreateProgramWithBuiltInKernels(
|
---|
5208 | context(),
|
---|
5209 | (cl_uint) devices.size(),
|
---|
5210 | deviceIDs,
|
---|
5211 | kernelNames.c_str(),
|
---|
5212 | &error);
|
---|
5213 |
|
---|
5214 | detail::errHandler(error, __CREATE_PROGRAM_WITH_BUILT_IN_KERNELS_ERR);
|
---|
5215 | if (err != NULL) {
|
---|
5216 | *err = error;
|
---|
5217 | }
|
---|
5218 | }
|
---|
5219 | #endif // #if defined(CL_VERSION_1_2)
|
---|
5220 |
|
---|
5221 | Program() { }
|
---|
5222 |
|
---|
5223 | __CL_EXPLICIT_CONSTRUCTORS Program(const cl_program& program) : detail::Wrapper<cl_type>(program) { }
|
---|
5224 |
|
---|
5225 | Program& operator = (const cl_program& rhs)
|
---|
5226 | {
|
---|
5227 | detail::Wrapper<cl_type>::operator=(rhs);
|
---|
5228 | return *this;
|
---|
5229 | }
|
---|
5230 |
|
---|
5231 | /*! \brief Copy constructor to forward copy to the superclass correctly.
|
---|
5232 | * Required for MSVC.
|
---|
5233 | */
|
---|
5234 | Program(const Program& program) : detail::Wrapper<cl_type>(program) {}
|
---|
5235 |
|
---|
5236 | /*! \brief Copy assignment to forward copy to the superclass correctly.
|
---|
5237 | * Required for MSVC.
|
---|
5238 | */
|
---|
5239 | Program& operator = (const Program &program)
|
---|
5240 | {
|
---|
5241 | detail::Wrapper<cl_type>::operator=(program);
|
---|
5242 | return *this;
|
---|
5243 | }
|
---|
5244 |
|
---|
5245 | #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
|
---|
5246 | /*! \brief Move constructor to forward move to the superclass correctly.
|
---|
5247 | * Required for MSVC.
|
---|
5248 | */
|
---|
5249 | Program(Program&& program) CL_HPP_NOEXCEPT : detail::Wrapper<cl_type>(std::move(program)) {}
|
---|
5250 |
|
---|
5251 | /*! \brief Move assignment to forward move to the superclass correctly.
|
---|
5252 | * Required for MSVC.
|
---|
5253 | */
|
---|
5254 | Program& operator = (Program &&program)
|
---|
5255 | {
|
---|
5256 | detail::Wrapper<cl_type>::operator=(std::move(program));
|
---|
5257 | return *this;
|
---|
5258 | }
|
---|
5259 | #endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
|
---|
5260 |
|
---|
5261 | cl_int build(
|
---|
5262 | const VECTOR_CLASS<Device>& devices,
|
---|
5263 | const char* options = NULL,
|
---|
5264 | void (CL_CALLBACK * notifyFptr)(cl_program, void *) = NULL,
|
---|
5265 | void* data = NULL) const
|
---|
5266 | {
|
---|
5267 | ::size_t numDevices = devices.size();
|
---|
5268 | cl_device_id* deviceIDs = (cl_device_id*) alloca(numDevices * sizeof(cl_device_id));
|
---|
5269 | for( ::size_t deviceIndex = 0; deviceIndex < numDevices; ++deviceIndex ) {
|
---|
5270 | deviceIDs[deviceIndex] = (devices[deviceIndex])();
|
---|
5271 | }
|
---|
5272 |
|
---|
5273 | return detail::errHandler(
|
---|
5274 | ::clBuildProgram(
|
---|
5275 | object_,
|
---|
5276 | (cl_uint)
|
---|
5277 | devices.size(),
|
---|
5278 | deviceIDs,
|
---|
5279 | options,
|
---|
5280 | notifyFptr,
|
---|
5281 | data),
|
---|
5282 | __BUILD_PROGRAM_ERR);
|
---|
5283 | }
|
---|
5284 |
|
---|
5285 | cl_int build(
|
---|
5286 | const char* options = NULL,
|
---|
5287 | void (CL_CALLBACK * notifyFptr)(cl_program, void *) = NULL,
|
---|
5288 | void* data = NULL) const
|
---|
5289 | {
|
---|
5290 | return detail::errHandler(
|
---|
5291 | ::clBuildProgram(
|
---|
5292 | object_,
|
---|
5293 | 0,
|
---|
5294 | NULL,
|
---|
5295 | options,
|
---|
5296 | notifyFptr,
|
---|
5297 | data),
|
---|
5298 | __BUILD_PROGRAM_ERR);
|
---|
5299 | }
|
---|
5300 |
|
---|
5301 | #if defined(CL_VERSION_1_2)
|
---|
5302 | cl_int compile(
|
---|
5303 | const char* options = NULL,
|
---|
5304 | void (CL_CALLBACK * notifyFptr)(cl_program, void *) = NULL,
|
---|
5305 | void* data = NULL) const
|
---|
5306 | {
|
---|
5307 | return detail::errHandler(
|
---|
5308 | ::clCompileProgram(
|
---|
5309 | object_,
|
---|
5310 | 0,
|
---|
5311 | NULL,
|
---|
5312 | options,
|
---|
5313 | 0,
|
---|
5314 | NULL,
|
---|
5315 | NULL,
|
---|
5316 | notifyFptr,
|
---|
5317 | data),
|
---|
5318 | __COMPILE_PROGRAM_ERR);
|
---|
5319 | }
|
---|
5320 | #endif
|
---|
5321 |
|
---|
5322 | template <typename T>
|
---|
5323 | cl_int getInfo(cl_program_info name, T* param) const
|
---|
5324 | {
|
---|
5325 | return detail::errHandler(
|
---|
5326 | detail::getInfo(&::clGetProgramInfo, object_, name, param),
|
---|
5327 | __GET_PROGRAM_INFO_ERR);
|
---|
5328 | }
|
---|
5329 |
|
---|
5330 | template <cl_program_info name> typename
|
---|
5331 | detail::param_traits<detail::cl_program_info, name>::param_type
|
---|
5332 | getInfo(cl_int* err = NULL) const
|
---|
5333 | {
|
---|
5334 | typename detail::param_traits<
|
---|
5335 | detail::cl_program_info, name>::param_type param;
|
---|
5336 | cl_int result = getInfo(name, ¶m);
|
---|
5337 | if (err != NULL) {
|
---|
5338 | *err = result;
|
---|
5339 | }
|
---|
5340 | return param;
|
---|
5341 | }
|
---|
5342 |
|
---|
5343 | template <typename T>
|
---|
5344 | cl_int getBuildInfo(
|
---|
5345 | const Device& device, cl_program_build_info name, T* param) const
|
---|
5346 | {
|
---|
5347 | return detail::errHandler(
|
---|
5348 | detail::getInfo(
|
---|
5349 | &::clGetProgramBuildInfo, object_, device(), name, param),
|
---|
5350 | __GET_PROGRAM_BUILD_INFO_ERR);
|
---|
5351 | }
|
---|
5352 |
|
---|
5353 | template <cl_program_build_info name> typename
|
---|
5354 | detail::param_traits<detail::cl_program_build_info, name>::param_type
|
---|
5355 | getBuildInfo(const Device& device, cl_int* err = NULL) const
|
---|
5356 | {
|
---|
5357 | typename detail::param_traits<
|
---|
5358 | detail::cl_program_build_info, name>::param_type param;
|
---|
5359 | cl_int result = getBuildInfo(device, name, ¶m);
|
---|
5360 | if (err != NULL) {
|
---|
5361 | *err = result;
|
---|
5362 | }
|
---|
5363 | return param;
|
---|
5364 | }
|
---|
5365 |
|
---|
5366 | cl_int createKernels(VECTOR_CLASS<Kernel>* kernels)
|
---|
5367 | {
|
---|
5368 | cl_uint numKernels;
|
---|
5369 | cl_int err = ::clCreateKernelsInProgram(object_, 0, NULL, &numKernels);
|
---|
5370 | if (err != CL_SUCCESS) {
|
---|
5371 | return detail::errHandler(err, __CREATE_KERNELS_IN_PROGRAM_ERR);
|
---|
5372 | }
|
---|
5373 |
|
---|
5374 | Kernel* value = (Kernel*) alloca(numKernels * sizeof(Kernel));
|
---|
5375 | err = ::clCreateKernelsInProgram(
|
---|
5376 | object_, numKernels, (cl_kernel*) value, NULL);
|
---|
5377 | if (err != CL_SUCCESS) {
|
---|
5378 | return detail::errHandler(err, __CREATE_KERNELS_IN_PROGRAM_ERR);
|
---|
5379 | }
|
---|
5380 |
|
---|
5381 | kernels->assign(&value[0], &value[numKernels]);
|
---|
5382 | return CL_SUCCESS;
|
---|
5383 | }
|
---|
5384 | };
|
---|
5385 |
|
---|
5386 | #if defined(CL_VERSION_1_2)
|
---|
5387 | inline Program linkProgram(
|
---|
5388 | Program input1,
|
---|
5389 | Program input2,
|
---|
5390 | const char* options = NULL,
|
---|
5391 | void (CL_CALLBACK * notifyFptr)(cl_program, void *) = NULL,
|
---|
5392 | void* data = NULL,
|
---|
5393 | cl_int* err = NULL)
|
---|
5394 | {
|
---|
5395 | cl_int error_local = CL_SUCCESS;
|
---|
5396 |
|
---|
5397 | cl_program programs[2] = { input1(), input2() };
|
---|
5398 |
|
---|
5399 | Context ctx = input1.getInfo<CL_PROGRAM_CONTEXT>(&error_local);
|
---|
5400 | if(error_local!=CL_SUCCESS) {
|
---|
5401 | detail::errHandler(error_local, __LINK_PROGRAM_ERR);
|
---|
5402 | }
|
---|
5403 |
|
---|
5404 | cl_program prog = ::clLinkProgram(
|
---|
5405 | ctx(),
|
---|
5406 | 0,
|
---|
5407 | NULL,
|
---|
5408 | options,
|
---|
5409 | 2,
|
---|
5410 | programs,
|
---|
5411 | notifyFptr,
|
---|
5412 | data,
|
---|
5413 | &error_local);
|
---|
5414 |
|
---|
5415 | detail::errHandler(error_local,__COMPILE_PROGRAM_ERR);
|
---|
5416 | if (err != NULL) {
|
---|
5417 | *err = error_local;
|
---|
5418 | }
|
---|
5419 |
|
---|
5420 | return Program(prog);
|
---|
5421 | }
|
---|
5422 |
|
---|
5423 | inline Program linkProgram(
|
---|
5424 | VECTOR_CLASS<Program> inputPrograms,
|
---|
5425 | const char* options = NULL,
|
---|
5426 | void (CL_CALLBACK * notifyFptr)(cl_program, void *) = NULL,
|
---|
5427 | void* data = NULL,
|
---|
5428 | cl_int* err = NULL)
|
---|
5429 | {
|
---|
5430 | cl_int error_local = CL_SUCCESS;
|
---|
5431 |
|
---|
5432 | cl_program * programs = (cl_program*) alloca(inputPrograms.size() * sizeof(cl_program));
|
---|
5433 |
|
---|
5434 | if (programs != NULL) {
|
---|
5435 | for (unsigned int i = 0; i < inputPrograms.size(); i++) {
|
---|
5436 | programs[i] = inputPrograms[i]();
|
---|
5437 | }
|
---|
5438 | }
|
---|
5439 |
|
---|
5440 | Context ctx;
|
---|
5441 | if(inputPrograms.size() > 0) {
|
---|
5442 | ctx = inputPrograms[0].getInfo<CL_PROGRAM_CONTEXT>(&error_local);
|
---|
5443 | if(error_local!=CL_SUCCESS) {
|
---|
5444 | detail::errHandler(error_local, __LINK_PROGRAM_ERR);
|
---|
5445 | }
|
---|
5446 | }
|
---|
5447 | cl_program prog = ::clLinkProgram(
|
---|
5448 | ctx(),
|
---|
5449 | 0,
|
---|
5450 | NULL,
|
---|
5451 | options,
|
---|
5452 | (cl_uint)inputPrograms.size(),
|
---|
5453 | programs,
|
---|
5454 | notifyFptr,
|
---|
5455 | data,
|
---|
5456 | &error_local);
|
---|
5457 |
|
---|
5458 | detail::errHandler(error_local,__COMPILE_PROGRAM_ERR);
|
---|
5459 | if (err != NULL) {
|
---|
5460 | *err = error_local;
|
---|
5461 | }
|
---|
5462 |
|
---|
5463 | return Program(prog);
|
---|
5464 | }
|
---|
5465 | #endif
|
---|
5466 |
|
---|
5467 | template<>
|
---|
5468 | inline VECTOR_CLASS<char *> cl::Program::getInfo<CL_PROGRAM_BINARIES>(cl_int* err) const
|
---|
5469 | {
|
---|
5470 | VECTOR_CLASS< ::size_t> sizes = getInfo<CL_PROGRAM_BINARY_SIZES>();
|
---|
5471 | VECTOR_CLASS<char *> binaries;
|
---|
5472 | for (VECTOR_CLASS< ::size_t>::iterator s = sizes.begin(); s != sizes.end(); ++s)
|
---|
5473 | {
|
---|
5474 | char *ptr = NULL;
|
---|
5475 | if (*s != 0)
|
---|
5476 | ptr = new char[*s];
|
---|
5477 | binaries.push_back(ptr);
|
---|
5478 | }
|
---|
5479 |
|
---|
5480 | cl_int result = getInfo(CL_PROGRAM_BINARIES, &binaries);
|
---|
5481 | if (err != NULL) {
|
---|
5482 | *err = result;
|
---|
5483 | }
|
---|
5484 | return binaries;
|
---|
5485 | }
|
---|
5486 |
|
---|
5487 | inline Kernel::Kernel(const Program& program, const char* name, cl_int* err)
|
---|
5488 | {
|
---|
5489 | cl_int error;
|
---|
5490 |
|
---|
5491 | object_ = ::clCreateKernel(program(), name, &error);
|
---|
5492 | detail::errHandler(error, __CREATE_KERNEL_ERR);
|
---|
5493 |
|
---|
5494 | if (err != NULL) {
|
---|
5495 | *err = error;
|
---|
5496 | }
|
---|
5497 |
|
---|
5498 | }
|
---|
5499 |
|
---|
5500 | /*! \class CommandQueue
|
---|
5501 | * \brief CommandQueue interface for cl_command_queue.
|
---|
5502 | */
|
---|
5503 | class CommandQueue : public detail::Wrapper<cl_command_queue>
|
---|
5504 | {
|
---|
5505 | private:
|
---|
5506 | #ifdef CL_HPP_CPP11_ATOMICS_SUPPORTED
|
---|
5507 | static std::atomic<int> default_initialized_;
|
---|
5508 | #else // !CL_HPP_CPP11_ATOMICS_SUPPORTED
|
---|
5509 | static volatile int default_initialized_;
|
---|
5510 | #endif // !CL_HPP_CPP11_ATOMICS_SUPPORTED
|
---|
5511 | static CommandQueue default_;
|
---|
5512 | static volatile cl_int default_error_;
|
---|
5513 | public:
|
---|
5514 | CommandQueue(
|
---|
5515 | cl_command_queue_properties properties,
|
---|
5516 | cl_int* err = NULL)
|
---|
5517 | {
|
---|
5518 | cl_int error;
|
---|
5519 |
|
---|
5520 | Context context = Context::getDefault(&error);
|
---|
5521 | detail::errHandler(error, __CREATE_CONTEXT_ERR);
|
---|
5522 |
|
---|
5523 | if (error != CL_SUCCESS) {
|
---|
5524 | if (err != NULL) {
|
---|
5525 | *err = error;
|
---|
5526 | }
|
---|
5527 | }
|
---|
5528 | else {
|
---|
5529 | Device device = context.getInfo<CL_CONTEXT_DEVICES>()[0];
|
---|
5530 |
|
---|
5531 | object_ = ::clCreateCommandQueue(
|
---|
5532 | context(), device(), properties, &error);
|
---|
5533 |
|
---|
5534 | detail::errHandler(error, __CREATE_COMMAND_QUEUE_ERR);
|
---|
5535 | if (err != NULL) {
|
---|
5536 | *err = error;
|
---|
5537 | }
|
---|
5538 | }
|
---|
5539 | }
|
---|
5540 | /*!
|
---|
5541 | * \brief Constructs a CommandQueue for an implementation defined device in the given context
|
---|
5542 | */
|
---|
5543 | explicit CommandQueue(
|
---|
5544 | const Context& context,
|
---|
5545 | cl_command_queue_properties properties = 0,
|
---|
5546 | cl_int* err = NULL)
|
---|
5547 | {
|
---|
5548 | cl_int error;
|
---|
5549 | VECTOR_CLASS<cl::Device> devices;
|
---|
5550 | error = context.getInfo(CL_CONTEXT_DEVICES, &devices);
|
---|
5551 |
|
---|
5552 | detail::errHandler(error, __CREATE_CONTEXT_ERR);
|
---|
5553 |
|
---|
5554 | if (error != CL_SUCCESS)
|
---|
5555 | {
|
---|
5556 | if (err != NULL) {
|
---|
5557 | *err = error;
|
---|
5558 | }
|
---|
5559 | return;
|
---|
5560 | }
|
---|
5561 |
|
---|
5562 | object_ = ::clCreateCommandQueue(context(), devices[0](), properties, &error);
|
---|
5563 |
|
---|
5564 | detail::errHandler(error, __CREATE_COMMAND_QUEUE_ERR);
|
---|
5565 |
|
---|
5566 | if (err != NULL) {
|
---|
5567 | *err = error;
|
---|
5568 | }
|
---|
5569 |
|
---|
5570 | }
|
---|
5571 |
|
---|
5572 | CommandQueue(
|
---|
5573 | const Context& context,
|
---|
5574 | const Device& device,
|
---|
5575 | cl_command_queue_properties properties = 0,
|
---|
5576 | cl_int* err = NULL)
|
---|
5577 | {
|
---|
5578 | cl_int error;
|
---|
5579 | object_ = ::clCreateCommandQueue(
|
---|
5580 | context(), device(), properties, &error);
|
---|
5581 |
|
---|
5582 | detail::errHandler(error, __CREATE_COMMAND_QUEUE_ERR);
|
---|
5583 | if (err != NULL) {
|
---|
5584 | *err = error;
|
---|
5585 | }
|
---|
5586 | }
|
---|
5587 |
|
---|
5588 | /*! \brief Copy constructor to forward copy to the superclass correctly.
|
---|
5589 | * Required for MSVC.
|
---|
5590 | */
|
---|
5591 | CommandQueue(const CommandQueue& queue) : detail::Wrapper<cl_type>(queue) {}
|
---|
5592 |
|
---|
5593 | /*! \brief Copy assignment to forward copy to the superclass correctly.
|
---|
5594 | * Required for MSVC.
|
---|
5595 | */
|
---|
5596 | CommandQueue& operator = (const CommandQueue &queue)
|
---|
5597 | {
|
---|
5598 | detail::Wrapper<cl_type>::operator=(queue);
|
---|
5599 | return *this;
|
---|
5600 | }
|
---|
5601 |
|
---|
5602 | #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
|
---|
5603 | /*! \brief Move constructor to forward move to the superclass correctly.
|
---|
5604 | * Required for MSVC.
|
---|
5605 | */
|
---|
5606 | CommandQueue(CommandQueue&& queue) CL_HPP_NOEXCEPT : detail::Wrapper<cl_type>(std::move(queue)) {}
|
---|
5607 |
|
---|
5608 | /*! \brief Move assignment to forward move to the superclass correctly.
|
---|
5609 | * Required for MSVC.
|
---|
5610 | */
|
---|
5611 | CommandQueue& operator = (CommandQueue &&queue)
|
---|
5612 | {
|
---|
5613 | detail::Wrapper<cl_type>::operator=(std::move(queue));
|
---|
5614 | return *this;
|
---|
5615 | }
|
---|
5616 | #endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
|
---|
5617 |
|
---|
5618 | static CommandQueue getDefault(cl_int * err = NULL)
|
---|
5619 | {
|
---|
5620 | int state = detail::compare_exchange(
|
---|
5621 | &default_initialized_,
|
---|
5622 | __DEFAULT_BEING_INITIALIZED, __DEFAULT_NOT_INITIALIZED);
|
---|
5623 |
|
---|
5624 | if (state & __DEFAULT_INITIALIZED) {
|
---|
5625 | if (err != NULL) {
|
---|
5626 | *err = default_error_;
|
---|
5627 | }
|
---|
5628 | return default_;
|
---|
5629 | }
|
---|
5630 |
|
---|
5631 | if (state & __DEFAULT_BEING_INITIALIZED) {
|
---|
5632 | // Assume writes will propagate eventually...
|
---|
5633 | while(default_initialized_ != __DEFAULT_INITIALIZED) {
|
---|
5634 | detail::fence();
|
---|
5635 | }
|
---|
5636 |
|
---|
5637 | if (err != NULL) {
|
---|
5638 | *err = default_error_;
|
---|
5639 | }
|
---|
5640 | return default_;
|
---|
5641 | }
|
---|
5642 |
|
---|
5643 | cl_int error;
|
---|
5644 |
|
---|
5645 | Context context = Context::getDefault(&error);
|
---|
5646 | detail::errHandler(error, __CREATE_COMMAND_QUEUE_ERR);
|
---|
5647 |
|
---|
5648 | if (error != CL_SUCCESS) {
|
---|
5649 | if (err != NULL) {
|
---|
5650 | *err = error;
|
---|
5651 | }
|
---|
5652 | }
|
---|
5653 | else {
|
---|
5654 | Device device = context.getInfo<CL_CONTEXT_DEVICES>()[0];
|
---|
5655 |
|
---|
5656 | default_ = CommandQueue(context, device, 0, &error);
|
---|
5657 |
|
---|
5658 | detail::errHandler(error, __CREATE_COMMAND_QUEUE_ERR);
|
---|
5659 | if (err != NULL) {
|
---|
5660 | *err = error;
|
---|
5661 | }
|
---|
5662 | }
|
---|
5663 |
|
---|
5664 | detail::fence();
|
---|
5665 |
|
---|
5666 | default_error_ = error;
|
---|
5667 | // Assume writes will propagate eventually...
|
---|
5668 | default_initialized_ = __DEFAULT_INITIALIZED;
|
---|
5669 |
|
---|
5670 | detail::fence();
|
---|
5671 |
|
---|
5672 | if (err != NULL) {
|
---|
5673 | *err = default_error_;
|
---|
5674 | }
|
---|
5675 | return default_;
|
---|
5676 |
|
---|
5677 | }
|
---|
5678 |
|
---|
5679 | CommandQueue() { }
|
---|
5680 |
|
---|
5681 | __CL_EXPLICIT_CONSTRUCTORS CommandQueue(const cl_command_queue& commandQueue) : detail::Wrapper<cl_type>(commandQueue) { }
|
---|
5682 |
|
---|
5683 | CommandQueue& operator = (const cl_command_queue& rhs)
|
---|
5684 | {
|
---|
5685 | detail::Wrapper<cl_type>::operator=(rhs);
|
---|
5686 | return *this;
|
---|
5687 | }
|
---|
5688 |
|
---|
5689 | template <typename T>
|
---|
5690 | cl_int getInfo(cl_command_queue_info name, T* param) const
|
---|
5691 | {
|
---|
5692 | return detail::errHandler(
|
---|
5693 | detail::getInfo(
|
---|
5694 | &::clGetCommandQueueInfo, object_, name, param),
|
---|
5695 | __GET_COMMAND_QUEUE_INFO_ERR);
|
---|
5696 | }
|
---|
5697 |
|
---|
5698 | template <cl_command_queue_info name> typename
|
---|
5699 | detail::param_traits<detail::cl_command_queue_info, name>::param_type
|
---|
5700 | getInfo(cl_int* err = NULL) const
|
---|
5701 | {
|
---|
5702 | typename detail::param_traits<
|
---|
5703 | detail::cl_command_queue_info, name>::param_type param;
|
---|
5704 | cl_int result = getInfo(name, ¶m);
|
---|
5705 | if (err != NULL) {
|
---|
5706 | *err = result;
|
---|
5707 | }
|
---|
5708 | return param;
|
---|
5709 | }
|
---|
5710 |
|
---|
5711 | cl_int enqueueReadBuffer(
|
---|
5712 | const Buffer& buffer,
|
---|
5713 | cl_bool blocking,
|
---|
5714 | ::size_t offset,
|
---|
5715 | ::size_t size,
|
---|
5716 | void* ptr,
|
---|
5717 | const VECTOR_CLASS<Event>* events = NULL,
|
---|
5718 | Event* event = NULL) const
|
---|
5719 | {
|
---|
5720 | cl_event tmp;
|
---|
5721 | cl_int err = detail::errHandler(
|
---|
5722 | ::clEnqueueReadBuffer(
|
---|
5723 | object_, buffer(), blocking, offset, size,
|
---|
5724 | ptr,
|
---|
5725 | (events != NULL) ? (cl_uint) events->size() : 0,
|
---|
5726 | (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
|
---|
5727 | (event != NULL) ? &tmp : NULL),
|
---|
5728 | __ENQUEUE_READ_BUFFER_ERR);
|
---|
5729 |
|
---|
5730 | if (event != NULL && err == CL_SUCCESS)
|
---|
5731 | *event = tmp;
|
---|
5732 |
|
---|
5733 | return err;
|
---|
5734 | }
|
---|
5735 |
|
---|
5736 | cl_int enqueueWriteBuffer(
|
---|
5737 | const Buffer& buffer,
|
---|
5738 | cl_bool blocking,
|
---|
5739 | ::size_t offset,
|
---|
5740 | ::size_t size,
|
---|
5741 | const void* ptr,
|
---|
5742 | const VECTOR_CLASS<Event>* events = NULL,
|
---|
5743 | Event* event = NULL) const
|
---|
5744 | {
|
---|
5745 | cl_event tmp;
|
---|
5746 | cl_int err = detail::errHandler(
|
---|
5747 | ::clEnqueueWriteBuffer(
|
---|
5748 | object_, buffer(), blocking, offset, size,
|
---|
5749 | ptr,
|
---|
5750 | (events != NULL) ? (cl_uint) events->size() : 0,
|
---|
5751 | (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
|
---|
5752 | (event != NULL) ? &tmp : NULL),
|
---|
5753 | __ENQUEUE_WRITE_BUFFER_ERR);
|
---|
5754 |
|
---|
5755 | if (event != NULL && err == CL_SUCCESS)
|
---|
5756 | *event = tmp;
|
---|
5757 |
|
---|
5758 | return err;
|
---|
5759 | }
|
---|
5760 |
|
---|
5761 | cl_int enqueueCopyBuffer(
|
---|
5762 | const Buffer& src,
|
---|
5763 | const Buffer& dst,
|
---|
5764 | ::size_t src_offset,
|
---|
5765 | ::size_t dst_offset,
|
---|
5766 | ::size_t size,
|
---|
5767 | const VECTOR_CLASS<Event>* events = NULL,
|
---|
5768 | Event* event = NULL) const
|
---|
5769 | {
|
---|
5770 | cl_event tmp;
|
---|
5771 | cl_int err = detail::errHandler(
|
---|
5772 | ::clEnqueueCopyBuffer(
|
---|
5773 | object_, src(), dst(), src_offset, dst_offset, size,
|
---|
5774 | (events != NULL) ? (cl_uint) events->size() : 0,
|
---|
5775 | (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
|
---|
5776 | (event != NULL) ? &tmp : NULL),
|
---|
5777 | __ENQEUE_COPY_BUFFER_ERR);
|
---|
5778 |
|
---|
5779 | if (event != NULL && err == CL_SUCCESS)
|
---|
5780 | *event = tmp;
|
---|
5781 |
|
---|
5782 | return err;
|
---|
5783 | }
|
---|
5784 | #if defined(CL_VERSION_1_1)
|
---|
5785 |
|
---|
5786 | cl_int enqueueReadBufferRect(
|
---|
5787 | const Buffer& buffer,
|
---|
5788 | cl_bool blocking,
|
---|
5789 | const size_t<3>& buffer_offset,
|
---|
5790 | const size_t<3>& host_offset,
|
---|
5791 | const size_t<3>& region,
|
---|
5792 | ::size_t buffer_row_pitch,
|
---|
5793 | ::size_t buffer_slice_pitch,
|
---|
5794 | ::size_t host_row_pitch,
|
---|
5795 | ::size_t host_slice_pitch,
|
---|
5796 | void *ptr,
|
---|
5797 | const VECTOR_CLASS<Event>* events = NULL,
|
---|
5798 | Event* event = NULL) const
|
---|
5799 | {
|
---|
5800 | cl_event tmp;
|
---|
5801 | cl_int err = detail::errHandler(
|
---|
5802 | ::clEnqueueReadBufferRect(
|
---|
5803 | object_,
|
---|
5804 | buffer(),
|
---|
5805 | blocking,
|
---|
5806 | (const ::size_t *)buffer_offset,
|
---|
5807 | (const ::size_t *)host_offset,
|
---|
5808 | (const ::size_t *)region,
|
---|
5809 | buffer_row_pitch,
|
---|
5810 | buffer_slice_pitch,
|
---|
5811 | host_row_pitch,
|
---|
5812 | host_slice_pitch,
|
---|
5813 | ptr,
|
---|
5814 | (events != NULL) ? (cl_uint) events->size() : 0,
|
---|
5815 | (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
|
---|
5816 | (event != NULL) ? &tmp : NULL),
|
---|
5817 | __ENQUEUE_READ_BUFFER_RECT_ERR);
|
---|
5818 |
|
---|
5819 | if (event != NULL && err == CL_SUCCESS)
|
---|
5820 | *event = tmp;
|
---|
5821 |
|
---|
5822 | return err;
|
---|
5823 | }
|
---|
5824 |
|
---|
5825 | cl_int enqueueWriteBufferRect(
|
---|
5826 | const Buffer& buffer,
|
---|
5827 | cl_bool blocking,
|
---|
5828 | const size_t<3>& buffer_offset,
|
---|
5829 | const size_t<3>& host_offset,
|
---|
5830 | const size_t<3>& region,
|
---|
5831 | ::size_t buffer_row_pitch,
|
---|
5832 | ::size_t buffer_slice_pitch,
|
---|
5833 | ::size_t host_row_pitch,
|
---|
5834 | ::size_t host_slice_pitch,
|
---|
5835 | const void *ptr,
|
---|
5836 | const VECTOR_CLASS<Event>* events = NULL,
|
---|
5837 | Event* event = NULL) const
|
---|
5838 | {
|
---|
5839 | cl_event tmp;
|
---|
5840 | cl_int err = detail::errHandler(
|
---|
5841 | ::clEnqueueWriteBufferRect(
|
---|
5842 | object_,
|
---|
5843 | buffer(),
|
---|
5844 | blocking,
|
---|
5845 | (const ::size_t *)buffer_offset,
|
---|
5846 | (const ::size_t *)host_offset,
|
---|
5847 | (const ::size_t *)region,
|
---|
5848 | buffer_row_pitch,
|
---|
5849 | buffer_slice_pitch,
|
---|
5850 | host_row_pitch,
|
---|
5851 | host_slice_pitch,
|
---|
5852 | ptr,
|
---|
5853 | (events != NULL) ? (cl_uint) events->size() : 0,
|
---|
5854 | (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
|
---|
5855 | (event != NULL) ? &tmp : NULL),
|
---|
5856 | __ENQUEUE_WRITE_BUFFER_RECT_ERR);
|
---|
5857 |
|
---|
5858 | if (event != NULL && err == CL_SUCCESS)
|
---|
5859 | *event = tmp;
|
---|
5860 |
|
---|
5861 | return err;
|
---|
5862 | }
|
---|
5863 |
|
---|
5864 | cl_int enqueueCopyBufferRect(
|
---|
5865 | const Buffer& src,
|
---|
5866 | const Buffer& dst,
|
---|
5867 | const size_t<3>& src_origin,
|
---|
5868 | const size_t<3>& dst_origin,
|
---|
5869 | const size_t<3>& region,
|
---|
5870 | ::size_t src_row_pitch,
|
---|
5871 | ::size_t src_slice_pitch,
|
---|
5872 | ::size_t dst_row_pitch,
|
---|
5873 | ::size_t dst_slice_pitch,
|
---|
5874 | const VECTOR_CLASS<Event>* events = NULL,
|
---|
5875 | Event* event = NULL) const
|
---|
5876 | {
|
---|
5877 | cl_event tmp;
|
---|
5878 | cl_int err = detail::errHandler(
|
---|
5879 | ::clEnqueueCopyBufferRect(
|
---|
5880 | object_,
|
---|
5881 | src(),
|
---|
5882 | dst(),
|
---|
5883 | (const ::size_t *)src_origin,
|
---|
5884 | (const ::size_t *)dst_origin,
|
---|
5885 | (const ::size_t *)region,
|
---|
5886 | src_row_pitch,
|
---|
5887 | src_slice_pitch,
|
---|
5888 | dst_row_pitch,
|
---|
5889 | dst_slice_pitch,
|
---|
5890 | (events != NULL) ? (cl_uint) events->size() : 0,
|
---|
5891 | (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
|
---|
5892 | (event != NULL) ? &tmp : NULL),
|
---|
5893 | __ENQEUE_COPY_BUFFER_RECT_ERR);
|
---|
5894 |
|
---|
5895 | if (event != NULL && err == CL_SUCCESS)
|
---|
5896 | *event = tmp;
|
---|
5897 |
|
---|
5898 | return err;
|
---|
5899 | }
|
---|
5900 | #endif //if defined(CL_VERSION_1_1)
|
---|
5901 |
|
---|
5902 | #if defined(CL_VERSION_1_2)
|
---|
5903 | /**
|
---|
5904 | * Enqueue a command to fill a buffer object with a pattern
|
---|
5905 | * of a given size. The pattern is specified a as vector.
|
---|
5906 | * \tparam PatternType The datatype of the pattern field.
|
---|
5907 | * The pattern type must be an accepted OpenCL data type.
|
---|
5908 | */
|
---|
5909 | template<typename PatternType>
|
---|
5910 | cl_int enqueueFillBuffer(
|
---|
5911 | const Buffer& buffer,
|
---|
5912 | PatternType pattern,
|
---|
5913 | ::size_t offset,
|
---|
5914 | ::size_t size,
|
---|
5915 | const VECTOR_CLASS<Event>* events = NULL,
|
---|
5916 | Event* event = NULL) const
|
---|
5917 | {
|
---|
5918 | cl_event tmp;
|
---|
5919 | cl_int err = detail::errHandler(
|
---|
5920 | ::clEnqueueFillBuffer(
|
---|
5921 | object_,
|
---|
5922 | buffer(),
|
---|
5923 | static_cast<void*>(&pattern),
|
---|
5924 | sizeof(PatternType),
|
---|
5925 | offset,
|
---|
5926 | size,
|
---|
5927 | (events != NULL) ? (cl_uint) events->size() : 0,
|
---|
5928 | (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
|
---|
5929 | (event != NULL) ? &tmp : NULL),
|
---|
5930 | __ENQUEUE_FILL_BUFFER_ERR);
|
---|
5931 |
|
---|
5932 | if (event != NULL && err == CL_SUCCESS)
|
---|
5933 | *event = tmp;
|
---|
5934 |
|
---|
5935 | return err;
|
---|
5936 | }
|
---|
5937 | #endif // #if defined(CL_VERSION_1_2)
|
---|
5938 |
|
---|
5939 | cl_int enqueueReadImage(
|
---|
5940 | const Image& image,
|
---|
5941 | cl_bool blocking,
|
---|
5942 | const size_t<3>& origin,
|
---|
5943 | const size_t<3>& region,
|
---|
5944 | ::size_t row_pitch,
|
---|
5945 | ::size_t slice_pitch,
|
---|
5946 | void* ptr,
|
---|
5947 | const VECTOR_CLASS<Event>* events = NULL,
|
---|
5948 | Event* event = NULL) const
|
---|
5949 | {
|
---|
5950 | cl_event tmp;
|
---|
5951 | cl_int err = detail::errHandler(
|
---|
5952 | ::clEnqueueReadImage(
|
---|
5953 | object_, image(), blocking, (const ::size_t *) origin,
|
---|
5954 | (const ::size_t *) region, row_pitch, slice_pitch, ptr,
|
---|
5955 | (events != NULL) ? (cl_uint) events->size() : 0,
|
---|
5956 | (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
|
---|
5957 | (event != NULL) ? &tmp : NULL),
|
---|
5958 | __ENQUEUE_READ_IMAGE_ERR);
|
---|
5959 |
|
---|
5960 | if (event != NULL && err == CL_SUCCESS)
|
---|
5961 | *event = tmp;
|
---|
5962 |
|
---|
5963 | return err;
|
---|
5964 | }
|
---|
5965 |
|
---|
5966 | cl_int enqueueWriteImage(
|
---|
5967 | const Image& image,
|
---|
5968 | cl_bool blocking,
|
---|
5969 | const size_t<3>& origin,
|
---|
5970 | const size_t<3>& region,
|
---|
5971 | ::size_t row_pitch,
|
---|
5972 | ::size_t slice_pitch,
|
---|
5973 | const void* ptr,
|
---|
5974 | const VECTOR_CLASS<Event>* events = NULL,
|
---|
5975 | Event* event = NULL) const
|
---|
5976 | {
|
---|
5977 | cl_event tmp;
|
---|
5978 | cl_int err = detail::errHandler(
|
---|
5979 | ::clEnqueueWriteImage(
|
---|
5980 | object_, image(), blocking, (const ::size_t *) origin,
|
---|
5981 | (const ::size_t *) region, row_pitch, slice_pitch, ptr,
|
---|
5982 | (events != NULL) ? (cl_uint) events->size() : 0,
|
---|
5983 | (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
|
---|
5984 | (event != NULL) ? &tmp : NULL),
|
---|
5985 | __ENQUEUE_WRITE_IMAGE_ERR);
|
---|
5986 |
|
---|
5987 | if (event != NULL && err == CL_SUCCESS)
|
---|
5988 | *event = tmp;
|
---|
5989 |
|
---|
5990 | return err;
|
---|
5991 | }
|
---|
5992 |
|
---|
5993 | cl_int enqueueCopyImage(
|
---|
5994 | const Image& src,
|
---|
5995 | const Image& dst,
|
---|
5996 | const size_t<3>& src_origin,
|
---|
5997 | const size_t<3>& dst_origin,
|
---|
5998 | const size_t<3>& region,
|
---|
5999 | const VECTOR_CLASS<Event>* events = NULL,
|
---|
6000 | Event* event = NULL) const
|
---|
6001 | {
|
---|
6002 | cl_event tmp;
|
---|
6003 | cl_int err = detail::errHandler(
|
---|
6004 | ::clEnqueueCopyImage(
|
---|
6005 | object_, src(), dst(), (const ::size_t *) src_origin,
|
---|
6006 | (const ::size_t *)dst_origin, (const ::size_t *) region,
|
---|
6007 | (events != NULL) ? (cl_uint) events->size() : 0,
|
---|
6008 | (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
|
---|
6009 | (event != NULL) ? &tmp : NULL),
|
---|
6010 | __ENQUEUE_COPY_IMAGE_ERR);
|
---|
6011 |
|
---|
6012 | if (event != NULL && err == CL_SUCCESS)
|
---|
6013 | *event = tmp;
|
---|
6014 |
|
---|
6015 | return err;
|
---|
6016 | }
|
---|
6017 |
|
---|
6018 | #if defined(CL_VERSION_1_2)
|
---|
6019 | /**
|
---|
6020 | * Enqueue a command to fill an image object with a specified color.
|
---|
6021 | * \param fillColor is the color to use to fill the image.
|
---|
6022 | * This is a four component RGBA floating-point color value if
|
---|
6023 | * the image channel data type is not an unnormalized signed or
|
---|
6024 | * unsigned data type.
|
---|
6025 | */
|
---|
6026 | cl_int enqueueFillImage(
|
---|
6027 | const Image& image,
|
---|
6028 | cl_float4 fillColor,
|
---|
6029 | const size_t<3>& origin,
|
---|
6030 | const size_t<3>& region,
|
---|
6031 | const VECTOR_CLASS<Event>* events = NULL,
|
---|
6032 | Event* event = NULL) const
|
---|
6033 | {
|
---|
6034 | cl_event tmp;
|
---|
6035 | cl_int err = detail::errHandler(
|
---|
6036 | ::clEnqueueFillImage(
|
---|
6037 | object_,
|
---|
6038 | image(),
|
---|
6039 | static_cast<void*>(&fillColor),
|
---|
6040 | (const ::size_t *) origin,
|
---|
6041 | (const ::size_t *) region,
|
---|
6042 | (events != NULL) ? (cl_uint) events->size() : 0,
|
---|
6043 | (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
|
---|
6044 | (event != NULL) ? &tmp : NULL),
|
---|
6045 | __ENQUEUE_FILL_IMAGE_ERR);
|
---|
6046 |
|
---|
6047 | if (event != NULL && err == CL_SUCCESS)
|
---|
6048 | *event = tmp;
|
---|
6049 |
|
---|
6050 | return err;
|
---|
6051 | }
|
---|
6052 |
|
---|
6053 | /**
|
---|
6054 | * Enqueue a command to fill an image object with a specified color.
|
---|
6055 | * \param fillColor is the color to use to fill the image.
|
---|
6056 | * This is a four component RGBA signed integer color value if
|
---|
6057 | * the image channel data type is an unnormalized signed integer
|
---|
6058 | * type.
|
---|
6059 | */
|
---|
6060 | cl_int enqueueFillImage(
|
---|
6061 | const Image& image,
|
---|
6062 | cl_int4 fillColor,
|
---|
6063 | const size_t<3>& origin,
|
---|
6064 | const size_t<3>& region,
|
---|
6065 | const VECTOR_CLASS<Event>* events = NULL,
|
---|
6066 | Event* event = NULL) const
|
---|
6067 | {
|
---|
6068 | cl_event tmp;
|
---|
6069 | cl_int err = detail::errHandler(
|
---|
6070 | ::clEnqueueFillImage(
|
---|
6071 | object_,
|
---|
6072 | image(),
|
---|
6073 | static_cast<void*>(&fillColor),
|
---|
6074 | (const ::size_t *) origin,
|
---|
6075 | (const ::size_t *) region,
|
---|
6076 | (events != NULL) ? (cl_uint) events->size() : 0,
|
---|
6077 | (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
|
---|
6078 | (event != NULL) ? &tmp : NULL),
|
---|
6079 | __ENQUEUE_FILL_IMAGE_ERR);
|
---|
6080 |
|
---|
6081 | if (event != NULL && err == CL_SUCCESS)
|
---|
6082 | *event = tmp;
|
---|
6083 |
|
---|
6084 | return err;
|
---|
6085 | }
|
---|
6086 |
|
---|
6087 | /**
|
---|
6088 | * Enqueue a command to fill an image object with a specified color.
|
---|
6089 | * \param fillColor is the color to use to fill the image.
|
---|
6090 | * This is a four component RGBA unsigned integer color value if
|
---|
6091 | * the image channel data type is an unnormalized unsigned integer
|
---|
6092 | * type.
|
---|
6093 | */
|
---|
6094 | cl_int enqueueFillImage(
|
---|
6095 | const Image& image,
|
---|
6096 | cl_uint4 fillColor,
|
---|
6097 | const size_t<3>& origin,
|
---|
6098 | const size_t<3>& region,
|
---|
6099 | const VECTOR_CLASS<Event>* events = NULL,
|
---|
6100 | Event* event = NULL) const
|
---|
6101 | {
|
---|
6102 | cl_event tmp;
|
---|
6103 | cl_int err = detail::errHandler(
|
---|
6104 | ::clEnqueueFillImage(
|
---|
6105 | object_,
|
---|
6106 | image(),
|
---|
6107 | static_cast<void*>(&fillColor),
|
---|
6108 | (const ::size_t *) origin,
|
---|
6109 | (const ::size_t *) region,
|
---|
6110 | (events != NULL) ? (cl_uint) events->size() : 0,
|
---|
6111 | (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
|
---|
6112 | (event != NULL) ? &tmp : NULL),
|
---|
6113 | __ENQUEUE_FILL_IMAGE_ERR);
|
---|
6114 |
|
---|
6115 | if (event != NULL && err == CL_SUCCESS)
|
---|
6116 | *event = tmp;
|
---|
6117 |
|
---|
6118 | return err;
|
---|
6119 | }
|
---|
6120 | #endif // #if defined(CL_VERSION_1_2)
|
---|
6121 |
|
---|
6122 | cl_int enqueueCopyImageToBuffer(
|
---|
6123 | const Image& src,
|
---|
6124 | const Buffer& dst,
|
---|
6125 | const size_t<3>& src_origin,
|
---|
6126 | const size_t<3>& region,
|
---|
6127 | ::size_t dst_offset,
|
---|
6128 | const VECTOR_CLASS<Event>* events = NULL,
|
---|
6129 | Event* event = NULL) const
|
---|
6130 | {
|
---|
6131 | cl_event tmp;
|
---|
6132 | cl_int err = detail::errHandler(
|
---|
6133 | ::clEnqueueCopyImageToBuffer(
|
---|
6134 | object_, src(), dst(), (const ::size_t *) src_origin,
|
---|
6135 | (const ::size_t *) region, dst_offset,
|
---|
6136 | (events != NULL) ? (cl_uint) events->size() : 0,
|
---|
6137 | (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
|
---|
6138 | (event != NULL) ? &tmp : NULL),
|
---|
6139 | __ENQUEUE_COPY_IMAGE_TO_BUFFER_ERR);
|
---|
6140 |
|
---|
6141 | if (event != NULL && err == CL_SUCCESS)
|
---|
6142 | *event = tmp;
|
---|
6143 |
|
---|
6144 | return err;
|
---|
6145 | }
|
---|
6146 |
|
---|
6147 | cl_int enqueueCopyBufferToImage(
|
---|
6148 | const Buffer& src,
|
---|
6149 | const Image& dst,
|
---|
6150 | ::size_t src_offset,
|
---|
6151 | const size_t<3>& dst_origin,
|
---|
6152 | const size_t<3>& region,
|
---|
6153 | const VECTOR_CLASS<Event>* events = NULL,
|
---|
6154 | Event* event = NULL) const
|
---|
6155 | {
|
---|
6156 | cl_event tmp;
|
---|
6157 | cl_int err = detail::errHandler(
|
---|
6158 | ::clEnqueueCopyBufferToImage(
|
---|
6159 | object_, src(), dst(), src_offset,
|
---|
6160 | (const ::size_t *) dst_origin, (const ::size_t *) region,
|
---|
6161 | (events != NULL) ? (cl_uint) events->size() : 0,
|
---|
6162 | (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
|
---|
6163 | (event != NULL) ? &tmp : NULL),
|
---|
6164 | __ENQUEUE_COPY_BUFFER_TO_IMAGE_ERR);
|
---|
6165 |
|
---|
6166 | if (event != NULL && err == CL_SUCCESS)
|
---|
6167 | *event = tmp;
|
---|
6168 |
|
---|
6169 | return err;
|
---|
6170 | }
|
---|
6171 |
|
---|
6172 | void* enqueueMapBuffer(
|
---|
6173 | const Buffer& buffer,
|
---|
6174 | cl_bool blocking,
|
---|
6175 | cl_map_flags flags,
|
---|
6176 | ::size_t offset,
|
---|
6177 | ::size_t size,
|
---|
6178 | const VECTOR_CLASS<Event>* events = NULL,
|
---|
6179 | Event* event = NULL,
|
---|
6180 | cl_int* err = NULL) const
|
---|
6181 | {
|
---|
6182 | cl_event tmp;
|
---|
6183 | cl_int error;
|
---|
6184 | void * result = ::clEnqueueMapBuffer(
|
---|
6185 | object_, buffer(), blocking, flags, offset, size,
|
---|
6186 | (events != NULL) ? (cl_uint) events->size() : 0,
|
---|
6187 | (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
|
---|
6188 | (event != NULL) ? &tmp : NULL,
|
---|
6189 | &error);
|
---|
6190 |
|
---|
6191 | detail::errHandler(error, __ENQUEUE_MAP_BUFFER_ERR);
|
---|
6192 | if (err != NULL) {
|
---|
6193 | *err = error;
|
---|
6194 | }
|
---|
6195 | if (event != NULL && error == CL_SUCCESS)
|
---|
6196 | *event = tmp;
|
---|
6197 |
|
---|
6198 | return result;
|
---|
6199 | }
|
---|
6200 |
|
---|
6201 | void* enqueueMapImage(
|
---|
6202 | const Image& buffer,
|
---|
6203 | cl_bool blocking,
|
---|
6204 | cl_map_flags flags,
|
---|
6205 | const size_t<3>& origin,
|
---|
6206 | const size_t<3>& region,
|
---|
6207 | ::size_t * row_pitch,
|
---|
6208 | ::size_t * slice_pitch,
|
---|
6209 | const VECTOR_CLASS<Event>* events = NULL,
|
---|
6210 | Event* event = NULL,
|
---|
6211 | cl_int* err = NULL) const
|
---|
6212 | {
|
---|
6213 | cl_event tmp;
|
---|
6214 | cl_int error;
|
---|
6215 | void * result = ::clEnqueueMapImage(
|
---|
6216 | object_, buffer(), blocking, flags,
|
---|
6217 | (const ::size_t *) origin, (const ::size_t *) region,
|
---|
6218 | row_pitch, slice_pitch,
|
---|
6219 | (events != NULL) ? (cl_uint) events->size() : 0,
|
---|
6220 | (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
|
---|
6221 | (event != NULL) ? &tmp : NULL,
|
---|
6222 | &error);
|
---|
6223 |
|
---|
6224 | detail::errHandler(error, __ENQUEUE_MAP_IMAGE_ERR);
|
---|
6225 | if (err != NULL) {
|
---|
6226 | *err = error;
|
---|
6227 | }
|
---|
6228 | if (event != NULL && error == CL_SUCCESS)
|
---|
6229 | *event = tmp;
|
---|
6230 | return result;
|
---|
6231 | }
|
---|
6232 |
|
---|
6233 | cl_int enqueueUnmapMemObject(
|
---|
6234 | const Memory& memory,
|
---|
6235 | void* mapped_ptr,
|
---|
6236 | const VECTOR_CLASS<Event>* events = NULL,
|
---|
6237 | Event* event = NULL) const
|
---|
6238 | {
|
---|
6239 | cl_event tmp;
|
---|
6240 | cl_int err = detail::errHandler(
|
---|
6241 | ::clEnqueueUnmapMemObject(
|
---|
6242 | object_, memory(), mapped_ptr,
|
---|
6243 | (events != NULL) ? (cl_uint) events->size() : 0,
|
---|
6244 | (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
|
---|
6245 | (event != NULL) ? &tmp : NULL),
|
---|
6246 | __ENQUEUE_UNMAP_MEM_OBJECT_ERR);
|
---|
6247 |
|
---|
6248 | if (event != NULL && err == CL_SUCCESS)
|
---|
6249 | *event = tmp;
|
---|
6250 |
|
---|
6251 | return err;
|
---|
6252 | }
|
---|
6253 |
|
---|
6254 | #if defined(CL_VERSION_1_2)
|
---|
6255 | /**
|
---|
6256 | * Enqueues a marker command which waits for either a list of events to complete,
|
---|
6257 | * or all previously enqueued commands to complete.
|
---|
6258 | *
|
---|
6259 | * Enqueues a marker command which waits for either a list of events to complete,
|
---|
6260 | * or if the list is empty it waits for all commands previously enqueued in command_queue
|
---|
6261 | * to complete before it completes. This command returns an event which can be waited on,
|
---|
6262 | * i.e. this event can be waited on to insure that all events either in the event_wait_list
|
---|
6263 | * or all previously enqueued commands, queued before this command to command_queue,
|
---|
6264 | * have completed.
|
---|
6265 | */
|
---|
6266 | cl_int enqueueMarkerWithWaitList(
|
---|
6267 | const VECTOR_CLASS<Event> *events = 0,
|
---|
6268 | Event *event = 0) const
|
---|
6269 | {
|
---|
6270 | cl_event tmp;
|
---|
6271 | cl_int err = detail::errHandler(
|
---|
6272 | ::clEnqueueMarkerWithWaitList(
|
---|
6273 | object_,
|
---|
6274 | (events != NULL) ? (cl_uint) events->size() : 0,
|
---|
6275 | (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
|
---|
6276 | (event != NULL) ? &tmp : NULL),
|
---|
6277 | __ENQUEUE_MARKER_WAIT_LIST_ERR);
|
---|
6278 |
|
---|
6279 | if (event != NULL && err == CL_SUCCESS)
|
---|
6280 | *event = tmp;
|
---|
6281 |
|
---|
6282 | return err;
|
---|
6283 | }
|
---|
6284 |
|
---|
6285 | /**
|
---|
6286 | * A synchronization point that enqueues a barrier operation.
|
---|
6287 | *
|
---|
6288 | * Enqueues a barrier command which waits for either a list of events to complete,
|
---|
6289 | * or if the list is empty it waits for all commands previously enqueued in command_queue
|
---|
6290 | * to complete before it completes. This command blocks command execution, that is, any
|
---|
6291 | * following commands enqueued after it do not execute until it completes. This command
|
---|
6292 | * returns an event which can be waited on, i.e. this event can be waited on to insure that
|
---|
6293 | * all events either in the event_wait_list or all previously enqueued commands, queued
|
---|
6294 | * before this command to command_queue, have completed.
|
---|
6295 | */
|
---|
6296 | cl_int enqueueBarrierWithWaitList(
|
---|
6297 | const VECTOR_CLASS<Event> *events = 0,
|
---|
6298 | Event *event = 0) const
|
---|
6299 | {
|
---|
6300 | cl_event tmp;
|
---|
6301 | cl_int err = detail::errHandler(
|
---|
6302 | ::clEnqueueBarrierWithWaitList(
|
---|
6303 | object_,
|
---|
6304 | (events != NULL) ? (cl_uint) events->size() : 0,
|
---|
6305 | (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
|
---|
6306 | (event != NULL) ? &tmp : NULL),
|
---|
6307 | __ENQUEUE_BARRIER_WAIT_LIST_ERR);
|
---|
6308 |
|
---|
6309 | if (event != NULL && err == CL_SUCCESS)
|
---|
6310 | *event = tmp;
|
---|
6311 |
|
---|
6312 | return err;
|
---|
6313 | }
|
---|
6314 |
|
---|
6315 | /**
|
---|
6316 | * Enqueues a command to indicate with which device a set of memory objects
|
---|
6317 | * should be associated.
|
---|
6318 | */
|
---|
6319 | cl_int enqueueMigrateMemObjects(
|
---|
6320 | const VECTOR_CLASS<Memory> &memObjects,
|
---|
6321 | cl_mem_migration_flags flags,
|
---|
6322 | const VECTOR_CLASS<Event>* events = NULL,
|
---|
6323 | Event* event = NULL
|
---|
6324 | ) const
|
---|
6325 | {
|
---|
6326 | cl_event tmp;
|
---|
6327 |
|
---|
6328 | cl_mem* localMemObjects = static_cast<cl_mem*>(alloca(memObjects.size() * sizeof(cl_mem)));
|
---|
6329 | for( int i = 0; i < (int)memObjects.size(); ++i ) {
|
---|
6330 | localMemObjects[i] = memObjects[i]();
|
---|
6331 | }
|
---|
6332 |
|
---|
6333 |
|
---|
6334 | cl_int err = detail::errHandler(
|
---|
6335 | ::clEnqueueMigrateMemObjects(
|
---|
6336 | object_,
|
---|
6337 | (cl_uint)memObjects.size(),
|
---|
6338 | static_cast<const cl_mem*>(localMemObjects),
|
---|
6339 | flags,
|
---|
6340 | (events != NULL) ? (cl_uint) events->size() : 0,
|
---|
6341 | (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
|
---|
6342 | (event != NULL) ? &tmp : NULL),
|
---|
6343 | __ENQUEUE_UNMAP_MEM_OBJECT_ERR);
|
---|
6344 |
|
---|
6345 | if (event != NULL && err == CL_SUCCESS)
|
---|
6346 | *event = tmp;
|
---|
6347 |
|
---|
6348 | return err;
|
---|
6349 | }
|
---|
6350 | #endif // #if defined(CL_VERSION_1_2)
|
---|
6351 |
|
---|
6352 | cl_int enqueueNDRangeKernel(
|
---|
6353 | const Kernel& kernel,
|
---|
6354 | const NDRange& offset,
|
---|
6355 | const NDRange& global,
|
---|
6356 | const NDRange& local = NullRange,
|
---|
6357 | const VECTOR_CLASS<Event>* events = NULL,
|
---|
6358 | Event* event = NULL) const
|
---|
6359 | {
|
---|
6360 | cl_event tmp;
|
---|
6361 | cl_int err = detail::errHandler(
|
---|
6362 | ::clEnqueueNDRangeKernel(
|
---|
6363 | object_, kernel(), (cl_uint) global.dimensions(),
|
---|
6364 | offset.dimensions() != 0 ? (const ::size_t*) offset : NULL,
|
---|
6365 | (const ::size_t*) global,
|
---|
6366 | local.dimensions() != 0 ? (const ::size_t*) local : NULL,
|
---|
6367 | (events != NULL) ? (cl_uint) events->size() : 0,
|
---|
6368 | (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
|
---|
6369 | (event != NULL) ? &tmp : NULL),
|
---|
6370 | __ENQUEUE_NDRANGE_KERNEL_ERR);
|
---|
6371 |
|
---|
6372 | if (event != NULL && err == CL_SUCCESS)
|
---|
6373 | *event = tmp;
|
---|
6374 |
|
---|
6375 | return err;
|
---|
6376 | }
|
---|
6377 |
|
---|
6378 | cl_int enqueueTask(
|
---|
6379 | const Kernel& kernel,
|
---|
6380 | const VECTOR_CLASS<Event>* events = NULL,
|
---|
6381 | Event* event = NULL) const
|
---|
6382 | {
|
---|
6383 | cl_event tmp;
|
---|
6384 | cl_int err = detail::errHandler(
|
---|
6385 | ::clEnqueueTask(
|
---|
6386 | object_, kernel(),
|
---|
6387 | (events != NULL) ? (cl_uint) events->size() : 0,
|
---|
6388 | (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
|
---|
6389 | (event != NULL) ? &tmp : NULL),
|
---|
6390 | __ENQUEUE_TASK_ERR);
|
---|
6391 |
|
---|
6392 | if (event != NULL && err == CL_SUCCESS)
|
---|
6393 | *event = tmp;
|
---|
6394 |
|
---|
6395 | return err;
|
---|
6396 | }
|
---|
6397 |
|
---|
6398 | cl_int enqueueNativeKernel(
|
---|
6399 | void (CL_CALLBACK *userFptr)(void *),
|
---|
6400 | std::pair<void*, ::size_t> args,
|
---|
6401 | const VECTOR_CLASS<Memory>* mem_objects = NULL,
|
---|
6402 | const VECTOR_CLASS<const void*>* mem_locs = NULL,
|
---|
6403 | const VECTOR_CLASS<Event>* events = NULL,
|
---|
6404 | Event* event = NULL) const
|
---|
6405 | {
|
---|
6406 | cl_mem * mems = (mem_objects != NULL && mem_objects->size() > 0)
|
---|
6407 | ? (cl_mem*) alloca(mem_objects->size() * sizeof(cl_mem))
|
---|
6408 | : NULL;
|
---|
6409 |
|
---|
6410 | if (mems != NULL) {
|
---|
6411 | for (unsigned int i = 0; i < mem_objects->size(); i++) {
|
---|
6412 | mems[i] = ((*mem_objects)[i])();
|
---|
6413 | }
|
---|
6414 | }
|
---|
6415 |
|
---|
6416 | cl_event tmp;
|
---|
6417 | cl_int err = detail::errHandler(
|
---|
6418 | ::clEnqueueNativeKernel(
|
---|
6419 | object_, userFptr, args.first, args.second,
|
---|
6420 | (mem_objects != NULL) ? (cl_uint) mem_objects->size() : 0,
|
---|
6421 | mems,
|
---|
6422 | (mem_locs != NULL && mem_locs->size() > 0) ? (const void **) &mem_locs->front() : NULL,
|
---|
6423 | (events != NULL) ? (cl_uint) events->size() : 0,
|
---|
6424 | (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
|
---|
6425 | (event != NULL) ? &tmp : NULL),
|
---|
6426 | __ENQUEUE_NATIVE_KERNEL);
|
---|
6427 |
|
---|
6428 | if (event != NULL && err == CL_SUCCESS)
|
---|
6429 | *event = tmp;
|
---|
6430 |
|
---|
6431 | return err;
|
---|
6432 | }
|
---|
6433 |
|
---|
6434 | /**
|
---|
6435 | * Deprecated APIs for 1.2
|
---|
6436 | */
|
---|
6437 | #if defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS) || (defined(CL_VERSION_1_1) && !defined(CL_VERSION_1_2))
|
---|
6438 | CL_EXT_PREFIX__VERSION_1_1_DEPRECATED
|
---|
6439 | cl_int enqueueMarker(Event* event = NULL) const CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED
|
---|
6440 | {
|
---|
6441 | cl_event tmp;
|
---|
6442 | cl_int err = detail::errHandler(
|
---|
6443 | ::clEnqueueMarker(
|
---|
6444 | object_,
|
---|
6445 | (event != NULL) ? &tmp : NULL),
|
---|
6446 | __ENQUEUE_MARKER_ERR);
|
---|
6447 |
|
---|
6448 | if (event != NULL && err == CL_SUCCESS)
|
---|
6449 | *event = tmp;
|
---|
6450 |
|
---|
6451 | return err;
|
---|
6452 | }
|
---|
6453 |
|
---|
6454 | CL_EXT_PREFIX__VERSION_1_1_DEPRECATED
|
---|
6455 | cl_int enqueueWaitForEvents(const VECTOR_CLASS<Event>& events) const CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED
|
---|
6456 | {
|
---|
6457 | return detail::errHandler(
|
---|
6458 | ::clEnqueueWaitForEvents(
|
---|
6459 | object_,
|
---|
6460 | (cl_uint) events.size(),
|
---|
6461 | events.size() > 0 ? (const cl_event*) &events.front() : NULL),
|
---|
6462 | __ENQUEUE_WAIT_FOR_EVENTS_ERR);
|
---|
6463 | }
|
---|
6464 | #endif // #if defined(CL_VERSION_1_1)
|
---|
6465 |
|
---|
6466 | cl_int enqueueAcquireGLObjects(
|
---|
6467 | const VECTOR_CLASS<Memory>* mem_objects = NULL,
|
---|
6468 | const VECTOR_CLASS<Event>* events = NULL,
|
---|
6469 | Event* event = NULL) const
|
---|
6470 | {
|
---|
6471 | cl_event tmp;
|
---|
6472 | cl_int err = detail::errHandler(
|
---|
6473 | ::clEnqueueAcquireGLObjects(
|
---|
6474 | object_,
|
---|
6475 | (mem_objects != NULL) ? (cl_uint) mem_objects->size() : 0,
|
---|
6476 | (mem_objects != NULL && mem_objects->size() > 0) ? (const cl_mem *) &mem_objects->front(): NULL,
|
---|
6477 | (events != NULL) ? (cl_uint) events->size() : 0,
|
---|
6478 | (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
|
---|
6479 | (event != NULL) ? &tmp : NULL),
|
---|
6480 | __ENQUEUE_ACQUIRE_GL_ERR);
|
---|
6481 |
|
---|
6482 | if (event != NULL && err == CL_SUCCESS)
|
---|
6483 | *event = tmp;
|
---|
6484 |
|
---|
6485 | return err;
|
---|
6486 | }
|
---|
6487 |
|
---|
6488 | cl_int enqueueReleaseGLObjects(
|
---|
6489 | const VECTOR_CLASS<Memory>* mem_objects = NULL,
|
---|
6490 | const VECTOR_CLASS<Event>* events = NULL,
|
---|
6491 | Event* event = NULL) const
|
---|
6492 | {
|
---|
6493 | cl_event tmp;
|
---|
6494 | cl_int err = detail::errHandler(
|
---|
6495 | ::clEnqueueReleaseGLObjects(
|
---|
6496 | object_,
|
---|
6497 | (mem_objects != NULL) ? (cl_uint) mem_objects->size() : 0,
|
---|
6498 | (mem_objects != NULL && mem_objects->size() > 0) ? (const cl_mem *) &mem_objects->front(): NULL,
|
---|
6499 | (events != NULL) ? (cl_uint) events->size() : 0,
|
---|
6500 | (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
|
---|
6501 | (event != NULL) ? &tmp : NULL),
|
---|
6502 | __ENQUEUE_RELEASE_GL_ERR);
|
---|
6503 |
|
---|
6504 | if (event != NULL && err == CL_SUCCESS)
|
---|
6505 | *event = tmp;
|
---|
6506 |
|
---|
6507 | return err;
|
---|
6508 | }
|
---|
6509 |
|
---|
6510 | #if defined (USE_DX_INTEROP)
|
---|
6511 | typedef CL_API_ENTRY cl_int (CL_API_CALL *PFN_clEnqueueAcquireD3D10ObjectsKHR)(
|
---|
6512 | cl_command_queue command_queue, cl_uint num_objects,
|
---|
6513 | const cl_mem* mem_objects, cl_uint num_events_in_wait_list,
|
---|
6514 | const cl_event* event_wait_list, cl_event* event);
|
---|
6515 | typedef CL_API_ENTRY cl_int (CL_API_CALL *PFN_clEnqueueReleaseD3D10ObjectsKHR)(
|
---|
6516 | cl_command_queue command_queue, cl_uint num_objects,
|
---|
6517 | const cl_mem* mem_objects, cl_uint num_events_in_wait_list,
|
---|
6518 | const cl_event* event_wait_list, cl_event* event);
|
---|
6519 |
|
---|
6520 | cl_int enqueueAcquireD3D10Objects(
|
---|
6521 | const VECTOR_CLASS<Memory>* mem_objects = NULL,
|
---|
6522 | const VECTOR_CLASS<Event>* events = NULL,
|
---|
6523 | Event* event = NULL) const
|
---|
6524 | {
|
---|
6525 | static PFN_clEnqueueAcquireD3D10ObjectsKHR pfn_clEnqueueAcquireD3D10ObjectsKHR = NULL;
|
---|
6526 | #if defined(CL_VERSION_1_2)
|
---|
6527 | cl_context context = getInfo<CL_QUEUE_CONTEXT>();
|
---|
6528 | cl::Device device(getInfo<CL_QUEUE_DEVICE>());
|
---|
6529 | cl_platform_id platform = device.getInfo<CL_DEVICE_PLATFORM>();
|
---|
6530 | __INIT_CL_EXT_FCN_PTR_PLATFORM(platform, clEnqueueAcquireD3D10ObjectsKHR);
|
---|
6531 | #endif
|
---|
6532 | #if defined(CL_VERSION_1_1)
|
---|
6533 | __INIT_CL_EXT_FCN_PTR(clEnqueueAcquireD3D10ObjectsKHR);
|
---|
6534 | #endif
|
---|
6535 |
|
---|
6536 | cl_event tmp;
|
---|
6537 | cl_int err = detail::errHandler(
|
---|
6538 | pfn_clEnqueueAcquireD3D10ObjectsKHR(
|
---|
6539 | object_,
|
---|
6540 | (mem_objects != NULL) ? (cl_uint) mem_objects->size() : 0,
|
---|
6541 | (mem_objects != NULL && mem_objects->size() > 0) ? (const cl_mem *) &mem_objects->front(): NULL,
|
---|
6542 | (events != NULL) ? (cl_uint) events->size() : 0,
|
---|
6543 | (events != NULL) ? (cl_event*) &events->front() : NULL,
|
---|
6544 | (event != NULL) ? &tmp : NULL),
|
---|
6545 | __ENQUEUE_ACQUIRE_GL_ERR);
|
---|
6546 |
|
---|
6547 | if (event != NULL && err == CL_SUCCESS)
|
---|
6548 | *event = tmp;
|
---|
6549 |
|
---|
6550 | return err;
|
---|
6551 | }
|
---|
6552 |
|
---|
6553 | cl_int enqueueReleaseD3D10Objects(
|
---|
6554 | const VECTOR_CLASS<Memory>* mem_objects = NULL,
|
---|
6555 | const VECTOR_CLASS<Event>* events = NULL,
|
---|
6556 | Event* event = NULL) const
|
---|
6557 | {
|
---|
6558 | static PFN_clEnqueueReleaseD3D10ObjectsKHR pfn_clEnqueueReleaseD3D10ObjectsKHR = NULL;
|
---|
6559 | #if defined(CL_VERSION_1_2)
|
---|
6560 | cl_context context = getInfo<CL_QUEUE_CONTEXT>();
|
---|
6561 | cl::Device device(getInfo<CL_QUEUE_DEVICE>());
|
---|
6562 | cl_platform_id platform = device.getInfo<CL_DEVICE_PLATFORM>();
|
---|
6563 | __INIT_CL_EXT_FCN_PTR_PLATFORM(platform, clEnqueueReleaseD3D10ObjectsKHR);
|
---|
6564 | #endif // #if defined(CL_VERSION_1_2)
|
---|
6565 | #if defined(CL_VERSION_1_1)
|
---|
6566 | __INIT_CL_EXT_FCN_PTR(clEnqueueReleaseD3D10ObjectsKHR);
|
---|
6567 | #endif // #if defined(CL_VERSION_1_1)
|
---|
6568 |
|
---|
6569 | cl_event tmp;
|
---|
6570 | cl_int err = detail::errHandler(
|
---|
6571 | pfn_clEnqueueReleaseD3D10ObjectsKHR(
|
---|
6572 | object_,
|
---|
6573 | (mem_objects != NULL) ? (cl_uint) mem_objects->size() : 0,
|
---|
6574 | (mem_objects != NULL && mem_objects->size() > 0) ? (const cl_mem *) &mem_objects->front(): NULL,
|
---|
6575 | (events != NULL) ? (cl_uint) events->size() : 0,
|
---|
6576 | (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
|
---|
6577 | (event != NULL) ? &tmp : NULL),
|
---|
6578 | __ENQUEUE_RELEASE_GL_ERR);
|
---|
6579 |
|
---|
6580 | if (event != NULL && err == CL_SUCCESS)
|
---|
6581 | *event = tmp;
|
---|
6582 |
|
---|
6583 | return err;
|
---|
6584 | }
|
---|
6585 | #endif
|
---|
6586 |
|
---|
6587 | /**
|
---|
6588 | * Deprecated APIs for 1.2
|
---|
6589 | */
|
---|
6590 | #if defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS) || (defined(CL_VERSION_1_1) && !defined(CL_VERSION_1_2))
|
---|
6591 | CL_EXT_PREFIX__VERSION_1_1_DEPRECATED
|
---|
6592 | cl_int enqueueBarrier() const CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED
|
---|
6593 | {
|
---|
6594 | return detail::errHandler(
|
---|
6595 | ::clEnqueueBarrier(object_),
|
---|
6596 | __ENQUEUE_BARRIER_ERR);
|
---|
6597 | }
|
---|
6598 | #endif // #if defined(CL_VERSION_1_1)
|
---|
6599 |
|
---|
6600 | cl_int flush() const
|
---|
6601 | {
|
---|
6602 | return detail::errHandler(::clFlush(object_), __FLUSH_ERR);
|
---|
6603 | }
|
---|
6604 |
|
---|
6605 | cl_int finish() const
|
---|
6606 | {
|
---|
6607 | return detail::errHandler(::clFinish(object_), __FINISH_ERR);
|
---|
6608 | }
|
---|
6609 | };
|
---|
6610 |
|
---|
6611 | #ifdef CL_HPP_CPP11_ATOMICS_SUPPORTED
|
---|
6612 | CL_WEAK_ATTRIB_PREFIX std::atomic<int> CL_WEAK_ATTRIB_SUFFIX CommandQueue::default_initialized_;
|
---|
6613 | #else // !CL_HPP_CPP11_ATOMICS_SUPPORTED
|
---|
6614 | CL_WEAK_ATTRIB_PREFIX volatile int CL_WEAK_ATTRIB_SUFFIX CommandQueue::default_initialized_ = __DEFAULT_NOT_INITIALIZED;
|
---|
6615 | #endif // !CL_HPP_CPP11_ATOMICS_SUPPORTED
|
---|
6616 |
|
---|
6617 | CL_WEAK_ATTRIB_PREFIX CommandQueue CL_WEAK_ATTRIB_SUFFIX CommandQueue::default_;
|
---|
6618 | CL_WEAK_ATTRIB_PREFIX volatile cl_int CL_WEAK_ATTRIB_SUFFIX CommandQueue::default_error_ = CL_SUCCESS;
|
---|
6619 |
|
---|
6620 | template< typename IteratorType >
|
---|
6621 | Buffer::Buffer(
|
---|
6622 | const Context &context,
|
---|
6623 | IteratorType startIterator,
|
---|
6624 | IteratorType endIterator,
|
---|
6625 | bool readOnly,
|
---|
6626 | bool useHostPtr,
|
---|
6627 | cl_int* err)
|
---|
6628 | {
|
---|
6629 | typedef typename std::iterator_traits<IteratorType>::value_type DataType;
|
---|
6630 | cl_int error;
|
---|
6631 |
|
---|
6632 | cl_mem_flags flags = 0;
|
---|
6633 | if( readOnly ) {
|
---|
6634 | flags |= CL_MEM_READ_ONLY;
|
---|
6635 | }
|
---|
6636 | else {
|
---|
6637 | flags |= CL_MEM_READ_WRITE;
|
---|
6638 | }
|
---|
6639 | if( useHostPtr ) {
|
---|
6640 | flags |= CL_MEM_USE_HOST_PTR;
|
---|
6641 | }
|
---|
6642 |
|
---|
6643 | ::size_t size = sizeof(DataType)*(endIterator - startIterator);
|
---|
6644 |
|
---|
6645 | if( useHostPtr ) {
|
---|
6646 | object_ = ::clCreateBuffer(context(), flags, size, static_cast<DataType*>(&*startIterator), &error);
|
---|
6647 | } else {
|
---|
6648 | object_ = ::clCreateBuffer(context(), flags, size, 0, &error);
|
---|
6649 | }
|
---|
6650 |
|
---|
6651 | detail::errHandler(error, __CREATE_BUFFER_ERR);
|
---|
6652 | if (err != NULL) {
|
---|
6653 | *err = error;
|
---|
6654 | }
|
---|
6655 |
|
---|
6656 | if( !useHostPtr ) {
|
---|
6657 | CommandQueue queue(context, 0, &error);
|
---|
6658 | detail::errHandler(error, __CREATE_BUFFER_ERR);
|
---|
6659 | if (err != NULL) {
|
---|
6660 | *err = error;
|
---|
6661 | }
|
---|
6662 |
|
---|
6663 | error = cl::copy(queue, startIterator, endIterator, *this);
|
---|
6664 | detail::errHandler(error, __CREATE_BUFFER_ERR);
|
---|
6665 | if (err != NULL) {
|
---|
6666 | *err = error;
|
---|
6667 | }
|
---|
6668 | }
|
---|
6669 | }
|
---|
6670 |
|
---|
6671 | template< typename IteratorType >
|
---|
6672 | Buffer::Buffer(
|
---|
6673 | const CommandQueue &queue,
|
---|
6674 | IteratorType startIterator,
|
---|
6675 | IteratorType endIterator,
|
---|
6676 | bool readOnly,
|
---|
6677 | bool useHostPtr,
|
---|
6678 | cl_int* err)
|
---|
6679 | {
|
---|
6680 | typedef typename std::iterator_traits<IteratorType>::value_type DataType;
|
---|
6681 | cl_int error;
|
---|
6682 |
|
---|
6683 | cl_mem_flags flags = 0;
|
---|
6684 | if (readOnly) {
|
---|
6685 | flags |= CL_MEM_READ_ONLY;
|
---|
6686 | }
|
---|
6687 | else {
|
---|
6688 | flags |= CL_MEM_READ_WRITE;
|
---|
6689 | }
|
---|
6690 | if (useHostPtr) {
|
---|
6691 | flags |= CL_MEM_USE_HOST_PTR;
|
---|
6692 | }
|
---|
6693 |
|
---|
6694 | ::size_t size = sizeof(DataType)*(endIterator - startIterator);
|
---|
6695 |
|
---|
6696 | Context context = queue.getInfo<CL_QUEUE_CONTEXT>();
|
---|
6697 |
|
---|
6698 | if (useHostPtr) {
|
---|
6699 | object_ = ::clCreateBuffer(context(), flags, size, static_cast<DataType*>(&*startIterator), &error);
|
---|
6700 | }
|
---|
6701 | else {
|
---|
6702 | object_ = ::clCreateBuffer(context(), flags, size, 0, &error);
|
---|
6703 | }
|
---|
6704 |
|
---|
6705 | detail::errHandler(error, __CREATE_BUFFER_ERR);
|
---|
6706 | if (err != NULL) {
|
---|
6707 | *err = error;
|
---|
6708 | }
|
---|
6709 |
|
---|
6710 | if (!useHostPtr) {
|
---|
6711 | error = cl::copy(queue, startIterator, endIterator, *this);
|
---|
6712 | detail::errHandler(error, __CREATE_BUFFER_ERR);
|
---|
6713 | if (err != NULL) {
|
---|
6714 | *err = error;
|
---|
6715 | }
|
---|
6716 | }
|
---|
6717 | }
|
---|
6718 |
|
---|
6719 | inline cl_int enqueueReadBuffer(
|
---|
6720 | const Buffer& buffer,
|
---|
6721 | cl_bool blocking,
|
---|
6722 | ::size_t offset,
|
---|
6723 | ::size_t size,
|
---|
6724 | void* ptr,
|
---|
6725 | const VECTOR_CLASS<Event>* events = NULL,
|
---|
6726 | Event* event = NULL)
|
---|
6727 | {
|
---|
6728 | cl_int error;
|
---|
6729 | CommandQueue queue = CommandQueue::getDefault(&error);
|
---|
6730 |
|
---|
6731 | if (error != CL_SUCCESS) {
|
---|
6732 | return error;
|
---|
6733 | }
|
---|
6734 |
|
---|
6735 | return queue.enqueueReadBuffer(buffer, blocking, offset, size, ptr, events, event);
|
---|
6736 | }
|
---|
6737 |
|
---|
6738 | inline cl_int enqueueWriteBuffer(
|
---|
6739 | const Buffer& buffer,
|
---|
6740 | cl_bool blocking,
|
---|
6741 | ::size_t offset,
|
---|
6742 | ::size_t size,
|
---|
6743 | const void* ptr,
|
---|
6744 | const VECTOR_CLASS<Event>* events = NULL,
|
---|
6745 | Event* event = NULL)
|
---|
6746 | {
|
---|
6747 | cl_int error;
|
---|
6748 | CommandQueue queue = CommandQueue::getDefault(&error);
|
---|
6749 |
|
---|
6750 | if (error != CL_SUCCESS) {
|
---|
6751 | return error;
|
---|
6752 | }
|
---|
6753 |
|
---|
6754 | return queue.enqueueWriteBuffer(buffer, blocking, offset, size, ptr, events, event);
|
---|
6755 | }
|
---|
6756 |
|
---|
6757 | inline void* enqueueMapBuffer(
|
---|
6758 | const Buffer& buffer,
|
---|
6759 | cl_bool blocking,
|
---|
6760 | cl_map_flags flags,
|
---|
6761 | ::size_t offset,
|
---|
6762 | ::size_t size,
|
---|
6763 | const VECTOR_CLASS<Event>* events = NULL,
|
---|
6764 | Event* event = NULL,
|
---|
6765 | cl_int* err = NULL)
|
---|
6766 | {
|
---|
6767 | cl_int error;
|
---|
6768 | CommandQueue queue = CommandQueue::getDefault(&error);
|
---|
6769 | detail::errHandler(error, __ENQUEUE_MAP_BUFFER_ERR);
|
---|
6770 | if (err != NULL) {
|
---|
6771 | *err = error;
|
---|
6772 | }
|
---|
6773 |
|
---|
6774 | void * result = ::clEnqueueMapBuffer(
|
---|
6775 | queue(), buffer(), blocking, flags, offset, size,
|
---|
6776 | (events != NULL) ? (cl_uint) events->size() : 0,
|
---|
6777 | (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
|
---|
6778 | (cl_event*) event,
|
---|
6779 | &error);
|
---|
6780 |
|
---|
6781 | detail::errHandler(error, __ENQUEUE_MAP_BUFFER_ERR);
|
---|
6782 | if (err != NULL) {
|
---|
6783 | *err = error;
|
---|
6784 | }
|
---|
6785 | return result;
|
---|
6786 | }
|
---|
6787 |
|
---|
6788 | inline cl_int enqueueUnmapMemObject(
|
---|
6789 | const Memory& memory,
|
---|
6790 | void* mapped_ptr,
|
---|
6791 | const VECTOR_CLASS<Event>* events = NULL,
|
---|
6792 | Event* event = NULL)
|
---|
6793 | {
|
---|
6794 | cl_int error;
|
---|
6795 | CommandQueue queue = CommandQueue::getDefault(&error);
|
---|
6796 | detail::errHandler(error, __ENQUEUE_MAP_BUFFER_ERR);
|
---|
6797 | if (error != CL_SUCCESS) {
|
---|
6798 | return error;
|
---|
6799 | }
|
---|
6800 |
|
---|
6801 | cl_event tmp;
|
---|
6802 | cl_int err = detail::errHandler(
|
---|
6803 | ::clEnqueueUnmapMemObject(
|
---|
6804 | queue(), memory(), mapped_ptr,
|
---|
6805 | (events != NULL) ? (cl_uint) events->size() : 0,
|
---|
6806 | (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
|
---|
6807 | (event != NULL) ? &tmp : NULL),
|
---|
6808 | __ENQUEUE_UNMAP_MEM_OBJECT_ERR);
|
---|
6809 |
|
---|
6810 | if (event != NULL && err == CL_SUCCESS)
|
---|
6811 | *event = tmp;
|
---|
6812 |
|
---|
6813 | return err;
|
---|
6814 | }
|
---|
6815 |
|
---|
6816 | inline cl_int enqueueCopyBuffer(
|
---|
6817 | const Buffer& src,
|
---|
6818 | const Buffer& dst,
|
---|
6819 | ::size_t src_offset,
|
---|
6820 | ::size_t dst_offset,
|
---|
6821 | ::size_t size,
|
---|
6822 | const VECTOR_CLASS<Event>* events = NULL,
|
---|
6823 | Event* event = NULL)
|
---|
6824 | {
|
---|
6825 | cl_int error;
|
---|
6826 | CommandQueue queue = CommandQueue::getDefault(&error);
|
---|
6827 |
|
---|
6828 | if (error != CL_SUCCESS) {
|
---|
6829 | return error;
|
---|
6830 | }
|
---|
6831 |
|
---|
6832 | return queue.enqueueCopyBuffer(src, dst, src_offset, dst_offset, size, events, event);
|
---|
6833 | }
|
---|
6834 |
|
---|
6835 | /**
|
---|
6836 | * Blocking copy operation between iterators and a buffer.
|
---|
6837 | * Host to Device.
|
---|
6838 | * Uses default command queue.
|
---|
6839 | */
|
---|
6840 | template< typename IteratorType >
|
---|
6841 | inline cl_int copy( IteratorType startIterator, IteratorType endIterator, cl::Buffer &buffer )
|
---|
6842 | {
|
---|
6843 | cl_int error;
|
---|
6844 | CommandQueue queue = CommandQueue::getDefault(&error);
|
---|
6845 | if (error != CL_SUCCESS)
|
---|
6846 | return error;
|
---|
6847 |
|
---|
6848 | return cl::copy(queue, startIterator, endIterator, buffer);
|
---|
6849 | }
|
---|
6850 |
|
---|
6851 | /**
|
---|
6852 | * Blocking copy operation between iterators and a buffer.
|
---|
6853 | * Device to Host.
|
---|
6854 | * Uses default command queue.
|
---|
6855 | */
|
---|
6856 | template< typename IteratorType >
|
---|
6857 | inline cl_int copy( const cl::Buffer &buffer, IteratorType startIterator, IteratorType endIterator )
|
---|
6858 | {
|
---|
6859 | cl_int error;
|
---|
6860 | CommandQueue queue = CommandQueue::getDefault(&error);
|
---|
6861 | if (error != CL_SUCCESS)
|
---|
6862 | return error;
|
---|
6863 |
|
---|
6864 | return cl::copy(queue, buffer, startIterator, endIterator);
|
---|
6865 | }
|
---|
6866 |
|
---|
6867 | /**
|
---|
6868 | * Blocking copy operation between iterators and a buffer.
|
---|
6869 | * Host to Device.
|
---|
6870 | * Uses specified queue.
|
---|
6871 | */
|
---|
6872 | template< typename IteratorType >
|
---|
6873 | inline cl_int copy( const CommandQueue &queue, IteratorType startIterator, IteratorType endIterator, cl::Buffer &buffer )
|
---|
6874 | {
|
---|
6875 | typedef typename std::iterator_traits<IteratorType>::value_type DataType;
|
---|
6876 | cl_int error;
|
---|
6877 |
|
---|
6878 | ::size_t length = endIterator-startIterator;
|
---|
6879 | ::size_t byteLength = length*sizeof(DataType);
|
---|
6880 |
|
---|
6881 | DataType *pointer =
|
---|
6882 | static_cast<DataType*>(queue.enqueueMapBuffer(buffer, CL_TRUE, CL_MAP_WRITE, 0, byteLength, 0, 0, &error));
|
---|
6883 | // if exceptions enabled, enqueueMapBuffer will throw
|
---|
6884 | if( error != CL_SUCCESS ) {
|
---|
6885 | return error;
|
---|
6886 | }
|
---|
6887 | #if defined(_MSC_VER)
|
---|
6888 | std::copy(
|
---|
6889 | startIterator,
|
---|
6890 | endIterator,
|
---|
6891 | stdext::checked_array_iterator<DataType*>(
|
---|
6892 | pointer, length));
|
---|
6893 | #else
|
---|
6894 | std::copy(startIterator, endIterator, pointer);
|
---|
6895 | #endif
|
---|
6896 | Event endEvent;
|
---|
6897 | error = queue.enqueueUnmapMemObject(buffer, pointer, 0, &endEvent);
|
---|
6898 | // if exceptions enabled, enqueueUnmapMemObject will throw
|
---|
6899 | if( error != CL_SUCCESS ) {
|
---|
6900 | return error;
|
---|
6901 | }
|
---|
6902 | endEvent.wait();
|
---|
6903 | return CL_SUCCESS;
|
---|
6904 | }
|
---|
6905 |
|
---|
6906 | /**
|
---|
6907 | * Blocking copy operation between iterators and a buffer.
|
---|
6908 | * Device to Host.
|
---|
6909 | * Uses specified queue.
|
---|
6910 | */
|
---|
6911 | template< typename IteratorType >
|
---|
6912 | inline cl_int copy( const CommandQueue &queue, const cl::Buffer &buffer, IteratorType startIterator, IteratorType endIterator )
|
---|
6913 | {
|
---|
6914 | typedef typename std::iterator_traits<IteratorType>::value_type DataType;
|
---|
6915 | cl_int error;
|
---|
6916 |
|
---|
6917 | ::size_t length = endIterator-startIterator;
|
---|
6918 | ::size_t byteLength = length*sizeof(DataType);
|
---|
6919 |
|
---|
6920 | DataType *pointer =
|
---|
6921 | static_cast<DataType*>(queue.enqueueMapBuffer(buffer, CL_TRUE, CL_MAP_READ, 0, byteLength, 0, 0, &error));
|
---|
6922 | // if exceptions enabled, enqueueMapBuffer will throw
|
---|
6923 | if( error != CL_SUCCESS ) {
|
---|
6924 | return error;
|
---|
6925 | }
|
---|
6926 | std::copy(pointer, pointer + length, startIterator);
|
---|
6927 | Event endEvent;
|
---|
6928 | error = queue.enqueueUnmapMemObject(buffer, pointer, 0, &endEvent);
|
---|
6929 | // if exceptions enabled, enqueueUnmapMemObject will throw
|
---|
6930 | if( error != CL_SUCCESS ) {
|
---|
6931 | return error;
|
---|
6932 | }
|
---|
6933 | endEvent.wait();
|
---|
6934 | return CL_SUCCESS;
|
---|
6935 | }
|
---|
6936 |
|
---|
6937 | #if defined(CL_VERSION_1_1)
|
---|
6938 | inline cl_int enqueueReadBufferRect(
|
---|
6939 | const Buffer& buffer,
|
---|
6940 | cl_bool blocking,
|
---|
6941 | const size_t<3>& buffer_offset,
|
---|
6942 | const size_t<3>& host_offset,
|
---|
6943 | const size_t<3>& region,
|
---|
6944 | ::size_t buffer_row_pitch,
|
---|
6945 | ::size_t buffer_slice_pitch,
|
---|
6946 | ::size_t host_row_pitch,
|
---|
6947 | ::size_t host_slice_pitch,
|
---|
6948 | void *ptr,
|
---|
6949 | const VECTOR_CLASS<Event>* events = NULL,
|
---|
6950 | Event* event = NULL)
|
---|
6951 | {
|
---|
6952 | cl_int error;
|
---|
6953 | CommandQueue queue = CommandQueue::getDefault(&error);
|
---|
6954 |
|
---|
6955 | if (error != CL_SUCCESS) {
|
---|
6956 | return error;
|
---|
6957 | }
|
---|
6958 |
|
---|
6959 | return queue.enqueueReadBufferRect(
|
---|
6960 | buffer,
|
---|
6961 | blocking,
|
---|
6962 | buffer_offset,
|
---|
6963 | host_offset,
|
---|
6964 | region,
|
---|
6965 | buffer_row_pitch,
|
---|
6966 | buffer_slice_pitch,
|
---|
6967 | host_row_pitch,
|
---|
6968 | host_slice_pitch,
|
---|
6969 | ptr,
|
---|
6970 | events,
|
---|
6971 | event);
|
---|
6972 | }
|
---|
6973 |
|
---|
6974 | inline cl_int enqueueWriteBufferRect(
|
---|
6975 | const Buffer& buffer,
|
---|
6976 | cl_bool blocking,
|
---|
6977 | const size_t<3>& buffer_offset,
|
---|
6978 | const size_t<3>& host_offset,
|
---|
6979 | const size_t<3>& region,
|
---|
6980 | ::size_t buffer_row_pitch,
|
---|
6981 | ::size_t buffer_slice_pitch,
|
---|
6982 | ::size_t host_row_pitch,
|
---|
6983 | ::size_t host_slice_pitch,
|
---|
6984 | const void *ptr,
|
---|
6985 | const VECTOR_CLASS<Event>* events = NULL,
|
---|
6986 | Event* event = NULL)
|
---|
6987 | {
|
---|
6988 | cl_int error;
|
---|
6989 | CommandQueue queue = CommandQueue::getDefault(&error);
|
---|
6990 |
|
---|
6991 | if (error != CL_SUCCESS) {
|
---|
6992 | return error;
|
---|
6993 | }
|
---|
6994 |
|
---|
6995 | return queue.enqueueWriteBufferRect(
|
---|
6996 | buffer,
|
---|
6997 | blocking,
|
---|
6998 | buffer_offset,
|
---|
6999 | host_offset,
|
---|
7000 | region,
|
---|
7001 | buffer_row_pitch,
|
---|
7002 | buffer_slice_pitch,
|
---|
7003 | host_row_pitch,
|
---|
7004 | host_slice_pitch,
|
---|
7005 | ptr,
|
---|
7006 | events,
|
---|
7007 | event);
|
---|
7008 | }
|
---|
7009 |
|
---|
7010 | inline cl_int enqueueCopyBufferRect(
|
---|
7011 | const Buffer& src,
|
---|
7012 | const Buffer& dst,
|
---|
7013 | const size_t<3>& src_origin,
|
---|
7014 | const size_t<3>& dst_origin,
|
---|
7015 | const size_t<3>& region,
|
---|
7016 | ::size_t src_row_pitch,
|
---|
7017 | ::size_t src_slice_pitch,
|
---|
7018 | ::size_t dst_row_pitch,
|
---|
7019 | ::size_t dst_slice_pitch,
|
---|
7020 | const VECTOR_CLASS<Event>* events = NULL,
|
---|
7021 | Event* event = NULL)
|
---|
7022 | {
|
---|
7023 | cl_int error;
|
---|
7024 | CommandQueue queue = CommandQueue::getDefault(&error);
|
---|
7025 |
|
---|
7026 | if (error != CL_SUCCESS) {
|
---|
7027 | return error;
|
---|
7028 | }
|
---|
7029 |
|
---|
7030 | return queue.enqueueCopyBufferRect(
|
---|
7031 | src,
|
---|
7032 | dst,
|
---|
7033 | src_origin,
|
---|
7034 | dst_origin,
|
---|
7035 | region,
|
---|
7036 | src_row_pitch,
|
---|
7037 | src_slice_pitch,
|
---|
7038 | dst_row_pitch,
|
---|
7039 | dst_slice_pitch,
|
---|
7040 | events,
|
---|
7041 | event);
|
---|
7042 | }
|
---|
7043 | #endif
|
---|
7044 |
|
---|
7045 | inline cl_int enqueueReadImage(
|
---|
7046 | const Image& image,
|
---|
7047 | cl_bool blocking,
|
---|
7048 | const size_t<3>& origin,
|
---|
7049 | const size_t<3>& region,
|
---|
7050 | ::size_t row_pitch,
|
---|
7051 | ::size_t slice_pitch,
|
---|
7052 | void* ptr,
|
---|
7053 | const VECTOR_CLASS<Event>* events = NULL,
|
---|
7054 | Event* event = NULL)
|
---|
7055 | {
|
---|
7056 | cl_int error;
|
---|
7057 | CommandQueue queue = CommandQueue::getDefault(&error);
|
---|
7058 |
|
---|
7059 | if (error != CL_SUCCESS) {
|
---|
7060 | return error;
|
---|
7061 | }
|
---|
7062 |
|
---|
7063 | return queue.enqueueReadImage(
|
---|
7064 | image,
|
---|
7065 | blocking,
|
---|
7066 | origin,
|
---|
7067 | region,
|
---|
7068 | row_pitch,
|
---|
7069 | slice_pitch,
|
---|
7070 | ptr,
|
---|
7071 | events,
|
---|
7072 | event);
|
---|
7073 | }
|
---|
7074 |
|
---|
7075 | inline cl_int enqueueWriteImage(
|
---|
7076 | const Image& image,
|
---|
7077 | cl_bool blocking,
|
---|
7078 | const size_t<3>& origin,
|
---|
7079 | const size_t<3>& region,
|
---|
7080 | ::size_t row_pitch,
|
---|
7081 | ::size_t slice_pitch,
|
---|
7082 | const void* ptr,
|
---|
7083 | const VECTOR_CLASS<Event>* events = NULL,
|
---|
7084 | Event* event = NULL)
|
---|
7085 | {
|
---|
7086 | cl_int error;
|
---|
7087 | CommandQueue queue = CommandQueue::getDefault(&error);
|
---|
7088 |
|
---|
7089 | if (error != CL_SUCCESS) {
|
---|
7090 | return error;
|
---|
7091 | }
|
---|
7092 |
|
---|
7093 | return queue.enqueueWriteImage(
|
---|
7094 | image,
|
---|
7095 | blocking,
|
---|
7096 | origin,
|
---|
7097 | region,
|
---|
7098 | row_pitch,
|
---|
7099 | slice_pitch,
|
---|
7100 | ptr,
|
---|
7101 | events,
|
---|
7102 | event);
|
---|
7103 | }
|
---|
7104 |
|
---|
7105 | inline cl_int enqueueCopyImage(
|
---|
7106 | const Image& src,
|
---|
7107 | const Image& dst,
|
---|
7108 | const size_t<3>& src_origin,
|
---|
7109 | const size_t<3>& dst_origin,
|
---|
7110 | const size_t<3>& region,
|
---|
7111 | const VECTOR_CLASS<Event>* events = NULL,
|
---|
7112 | Event* event = NULL)
|
---|
7113 | {
|
---|
7114 | cl_int error;
|
---|
7115 | CommandQueue queue = CommandQueue::getDefault(&error);
|
---|
7116 |
|
---|
7117 | if (error != CL_SUCCESS) {
|
---|
7118 | return error;
|
---|
7119 | }
|
---|
7120 |
|
---|
7121 | return queue.enqueueCopyImage(
|
---|
7122 | src,
|
---|
7123 | dst,
|
---|
7124 | src_origin,
|
---|
7125 | dst_origin,
|
---|
7126 | region,
|
---|
7127 | events,
|
---|
7128 | event);
|
---|
7129 | }
|
---|
7130 |
|
---|
7131 | inline cl_int enqueueCopyImageToBuffer(
|
---|
7132 | const Image& src,
|
---|
7133 | const Buffer& dst,
|
---|
7134 | const size_t<3>& src_origin,
|
---|
7135 | const size_t<3>& region,
|
---|
7136 | ::size_t dst_offset,
|
---|
7137 | const VECTOR_CLASS<Event>* events = NULL,
|
---|
7138 | Event* event = NULL)
|
---|
7139 | {
|
---|
7140 | cl_int error;
|
---|
7141 | CommandQueue queue = CommandQueue::getDefault(&error);
|
---|
7142 |
|
---|
7143 | if (error != CL_SUCCESS) {
|
---|
7144 | return error;
|
---|
7145 | }
|
---|
7146 |
|
---|
7147 | return queue.enqueueCopyImageToBuffer(
|
---|
7148 | src,
|
---|
7149 | dst,
|
---|
7150 | src_origin,
|
---|
7151 | region,
|
---|
7152 | dst_offset,
|
---|
7153 | events,
|
---|
7154 | event);
|
---|
7155 | }
|
---|
7156 |
|
---|
7157 | inline cl_int enqueueCopyBufferToImage(
|
---|
7158 | const Buffer& src,
|
---|
7159 | const Image& dst,
|
---|
7160 | ::size_t src_offset,
|
---|
7161 | const size_t<3>& dst_origin,
|
---|
7162 | const size_t<3>& region,
|
---|
7163 | const VECTOR_CLASS<Event>* events = NULL,
|
---|
7164 | Event* event = NULL)
|
---|
7165 | {
|
---|
7166 | cl_int error;
|
---|
7167 | CommandQueue queue = CommandQueue::getDefault(&error);
|
---|
7168 |
|
---|
7169 | if (error != CL_SUCCESS) {
|
---|
7170 | return error;
|
---|
7171 | }
|
---|
7172 |
|
---|
7173 | return queue.enqueueCopyBufferToImage(
|
---|
7174 | src,
|
---|
7175 | dst,
|
---|
7176 | src_offset,
|
---|
7177 | dst_origin,
|
---|
7178 | region,
|
---|
7179 | events,
|
---|
7180 | event);
|
---|
7181 | }
|
---|
7182 |
|
---|
7183 |
|
---|
7184 | inline cl_int flush(void)
|
---|
7185 | {
|
---|
7186 | cl_int error;
|
---|
7187 | CommandQueue queue = CommandQueue::getDefault(&error);
|
---|
7188 |
|
---|
7189 | if (error != CL_SUCCESS) {
|
---|
7190 | return error;
|
---|
7191 | }
|
---|
7192 |
|
---|
7193 | return queue.flush();
|
---|
7194 | }
|
---|
7195 |
|
---|
7196 | inline cl_int finish(void)
|
---|
7197 | {
|
---|
7198 | cl_int error;
|
---|
7199 | CommandQueue queue = CommandQueue::getDefault(&error);
|
---|
7200 |
|
---|
7201 | if (error != CL_SUCCESS) {
|
---|
7202 | return error;
|
---|
7203 | }
|
---|
7204 |
|
---|
7205 |
|
---|
7206 | return queue.finish();
|
---|
7207 | }
|
---|
7208 |
|
---|
7209 | // Kernel Functor support
|
---|
7210 | // New interface as of September 2011
|
---|
7211 | // Requires the C++11 std::tr1::function (note do not support TR1)
|
---|
7212 | // Visual Studio 2010 and GCC 4.2
|
---|
7213 |
|
---|
7214 | struct EnqueueArgs
|
---|
7215 | {
|
---|
7216 | CommandQueue queue_;
|
---|
7217 | const NDRange offset_;
|
---|
7218 | const NDRange global_;
|
---|
7219 | const NDRange local_;
|
---|
7220 | VECTOR_CLASS<Event> events_;
|
---|
7221 |
|
---|
7222 | EnqueueArgs(NDRange global) :
|
---|
7223 | queue_(CommandQueue::getDefault()),
|
---|
7224 | offset_(NullRange),
|
---|
7225 | global_(global),
|
---|
7226 | local_(NullRange)
|
---|
7227 | {
|
---|
7228 |
|
---|
7229 | }
|
---|
7230 |
|
---|
7231 | EnqueueArgs(NDRange global, NDRange local) :
|
---|
7232 | queue_(CommandQueue::getDefault()),
|
---|
7233 | offset_(NullRange),
|
---|
7234 | global_(global),
|
---|
7235 | local_(local)
|
---|
7236 | {
|
---|
7237 |
|
---|
7238 | }
|
---|
7239 |
|
---|
7240 | EnqueueArgs(NDRange offset, NDRange global, NDRange local) :
|
---|
7241 | queue_(CommandQueue::getDefault()),
|
---|
7242 | offset_(offset),
|
---|
7243 | global_(global),
|
---|
7244 | local_(local)
|
---|
7245 | {
|
---|
7246 |
|
---|
7247 | }
|
---|
7248 |
|
---|
7249 | EnqueueArgs(Event e, NDRange global) :
|
---|
7250 | queue_(CommandQueue::getDefault()),
|
---|
7251 | offset_(NullRange),
|
---|
7252 | global_(global),
|
---|
7253 | local_(NullRange)
|
---|
7254 | {
|
---|
7255 | events_.push_back(e);
|
---|
7256 | }
|
---|
7257 |
|
---|
7258 | EnqueueArgs(Event e, NDRange global, NDRange local) :
|
---|
7259 | queue_(CommandQueue::getDefault()),
|
---|
7260 | offset_(NullRange),
|
---|
7261 | global_(global),
|
---|
7262 | local_(local)
|
---|
7263 | {
|
---|
7264 | events_.push_back(e);
|
---|
7265 | }
|
---|
7266 |
|
---|
7267 | EnqueueArgs(Event e, NDRange offset, NDRange global, NDRange local) :
|
---|
7268 | queue_(CommandQueue::getDefault()),
|
---|
7269 | offset_(offset),
|
---|
7270 | global_(global),
|
---|
7271 | local_(local)
|
---|
7272 | {
|
---|
7273 | events_.push_back(e);
|
---|
7274 | }
|
---|
7275 |
|
---|
7276 | EnqueueArgs(const VECTOR_CLASS<Event> &events, NDRange global) :
|
---|
7277 | queue_(CommandQueue::getDefault()),
|
---|
7278 | offset_(NullRange),
|
---|
7279 | global_(global),
|
---|
7280 | local_(NullRange),
|
---|
7281 | events_(events)
|
---|
7282 | {
|
---|
7283 |
|
---|
7284 | }
|
---|
7285 |
|
---|
7286 | EnqueueArgs(const VECTOR_CLASS<Event> &events, NDRange global, NDRange local) :
|
---|
7287 | queue_(CommandQueue::getDefault()),
|
---|
7288 | offset_(NullRange),
|
---|
7289 | global_(global),
|
---|
7290 | local_(local),
|
---|
7291 | events_(events)
|
---|
7292 | {
|
---|
7293 |
|
---|
7294 | }
|
---|
7295 |
|
---|
7296 | EnqueueArgs(const VECTOR_CLASS<Event> &events, NDRange offset, NDRange global, NDRange local) :
|
---|
7297 | queue_(CommandQueue::getDefault()),
|
---|
7298 | offset_(offset),
|
---|
7299 | global_(global),
|
---|
7300 | local_(local),
|
---|
7301 | events_(events)
|
---|
7302 | {
|
---|
7303 |
|
---|
7304 | }
|
---|
7305 |
|
---|
7306 | EnqueueArgs(CommandQueue &queue, NDRange global) :
|
---|
7307 | queue_(queue),
|
---|
7308 | offset_(NullRange),
|
---|
7309 | global_(global),
|
---|
7310 | local_(NullRange)
|
---|
7311 | {
|
---|
7312 |
|
---|
7313 | }
|
---|
7314 |
|
---|
7315 | EnqueueArgs(CommandQueue &queue, NDRange global, NDRange local) :
|
---|
7316 | queue_(queue),
|
---|
7317 | offset_(NullRange),
|
---|
7318 | global_(global),
|
---|
7319 | local_(local)
|
---|
7320 | {
|
---|
7321 |
|
---|
7322 | }
|
---|
7323 |
|
---|
7324 | EnqueueArgs(CommandQueue &queue, NDRange offset, NDRange global, NDRange local) :
|
---|
7325 | queue_(queue),
|
---|
7326 | offset_(offset),
|
---|
7327 | global_(global),
|
---|
7328 | local_(local)
|
---|
7329 | {
|
---|
7330 |
|
---|
7331 | }
|
---|
7332 |
|
---|
7333 | EnqueueArgs(CommandQueue &queue, Event e, NDRange global) :
|
---|
7334 | queue_(queue),
|
---|
7335 | offset_(NullRange),
|
---|
7336 | global_(global),
|
---|
7337 | local_(NullRange)
|
---|
7338 | {
|
---|
7339 | events_.push_back(e);
|
---|
7340 | }
|
---|
7341 |
|
---|
7342 | EnqueueArgs(CommandQueue &queue, Event e, NDRange global, NDRange local) :
|
---|
7343 | queue_(queue),
|
---|
7344 | offset_(NullRange),
|
---|
7345 | global_(global),
|
---|
7346 | local_(local)
|
---|
7347 | {
|
---|
7348 | events_.push_back(e);
|
---|
7349 | }
|
---|
7350 |
|
---|
7351 | EnqueueArgs(CommandQueue &queue, Event e, NDRange offset, NDRange global, NDRange local) :
|
---|
7352 | queue_(queue),
|
---|
7353 | offset_(offset),
|
---|
7354 | global_(global),
|
---|
7355 | local_(local)
|
---|
7356 | {
|
---|
7357 | events_.push_back(e);
|
---|
7358 | }
|
---|
7359 |
|
---|
7360 | EnqueueArgs(CommandQueue &queue, const VECTOR_CLASS<Event> &events, NDRange global) :
|
---|
7361 | queue_(queue),
|
---|
7362 | offset_(NullRange),
|
---|
7363 | global_(global),
|
---|
7364 | local_(NullRange),
|
---|
7365 | events_(events)
|
---|
7366 | {
|
---|
7367 |
|
---|
7368 | }
|
---|
7369 |
|
---|
7370 | EnqueueArgs(CommandQueue &queue, const VECTOR_CLASS<Event> &events, NDRange global, NDRange local) :
|
---|
7371 | queue_(queue),
|
---|
7372 | offset_(NullRange),
|
---|
7373 | global_(global),
|
---|
7374 | local_(local),
|
---|
7375 | events_(events)
|
---|
7376 | {
|
---|
7377 |
|
---|
7378 | }
|
---|
7379 |
|
---|
7380 | EnqueueArgs(CommandQueue &queue, const VECTOR_CLASS<Event> &events, NDRange offset, NDRange global, NDRange local) :
|
---|
7381 | queue_(queue),
|
---|
7382 | offset_(offset),
|
---|
7383 | global_(global),
|
---|
7384 | local_(local),
|
---|
7385 | events_(events)
|
---|
7386 | {
|
---|
7387 |
|
---|
7388 | }
|
---|
7389 | };
|
---|
7390 |
|
---|
7391 | namespace detail {
|
---|
7392 |
|
---|
7393 | class NullType {};
|
---|
7394 |
|
---|
7395 | template<int index, typename T0>
|
---|
7396 | struct SetArg
|
---|
7397 | {
|
---|
7398 | static void set (Kernel kernel, T0 arg)
|
---|
7399 | {
|
---|
7400 | kernel.setArg(index, arg);
|
---|
7401 | }
|
---|
7402 | };
|
---|
7403 |
|
---|
7404 | template<int index>
|
---|
7405 | struct SetArg<index, NullType>
|
---|
7406 | {
|
---|
7407 | static void set (Kernel, NullType)
|
---|
7408 | {
|
---|
7409 | }
|
---|
7410 | };
|
---|
7411 |
|
---|
7412 | template <
|
---|
7413 | typename T0, typename T1, typename T2, typename T3,
|
---|
7414 | typename T4, typename T5, typename T6, typename T7,
|
---|
7415 | typename T8, typename T9, typename T10, typename T11,
|
---|
7416 | typename T12, typename T13, typename T14, typename T15,
|
---|
7417 | typename T16, typename T17, typename T18, typename T19,
|
---|
7418 | typename T20, typename T21, typename T22, typename T23,
|
---|
7419 | typename T24, typename T25, typename T26, typename T27,
|
---|
7420 | typename T28, typename T29, typename T30, typename T31
|
---|
7421 | >
|
---|
7422 | class KernelFunctorGlobal
|
---|
7423 | {
|
---|
7424 | private:
|
---|
7425 | Kernel kernel_;
|
---|
7426 |
|
---|
7427 | public:
|
---|
7428 | KernelFunctorGlobal(
|
---|
7429 | Kernel kernel) :
|
---|
7430 | kernel_(kernel)
|
---|
7431 | {}
|
---|
7432 |
|
---|
7433 | KernelFunctorGlobal(
|
---|
7434 | const Program& program,
|
---|
7435 | const STRING_CLASS name,
|
---|
7436 | cl_int * err = NULL) :
|
---|
7437 | kernel_(program, name.c_str(), err)
|
---|
7438 | {}
|
---|
7439 |
|
---|
7440 | Event operator() (
|
---|
7441 | const EnqueueArgs& args,
|
---|
7442 | T0 t0,
|
---|
7443 | T1 t1 = NullType(),
|
---|
7444 | T2 t2 = NullType(),
|
---|
7445 | T3 t3 = NullType(),
|
---|
7446 | T4 t4 = NullType(),
|
---|
7447 | T5 t5 = NullType(),
|
---|
7448 | T6 t6 = NullType(),
|
---|
7449 | T7 t7 = NullType(),
|
---|
7450 | T8 t8 = NullType(),
|
---|
7451 | T9 t9 = NullType(),
|
---|
7452 | T10 t10 = NullType(),
|
---|
7453 | T11 t11 = NullType(),
|
---|
7454 | T12 t12 = NullType(),
|
---|
7455 | T13 t13 = NullType(),
|
---|
7456 | T14 t14 = NullType(),
|
---|
7457 | T15 t15 = NullType(),
|
---|
7458 | T16 t16 = NullType(),
|
---|
7459 | T17 t17 = NullType(),
|
---|
7460 | T18 t18 = NullType(),
|
---|
7461 | T19 t19 = NullType(),
|
---|
7462 | T20 t20 = NullType(),
|
---|
7463 | T21 t21 = NullType(),
|
---|
7464 | T22 t22 = NullType(),
|
---|
7465 | T23 t23 = NullType(),
|
---|
7466 | T24 t24 = NullType(),
|
---|
7467 | T25 t25 = NullType(),
|
---|
7468 | T26 t26 = NullType(),
|
---|
7469 | T27 t27 = NullType(),
|
---|
7470 | T28 t28 = NullType(),
|
---|
7471 | T29 t29 = NullType(),
|
---|
7472 | T30 t30 = NullType(),
|
---|
7473 | T31 t31 = NullType()
|
---|
7474 | )
|
---|
7475 | {
|
---|
7476 | Event event;
|
---|
7477 | SetArg<0, T0>::set(kernel_, t0);
|
---|
7478 | SetArg<1, T1>::set(kernel_, t1);
|
---|
7479 | SetArg<2, T2>::set(kernel_, t2);
|
---|
7480 | SetArg<3, T3>::set(kernel_, t3);
|
---|
7481 | SetArg<4, T4>::set(kernel_, t4);
|
---|
7482 | SetArg<5, T5>::set(kernel_, t5);
|
---|
7483 | SetArg<6, T6>::set(kernel_, t6);
|
---|
7484 | SetArg<7, T7>::set(kernel_, t7);
|
---|
7485 | SetArg<8, T8>::set(kernel_, t8);
|
---|
7486 | SetArg<9, T9>::set(kernel_, t9);
|
---|
7487 | SetArg<10, T10>::set(kernel_, t10);
|
---|
7488 | SetArg<11, T11>::set(kernel_, t11);
|
---|
7489 | SetArg<12, T12>::set(kernel_, t12);
|
---|
7490 | SetArg<13, T13>::set(kernel_, t13);
|
---|
7491 | SetArg<14, T14>::set(kernel_, t14);
|
---|
7492 | SetArg<15, T15>::set(kernel_, t15);
|
---|
7493 | SetArg<16, T16>::set(kernel_, t16);
|
---|
7494 | SetArg<17, T17>::set(kernel_, t17);
|
---|
7495 | SetArg<18, T18>::set(kernel_, t18);
|
---|
7496 | SetArg<19, T19>::set(kernel_, t19);
|
---|
7497 | SetArg<20, T20>::set(kernel_, t20);
|
---|
7498 | SetArg<21, T21>::set(kernel_, t21);
|
---|
7499 | SetArg<22, T22>::set(kernel_, t22);
|
---|
7500 | SetArg<23, T23>::set(kernel_, t23);
|
---|
7501 | SetArg<24, T24>::set(kernel_, t24);
|
---|
7502 | SetArg<25, T25>::set(kernel_, t25);
|
---|
7503 | SetArg<26, T26>::set(kernel_, t26);
|
---|
7504 | SetArg<27, T27>::set(kernel_, t27);
|
---|
7505 | SetArg<28, T28>::set(kernel_, t28);
|
---|
7506 | SetArg<29, T29>::set(kernel_, t29);
|
---|
7507 | SetArg<30, T30>::set(kernel_, t30);
|
---|
7508 | SetArg<31, T31>::set(kernel_, t31);
|
---|
7509 |
|
---|
7510 | args.queue_.enqueueNDRangeKernel(
|
---|
7511 | kernel_,
|
---|
7512 | args.offset_,
|
---|
7513 | args.global_,
|
---|
7514 | args.local_,
|
---|
7515 | &args.events_,
|
---|
7516 | &event);
|
---|
7517 |
|
---|
7518 | return event;
|
---|
7519 | }
|
---|
7520 |
|
---|
7521 | };
|
---|
7522 |
|
---|
7523 | //------------------------------------------------------------------------------------------------------
|
---|
7524 |
|
---|
7525 |
|
---|
7526 | template<
|
---|
7527 | typename T0,
|
---|
7528 | typename T1,
|
---|
7529 | typename T2,
|
---|
7530 | typename T3,
|
---|
7531 | typename T4,
|
---|
7532 | typename T5,
|
---|
7533 | typename T6,
|
---|
7534 | typename T7,
|
---|
7535 | typename T8,
|
---|
7536 | typename T9,
|
---|
7537 | typename T10,
|
---|
7538 | typename T11,
|
---|
7539 | typename T12,
|
---|
7540 | typename T13,
|
---|
7541 | typename T14,
|
---|
7542 | typename T15,
|
---|
7543 | typename T16,
|
---|
7544 | typename T17,
|
---|
7545 | typename T18,
|
---|
7546 | typename T19,
|
---|
7547 | typename T20,
|
---|
7548 | typename T21,
|
---|
7549 | typename T22,
|
---|
7550 | typename T23,
|
---|
7551 | typename T24,
|
---|
7552 | typename T25,
|
---|
7553 | typename T26,
|
---|
7554 | typename T27,
|
---|
7555 | typename T28,
|
---|
7556 | typename T29,
|
---|
7557 | typename T30,
|
---|
7558 | typename T31>
|
---|
7559 | struct functionImplementation_
|
---|
7560 | {
|
---|
7561 | typedef detail::KernelFunctorGlobal<
|
---|
7562 | T0,
|
---|
7563 | T1,
|
---|
7564 | T2,
|
---|
7565 | T3,
|
---|
7566 | T4,
|
---|
7567 | T5,
|
---|
7568 | T6,
|
---|
7569 | T7,
|
---|
7570 | T8,
|
---|
7571 | T9,
|
---|
7572 | T10,
|
---|
7573 | T11,
|
---|
7574 | T12,
|
---|
7575 | T13,
|
---|
7576 | T14,
|
---|
7577 | T15,
|
---|
7578 | T16,
|
---|
7579 | T17,
|
---|
7580 | T18,
|
---|
7581 | T19,
|
---|
7582 | T20,
|
---|
7583 | T21,
|
---|
7584 | T22,
|
---|
7585 | T23,
|
---|
7586 | T24,
|
---|
7587 | T25,
|
---|
7588 | T26,
|
---|
7589 | T27,
|
---|
7590 | T28,
|
---|
7591 | T29,
|
---|
7592 | T30,
|
---|
7593 | T31> FunctorType;
|
---|
7594 |
|
---|
7595 | FunctorType functor_;
|
---|
7596 |
|
---|
7597 | functionImplementation_(const FunctorType &functor) :
|
---|
7598 | functor_(functor)
|
---|
7599 | {
|
---|
7600 |
|
---|
7601 | #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 32))
|
---|
7602 | // Fail variadic expansion for dev11
|
---|
7603 | static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
|
---|
7604 | #endif
|
---|
7605 |
|
---|
7606 | }
|
---|
7607 |
|
---|
7608 | //! \brief Return type of the functor
|
---|
7609 | typedef Event result_type;
|
---|
7610 |
|
---|
7611 | //! \brief Function signature of kernel functor with no event dependency.
|
---|
7612 | typedef Event type_(
|
---|
7613 | const EnqueueArgs&,
|
---|
7614 | T0,
|
---|
7615 | T1,
|
---|
7616 | T2,
|
---|
7617 | T3,
|
---|
7618 | T4,
|
---|
7619 | T5,
|
---|
7620 | T6,
|
---|
7621 | T7,
|
---|
7622 | T8,
|
---|
7623 | T9,
|
---|
7624 | T10,
|
---|
7625 | T11,
|
---|
7626 | T12,
|
---|
7627 | T13,
|
---|
7628 | T14,
|
---|
7629 | T15,
|
---|
7630 | T16,
|
---|
7631 | T17,
|
---|
7632 | T18,
|
---|
7633 | T19,
|
---|
7634 | T20,
|
---|
7635 | T21,
|
---|
7636 | T22,
|
---|
7637 | T23,
|
---|
7638 | T24,
|
---|
7639 | T25,
|
---|
7640 | T26,
|
---|
7641 | T27,
|
---|
7642 | T28,
|
---|
7643 | T29,
|
---|
7644 | T30,
|
---|
7645 | T31);
|
---|
7646 |
|
---|
7647 | Event operator()(
|
---|
7648 | const EnqueueArgs& enqueueArgs,
|
---|
7649 | T0 arg0,
|
---|
7650 | T1 arg1,
|
---|
7651 | T2 arg2,
|
---|
7652 | T3 arg3,
|
---|
7653 | T4 arg4,
|
---|
7654 | T5 arg5,
|
---|
7655 | T6 arg6,
|
---|
7656 | T7 arg7,
|
---|
7657 | T8 arg8,
|
---|
7658 | T9 arg9,
|
---|
7659 | T10 arg10,
|
---|
7660 | T11 arg11,
|
---|
7661 | T12 arg12,
|
---|
7662 | T13 arg13,
|
---|
7663 | T14 arg14,
|
---|
7664 | T15 arg15,
|
---|
7665 | T16 arg16,
|
---|
7666 | T17 arg17,
|
---|
7667 | T18 arg18,
|
---|
7668 | T19 arg19,
|
---|
7669 | T20 arg20,
|
---|
7670 | T21 arg21,
|
---|
7671 | T22 arg22,
|
---|
7672 | T23 arg23,
|
---|
7673 | T24 arg24,
|
---|
7674 | T25 arg25,
|
---|
7675 | T26 arg26,
|
---|
7676 | T27 arg27,
|
---|
7677 | T28 arg28,
|
---|
7678 | T29 arg29,
|
---|
7679 | T30 arg30,
|
---|
7680 | T31 arg31)
|
---|
7681 | {
|
---|
7682 | return functor_(
|
---|
7683 | enqueueArgs,
|
---|
7684 | arg0,
|
---|
7685 | arg1,
|
---|
7686 | arg2,
|
---|
7687 | arg3,
|
---|
7688 | arg4,
|
---|
7689 | arg5,
|
---|
7690 | arg6,
|
---|
7691 | arg7,
|
---|
7692 | arg8,
|
---|
7693 | arg9,
|
---|
7694 | arg10,
|
---|
7695 | arg11,
|
---|
7696 | arg12,
|
---|
7697 | arg13,
|
---|
7698 | arg14,
|
---|
7699 | arg15,
|
---|
7700 | arg16,
|
---|
7701 | arg17,
|
---|
7702 | arg18,
|
---|
7703 | arg19,
|
---|
7704 | arg20,
|
---|
7705 | arg21,
|
---|
7706 | arg22,
|
---|
7707 | arg23,
|
---|
7708 | arg24,
|
---|
7709 | arg25,
|
---|
7710 | arg26,
|
---|
7711 | arg27,
|
---|
7712 | arg28,
|
---|
7713 | arg29,
|
---|
7714 | arg30,
|
---|
7715 | arg31);
|
---|
7716 | }
|
---|
7717 |
|
---|
7718 |
|
---|
7719 | };
|
---|
7720 |
|
---|
7721 | template<
|
---|
7722 | typename T0,
|
---|
7723 | typename T1,
|
---|
7724 | typename T2,
|
---|
7725 | typename T3,
|
---|
7726 | typename T4,
|
---|
7727 | typename T5,
|
---|
7728 | typename T6,
|
---|
7729 | typename T7,
|
---|
7730 | typename T8,
|
---|
7731 | typename T9,
|
---|
7732 | typename T10,
|
---|
7733 | typename T11,
|
---|
7734 | typename T12,
|
---|
7735 | typename T13,
|
---|
7736 | typename T14,
|
---|
7737 | typename T15,
|
---|
7738 | typename T16,
|
---|
7739 | typename T17,
|
---|
7740 | typename T18,
|
---|
7741 | typename T19,
|
---|
7742 | typename T20,
|
---|
7743 | typename T21,
|
---|
7744 | typename T22,
|
---|
7745 | typename T23,
|
---|
7746 | typename T24,
|
---|
7747 | typename T25,
|
---|
7748 | typename T26,
|
---|
7749 | typename T27,
|
---|
7750 | typename T28,
|
---|
7751 | typename T29,
|
---|
7752 | typename T30>
|
---|
7753 | struct functionImplementation_
|
---|
7754 | < T0,
|
---|
7755 | T1,
|
---|
7756 | T2,
|
---|
7757 | T3,
|
---|
7758 | T4,
|
---|
7759 | T5,
|
---|
7760 | T6,
|
---|
7761 | T7,
|
---|
7762 | T8,
|
---|
7763 | T9,
|
---|
7764 | T10,
|
---|
7765 | T11,
|
---|
7766 | T12,
|
---|
7767 | T13,
|
---|
7768 | T14,
|
---|
7769 | T15,
|
---|
7770 | T16,
|
---|
7771 | T17,
|
---|
7772 | T18,
|
---|
7773 | T19,
|
---|
7774 | T20,
|
---|
7775 | T21,
|
---|
7776 | T22,
|
---|
7777 | T23,
|
---|
7778 | T24,
|
---|
7779 | T25,
|
---|
7780 | T26,
|
---|
7781 | T27,
|
---|
7782 | T28,
|
---|
7783 | T29,
|
---|
7784 | T30,
|
---|
7785 | NullType>
|
---|
7786 | {
|
---|
7787 | typedef detail::KernelFunctorGlobal<
|
---|
7788 | T0,
|
---|
7789 | T1,
|
---|
7790 | T2,
|
---|
7791 | T3,
|
---|
7792 | T4,
|
---|
7793 | T5,
|
---|
7794 | T6,
|
---|
7795 | T7,
|
---|
7796 | T8,
|
---|
7797 | T9,
|
---|
7798 | T10,
|
---|
7799 | T11,
|
---|
7800 | T12,
|
---|
7801 | T13,
|
---|
7802 | T14,
|
---|
7803 | T15,
|
---|
7804 | T16,
|
---|
7805 | T17,
|
---|
7806 | T18,
|
---|
7807 | T19,
|
---|
7808 | T20,
|
---|
7809 | T21,
|
---|
7810 | T22,
|
---|
7811 | T23,
|
---|
7812 | T24,
|
---|
7813 | T25,
|
---|
7814 | T26,
|
---|
7815 | T27,
|
---|
7816 | T28,
|
---|
7817 | T29,
|
---|
7818 | T30,
|
---|
7819 | NullType> FunctorType;
|
---|
7820 |
|
---|
7821 | FunctorType functor_;
|
---|
7822 |
|
---|
7823 | functionImplementation_(const FunctorType &functor) :
|
---|
7824 | functor_(functor)
|
---|
7825 | {
|
---|
7826 |
|
---|
7827 | #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 31))
|
---|
7828 | // Fail variadic expansion for dev11
|
---|
7829 | static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
|
---|
7830 | #endif
|
---|
7831 |
|
---|
7832 | }
|
---|
7833 |
|
---|
7834 | //! \brief Return type of the functor
|
---|
7835 | typedef Event result_type;
|
---|
7836 |
|
---|
7837 | //! \brief Function signature of kernel functor with no event dependency.
|
---|
7838 | typedef Event type_(
|
---|
7839 | const EnqueueArgs&,
|
---|
7840 | T0,
|
---|
7841 | T1,
|
---|
7842 | T2,
|
---|
7843 | T3,
|
---|
7844 | T4,
|
---|
7845 | T5,
|
---|
7846 | T6,
|
---|
7847 | T7,
|
---|
7848 | T8,
|
---|
7849 | T9,
|
---|
7850 | T10,
|
---|
7851 | T11,
|
---|
7852 | T12,
|
---|
7853 | T13,
|
---|
7854 | T14,
|
---|
7855 | T15,
|
---|
7856 | T16,
|
---|
7857 | T17,
|
---|
7858 | T18,
|
---|
7859 | T19,
|
---|
7860 | T20,
|
---|
7861 | T21,
|
---|
7862 | T22,
|
---|
7863 | T23,
|
---|
7864 | T24,
|
---|
7865 | T25,
|
---|
7866 | T26,
|
---|
7867 | T27,
|
---|
7868 | T28,
|
---|
7869 | T29,
|
---|
7870 | T30);
|
---|
7871 |
|
---|
7872 | Event operator()(
|
---|
7873 | const EnqueueArgs& enqueueArgs,
|
---|
7874 | T0 arg0,
|
---|
7875 | T1 arg1,
|
---|
7876 | T2 arg2,
|
---|
7877 | T3 arg3,
|
---|
7878 | T4 arg4,
|
---|
7879 | T5 arg5,
|
---|
7880 | T6 arg6,
|
---|
7881 | T7 arg7,
|
---|
7882 | T8 arg8,
|
---|
7883 | T9 arg9,
|
---|
7884 | T10 arg10,
|
---|
7885 | T11 arg11,
|
---|
7886 | T12 arg12,
|
---|
7887 | T13 arg13,
|
---|
7888 | T14 arg14,
|
---|
7889 | T15 arg15,
|
---|
7890 | T16 arg16,
|
---|
7891 | T17 arg17,
|
---|
7892 | T18 arg18,
|
---|
7893 | T19 arg19,
|
---|
7894 | T20 arg20,
|
---|
7895 | T21 arg21,
|
---|
7896 | T22 arg22,
|
---|
7897 | T23 arg23,
|
---|
7898 | T24 arg24,
|
---|
7899 | T25 arg25,
|
---|
7900 | T26 arg26,
|
---|
7901 | T27 arg27,
|
---|
7902 | T28 arg28,
|
---|
7903 | T29 arg29,
|
---|
7904 | T30 arg30)
|
---|
7905 | {
|
---|
7906 | return functor_(
|
---|
7907 | enqueueArgs,
|
---|
7908 | arg0,
|
---|
7909 | arg1,
|
---|
7910 | arg2,
|
---|
7911 | arg3,
|
---|
7912 | arg4,
|
---|
7913 | arg5,
|
---|
7914 | arg6,
|
---|
7915 | arg7,
|
---|
7916 | arg8,
|
---|
7917 | arg9,
|
---|
7918 | arg10,
|
---|
7919 | arg11,
|
---|
7920 | arg12,
|
---|
7921 | arg13,
|
---|
7922 | arg14,
|
---|
7923 | arg15,
|
---|
7924 | arg16,
|
---|
7925 | arg17,
|
---|
7926 | arg18,
|
---|
7927 | arg19,
|
---|
7928 | arg20,
|
---|
7929 | arg21,
|
---|
7930 | arg22,
|
---|
7931 | arg23,
|
---|
7932 | arg24,
|
---|
7933 | arg25,
|
---|
7934 | arg26,
|
---|
7935 | arg27,
|
---|
7936 | arg28,
|
---|
7937 | arg29,
|
---|
7938 | arg30);
|
---|
7939 | }
|
---|
7940 |
|
---|
7941 |
|
---|
7942 | };
|
---|
7943 |
|
---|
7944 | template<
|
---|
7945 | typename T0,
|
---|
7946 | typename T1,
|
---|
7947 | typename T2,
|
---|
7948 | typename T3,
|
---|
7949 | typename T4,
|
---|
7950 | typename T5,
|
---|
7951 | typename T6,
|
---|
7952 | typename T7,
|
---|
7953 | typename T8,
|
---|
7954 | typename T9,
|
---|
7955 | typename T10,
|
---|
7956 | typename T11,
|
---|
7957 | typename T12,
|
---|
7958 | typename T13,
|
---|
7959 | typename T14,
|
---|
7960 | typename T15,
|
---|
7961 | typename T16,
|
---|
7962 | typename T17,
|
---|
7963 | typename T18,
|
---|
7964 | typename T19,
|
---|
7965 | typename T20,
|
---|
7966 | typename T21,
|
---|
7967 | typename T22,
|
---|
7968 | typename T23,
|
---|
7969 | typename T24,
|
---|
7970 | typename T25,
|
---|
7971 | typename T26,
|
---|
7972 | typename T27,
|
---|
7973 | typename T28,
|
---|
7974 | typename T29>
|
---|
7975 | struct functionImplementation_
|
---|
7976 | < T0,
|
---|
7977 | T1,
|
---|
7978 | T2,
|
---|
7979 | T3,
|
---|
7980 | T4,
|
---|
7981 | T5,
|
---|
7982 | T6,
|
---|
7983 | T7,
|
---|
7984 | T8,
|
---|
7985 | T9,
|
---|
7986 | T10,
|
---|
7987 | T11,
|
---|
7988 | T12,
|
---|
7989 | T13,
|
---|
7990 | T14,
|
---|
7991 | T15,
|
---|
7992 | T16,
|
---|
7993 | T17,
|
---|
7994 | T18,
|
---|
7995 | T19,
|
---|
7996 | T20,
|
---|
7997 | T21,
|
---|
7998 | T22,
|
---|
7999 | T23,
|
---|
8000 | T24,
|
---|
8001 | T25,
|
---|
8002 | T26,
|
---|
8003 | T27,
|
---|
8004 | T28,
|
---|
8005 | T29,
|
---|
8006 | NullType,
|
---|
8007 | NullType>
|
---|
8008 | {
|
---|
8009 | typedef detail::KernelFunctorGlobal<
|
---|
8010 | T0,
|
---|
8011 | T1,
|
---|
8012 | T2,
|
---|
8013 | T3,
|
---|
8014 | T4,
|
---|
8015 | T5,
|
---|
8016 | T6,
|
---|
8017 | T7,
|
---|
8018 | T8,
|
---|
8019 | T9,
|
---|
8020 | T10,
|
---|
8021 | T11,
|
---|
8022 | T12,
|
---|
8023 | T13,
|
---|
8024 | T14,
|
---|
8025 | T15,
|
---|
8026 | T16,
|
---|
8027 | T17,
|
---|
8028 | T18,
|
---|
8029 | T19,
|
---|
8030 | T20,
|
---|
8031 | T21,
|
---|
8032 | T22,
|
---|
8033 | T23,
|
---|
8034 | T24,
|
---|
8035 | T25,
|
---|
8036 | T26,
|
---|
8037 | T27,
|
---|
8038 | T28,
|
---|
8039 | T29,
|
---|
8040 | NullType,
|
---|
8041 | NullType> FunctorType;
|
---|
8042 |
|
---|
8043 | FunctorType functor_;
|
---|
8044 |
|
---|
8045 | functionImplementation_(const FunctorType &functor) :
|
---|
8046 | functor_(functor)
|
---|
8047 | {
|
---|
8048 |
|
---|
8049 | #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 30))
|
---|
8050 | // Fail variadic expansion for dev11
|
---|
8051 | static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
|
---|
8052 | #endif
|
---|
8053 |
|
---|
8054 | }
|
---|
8055 |
|
---|
8056 | //! \brief Return type of the functor
|
---|
8057 | typedef Event result_type;
|
---|
8058 |
|
---|
8059 | //! \brief Function signature of kernel functor with no event dependency.
|
---|
8060 | typedef Event type_(
|
---|
8061 | const EnqueueArgs&,
|
---|
8062 | T0,
|
---|
8063 | T1,
|
---|
8064 | T2,
|
---|
8065 | T3,
|
---|
8066 | T4,
|
---|
8067 | T5,
|
---|
8068 | T6,
|
---|
8069 | T7,
|
---|
8070 | T8,
|
---|
8071 | T9,
|
---|
8072 | T10,
|
---|
8073 | T11,
|
---|
8074 | T12,
|
---|
8075 | T13,
|
---|
8076 | T14,
|
---|
8077 | T15,
|
---|
8078 | T16,
|
---|
8079 | T17,
|
---|
8080 | T18,
|
---|
8081 | T19,
|
---|
8082 | T20,
|
---|
8083 | T21,
|
---|
8084 | T22,
|
---|
8085 | T23,
|
---|
8086 | T24,
|
---|
8087 | T25,
|
---|
8088 | T26,
|
---|
8089 | T27,
|
---|
8090 | T28,
|
---|
8091 | T29);
|
---|
8092 |
|
---|
8093 | Event operator()(
|
---|
8094 | const EnqueueArgs& enqueueArgs,
|
---|
8095 | T0 arg0,
|
---|
8096 | T1 arg1,
|
---|
8097 | T2 arg2,
|
---|
8098 | T3 arg3,
|
---|
8099 | T4 arg4,
|
---|
8100 | T5 arg5,
|
---|
8101 | T6 arg6,
|
---|
8102 | T7 arg7,
|
---|
8103 | T8 arg8,
|
---|
8104 | T9 arg9,
|
---|
8105 | T10 arg10,
|
---|
8106 | T11 arg11,
|
---|
8107 | T12 arg12,
|
---|
8108 | T13 arg13,
|
---|
8109 | T14 arg14,
|
---|
8110 | T15 arg15,
|
---|
8111 | T16 arg16,
|
---|
8112 | T17 arg17,
|
---|
8113 | T18 arg18,
|
---|
8114 | T19 arg19,
|
---|
8115 | T20 arg20,
|
---|
8116 | T21 arg21,
|
---|
8117 | T22 arg22,
|
---|
8118 | T23 arg23,
|
---|
8119 | T24 arg24,
|
---|
8120 | T25 arg25,
|
---|
8121 | T26 arg26,
|
---|
8122 | T27 arg27,
|
---|
8123 | T28 arg28,
|
---|
8124 | T29 arg29)
|
---|
8125 | {
|
---|
8126 | return functor_(
|
---|
8127 | enqueueArgs,
|
---|
8128 | arg0,
|
---|
8129 | arg1,
|
---|
8130 | arg2,
|
---|
8131 | arg3,
|
---|
8132 | arg4,
|
---|
8133 | arg5,
|
---|
8134 | arg6,
|
---|
8135 | arg7,
|
---|
8136 | arg8,
|
---|
8137 | arg9,
|
---|
8138 | arg10,
|
---|
8139 | arg11,
|
---|
8140 | arg12,
|
---|
8141 | arg13,
|
---|
8142 | arg14,
|
---|
8143 | arg15,
|
---|
8144 | arg16,
|
---|
8145 | arg17,
|
---|
8146 | arg18,
|
---|
8147 | arg19,
|
---|
8148 | arg20,
|
---|
8149 | arg21,
|
---|
8150 | arg22,
|
---|
8151 | arg23,
|
---|
8152 | arg24,
|
---|
8153 | arg25,
|
---|
8154 | arg26,
|
---|
8155 | arg27,
|
---|
8156 | arg28,
|
---|
8157 | arg29);
|
---|
8158 | }
|
---|
8159 |
|
---|
8160 |
|
---|
8161 | };
|
---|
8162 |
|
---|
8163 | template<
|
---|
8164 | typename T0,
|
---|
8165 | typename T1,
|
---|
8166 | typename T2,
|
---|
8167 | typename T3,
|
---|
8168 | typename T4,
|
---|
8169 | typename T5,
|
---|
8170 | typename T6,
|
---|
8171 | typename T7,
|
---|
8172 | typename T8,
|
---|
8173 | typename T9,
|
---|
8174 | typename T10,
|
---|
8175 | typename T11,
|
---|
8176 | typename T12,
|
---|
8177 | typename T13,
|
---|
8178 | typename T14,
|
---|
8179 | typename T15,
|
---|
8180 | typename T16,
|
---|
8181 | typename T17,
|
---|
8182 | typename T18,
|
---|
8183 | typename T19,
|
---|
8184 | typename T20,
|
---|
8185 | typename T21,
|
---|
8186 | typename T22,
|
---|
8187 | typename T23,
|
---|
8188 | typename T24,
|
---|
8189 | typename T25,
|
---|
8190 | typename T26,
|
---|
8191 | typename T27,
|
---|
8192 | typename T28>
|
---|
8193 | struct functionImplementation_
|
---|
8194 | < T0,
|
---|
8195 | T1,
|
---|
8196 | T2,
|
---|
8197 | T3,
|
---|
8198 | T4,
|
---|
8199 | T5,
|
---|
8200 | T6,
|
---|
8201 | T7,
|
---|
8202 | T8,
|
---|
8203 | T9,
|
---|
8204 | T10,
|
---|
8205 | T11,
|
---|
8206 | T12,
|
---|
8207 | T13,
|
---|
8208 | T14,
|
---|
8209 | T15,
|
---|
8210 | T16,
|
---|
8211 | T17,
|
---|
8212 | T18,
|
---|
8213 | T19,
|
---|
8214 | T20,
|
---|
8215 | T21,
|
---|
8216 | T22,
|
---|
8217 | T23,
|
---|
8218 | T24,
|
---|
8219 | T25,
|
---|
8220 | T26,
|
---|
8221 | T27,
|
---|
8222 | T28,
|
---|
8223 | NullType,
|
---|
8224 | NullType,
|
---|
8225 | NullType>
|
---|
8226 | {
|
---|
8227 | typedef detail::KernelFunctorGlobal<
|
---|
8228 | T0,
|
---|
8229 | T1,
|
---|
8230 | T2,
|
---|
8231 | T3,
|
---|
8232 | T4,
|
---|
8233 | T5,
|
---|
8234 | T6,
|
---|
8235 | T7,
|
---|
8236 | T8,
|
---|
8237 | T9,
|
---|
8238 | T10,
|
---|
8239 | T11,
|
---|
8240 | T12,
|
---|
8241 | T13,
|
---|
8242 | T14,
|
---|
8243 | T15,
|
---|
8244 | T16,
|
---|
8245 | T17,
|
---|
8246 | T18,
|
---|
8247 | T19,
|
---|
8248 | T20,
|
---|
8249 | T21,
|
---|
8250 | T22,
|
---|
8251 | T23,
|
---|
8252 | T24,
|
---|
8253 | T25,
|
---|
8254 | T26,
|
---|
8255 | T27,
|
---|
8256 | T28,
|
---|
8257 | NullType,
|
---|
8258 | NullType,
|
---|
8259 | NullType> FunctorType;
|
---|
8260 |
|
---|
8261 | FunctorType functor_;
|
---|
8262 |
|
---|
8263 | functionImplementation_(const FunctorType &functor) :
|
---|
8264 | functor_(functor)
|
---|
8265 | {
|
---|
8266 |
|
---|
8267 | #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 29))
|
---|
8268 | // Fail variadic expansion for dev11
|
---|
8269 | static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
|
---|
8270 | #endif
|
---|
8271 |
|
---|
8272 | }
|
---|
8273 |
|
---|
8274 | //! \brief Return type of the functor
|
---|
8275 | typedef Event result_type;
|
---|
8276 |
|
---|
8277 | //! \brief Function signature of kernel functor with no event dependency.
|
---|
8278 | typedef Event type_(
|
---|
8279 | const EnqueueArgs&,
|
---|
8280 | T0,
|
---|
8281 | T1,
|
---|
8282 | T2,
|
---|
8283 | T3,
|
---|
8284 | T4,
|
---|
8285 | T5,
|
---|
8286 | T6,
|
---|
8287 | T7,
|
---|
8288 | T8,
|
---|
8289 | T9,
|
---|
8290 | T10,
|
---|
8291 | T11,
|
---|
8292 | T12,
|
---|
8293 | T13,
|
---|
8294 | T14,
|
---|
8295 | T15,
|
---|
8296 | T16,
|
---|
8297 | T17,
|
---|
8298 | T18,
|
---|
8299 | T19,
|
---|
8300 | T20,
|
---|
8301 | T21,
|
---|
8302 | T22,
|
---|
8303 | T23,
|
---|
8304 | T24,
|
---|
8305 | T25,
|
---|
8306 | T26,
|
---|
8307 | T27,
|
---|
8308 | T28);
|
---|
8309 |
|
---|
8310 | Event operator()(
|
---|
8311 | const EnqueueArgs& enqueueArgs,
|
---|
8312 | T0 arg0,
|
---|
8313 | T1 arg1,
|
---|
8314 | T2 arg2,
|
---|
8315 | T3 arg3,
|
---|
8316 | T4 arg4,
|
---|
8317 | T5 arg5,
|
---|
8318 | T6 arg6,
|
---|
8319 | T7 arg7,
|
---|
8320 | T8 arg8,
|
---|
8321 | T9 arg9,
|
---|
8322 | T10 arg10,
|
---|
8323 | T11 arg11,
|
---|
8324 | T12 arg12,
|
---|
8325 | T13 arg13,
|
---|
8326 | T14 arg14,
|
---|
8327 | T15 arg15,
|
---|
8328 | T16 arg16,
|
---|
8329 | T17 arg17,
|
---|
8330 | T18 arg18,
|
---|
8331 | T19 arg19,
|
---|
8332 | T20 arg20,
|
---|
8333 | T21 arg21,
|
---|
8334 | T22 arg22,
|
---|
8335 | T23 arg23,
|
---|
8336 | T24 arg24,
|
---|
8337 | T25 arg25,
|
---|
8338 | T26 arg26,
|
---|
8339 | T27 arg27,
|
---|
8340 | T28 arg28)
|
---|
8341 | {
|
---|
8342 | return functor_(
|
---|
8343 | enqueueArgs,
|
---|
8344 | arg0,
|
---|
8345 | arg1,
|
---|
8346 | arg2,
|
---|
8347 | arg3,
|
---|
8348 | arg4,
|
---|
8349 | arg5,
|
---|
8350 | arg6,
|
---|
8351 | arg7,
|
---|
8352 | arg8,
|
---|
8353 | arg9,
|
---|
8354 | arg10,
|
---|
8355 | arg11,
|
---|
8356 | arg12,
|
---|
8357 | arg13,
|
---|
8358 | arg14,
|
---|
8359 | arg15,
|
---|
8360 | arg16,
|
---|
8361 | arg17,
|
---|
8362 | arg18,
|
---|
8363 | arg19,
|
---|
8364 | arg20,
|
---|
8365 | arg21,
|
---|
8366 | arg22,
|
---|
8367 | arg23,
|
---|
8368 | arg24,
|
---|
8369 | arg25,
|
---|
8370 | arg26,
|
---|
8371 | arg27,
|
---|
8372 | arg28);
|
---|
8373 | }
|
---|
8374 |
|
---|
8375 |
|
---|
8376 | };
|
---|
8377 |
|
---|
8378 | template<
|
---|
8379 | typename T0,
|
---|
8380 | typename T1,
|
---|
8381 | typename T2,
|
---|
8382 | typename T3,
|
---|
8383 | typename T4,
|
---|
8384 | typename T5,
|
---|
8385 | typename T6,
|
---|
8386 | typename T7,
|
---|
8387 | typename T8,
|
---|
8388 | typename T9,
|
---|
8389 | typename T10,
|
---|
8390 | typename T11,
|
---|
8391 | typename T12,
|
---|
8392 | typename T13,
|
---|
8393 | typename T14,
|
---|
8394 | typename T15,
|
---|
8395 | typename T16,
|
---|
8396 | typename T17,
|
---|
8397 | typename T18,
|
---|
8398 | typename T19,
|
---|
8399 | typename T20,
|
---|
8400 | typename T21,
|
---|
8401 | typename T22,
|
---|
8402 | typename T23,
|
---|
8403 | typename T24,
|
---|
8404 | typename T25,
|
---|
8405 | typename T26,
|
---|
8406 | typename T27>
|
---|
8407 | struct functionImplementation_
|
---|
8408 | < T0,
|
---|
8409 | T1,
|
---|
8410 | T2,
|
---|
8411 | T3,
|
---|
8412 | T4,
|
---|
8413 | T5,
|
---|
8414 | T6,
|
---|
8415 | T7,
|
---|
8416 | T8,
|
---|
8417 | T9,
|
---|
8418 | T10,
|
---|
8419 | T11,
|
---|
8420 | T12,
|
---|
8421 | T13,
|
---|
8422 | T14,
|
---|
8423 | T15,
|
---|
8424 | T16,
|
---|
8425 | T17,
|
---|
8426 | T18,
|
---|
8427 | T19,
|
---|
8428 | T20,
|
---|
8429 | T21,
|
---|
8430 | T22,
|
---|
8431 | T23,
|
---|
8432 | T24,
|
---|
8433 | T25,
|
---|
8434 | T26,
|
---|
8435 | T27,
|
---|
8436 | NullType,
|
---|
8437 | NullType,
|
---|
8438 | NullType,
|
---|
8439 | NullType>
|
---|
8440 | {
|
---|
8441 | typedef detail::KernelFunctorGlobal<
|
---|
8442 | T0,
|
---|
8443 | T1,
|
---|
8444 | T2,
|
---|
8445 | T3,
|
---|
8446 | T4,
|
---|
8447 | T5,
|
---|
8448 | T6,
|
---|
8449 | T7,
|
---|
8450 | T8,
|
---|
8451 | T9,
|
---|
8452 | T10,
|
---|
8453 | T11,
|
---|
8454 | T12,
|
---|
8455 | T13,
|
---|
8456 | T14,
|
---|
8457 | T15,
|
---|
8458 | T16,
|
---|
8459 | T17,
|
---|
8460 | T18,
|
---|
8461 | T19,
|
---|
8462 | T20,
|
---|
8463 | T21,
|
---|
8464 | T22,
|
---|
8465 | T23,
|
---|
8466 | T24,
|
---|
8467 | T25,
|
---|
8468 | T26,
|
---|
8469 | T27,
|
---|
8470 | NullType,
|
---|
8471 | NullType,
|
---|
8472 | NullType,
|
---|
8473 | NullType> FunctorType;
|
---|
8474 |
|
---|
8475 | FunctorType functor_;
|
---|
8476 |
|
---|
8477 | functionImplementation_(const FunctorType &functor) :
|
---|
8478 | functor_(functor)
|
---|
8479 | {
|
---|
8480 |
|
---|
8481 | #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 28))
|
---|
8482 | // Fail variadic expansion for dev11
|
---|
8483 | static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
|
---|
8484 | #endif
|
---|
8485 |
|
---|
8486 | }
|
---|
8487 |
|
---|
8488 | //! \brief Return type of the functor
|
---|
8489 | typedef Event result_type;
|
---|
8490 |
|
---|
8491 | //! \brief Function signature of kernel functor with no event dependency.
|
---|
8492 | typedef Event type_(
|
---|
8493 | const EnqueueArgs&,
|
---|
8494 | T0,
|
---|
8495 | T1,
|
---|
8496 | T2,
|
---|
8497 | T3,
|
---|
8498 | T4,
|
---|
8499 | T5,
|
---|
8500 | T6,
|
---|
8501 | T7,
|
---|
8502 | T8,
|
---|
8503 | T9,
|
---|
8504 | T10,
|
---|
8505 | T11,
|
---|
8506 | T12,
|
---|
8507 | T13,
|
---|
8508 | T14,
|
---|
8509 | T15,
|
---|
8510 | T16,
|
---|
8511 | T17,
|
---|
8512 | T18,
|
---|
8513 | T19,
|
---|
8514 | T20,
|
---|
8515 | T21,
|
---|
8516 | T22,
|
---|
8517 | T23,
|
---|
8518 | T24,
|
---|
8519 | T25,
|
---|
8520 | T26,
|
---|
8521 | T27);
|
---|
8522 |
|
---|
8523 | Event operator()(
|
---|
8524 | const EnqueueArgs& enqueueArgs,
|
---|
8525 | T0 arg0,
|
---|
8526 | T1 arg1,
|
---|
8527 | T2 arg2,
|
---|
8528 | T3 arg3,
|
---|
8529 | T4 arg4,
|
---|
8530 | T5 arg5,
|
---|
8531 | T6 arg6,
|
---|
8532 | T7 arg7,
|
---|
8533 | T8 arg8,
|
---|
8534 | T9 arg9,
|
---|
8535 | T10 arg10,
|
---|
8536 | T11 arg11,
|
---|
8537 | T12 arg12,
|
---|
8538 | T13 arg13,
|
---|
8539 | T14 arg14,
|
---|
8540 | T15 arg15,
|
---|
8541 | T16 arg16,
|
---|
8542 | T17 arg17,
|
---|
8543 | T18 arg18,
|
---|
8544 | T19 arg19,
|
---|
8545 | T20 arg20,
|
---|
8546 | T21 arg21,
|
---|
8547 | T22 arg22,
|
---|
8548 | T23 arg23,
|
---|
8549 | T24 arg24,
|
---|
8550 | T25 arg25,
|
---|
8551 | T26 arg26,
|
---|
8552 | T27 arg27)
|
---|
8553 | {
|
---|
8554 | return functor_(
|
---|
8555 | enqueueArgs,
|
---|
8556 | arg0,
|
---|
8557 | arg1,
|
---|
8558 | arg2,
|
---|
8559 | arg3,
|
---|
8560 | arg4,
|
---|
8561 | arg5,
|
---|
8562 | arg6,
|
---|
8563 | arg7,
|
---|
8564 | arg8,
|
---|
8565 | arg9,
|
---|
8566 | arg10,
|
---|
8567 | arg11,
|
---|
8568 | arg12,
|
---|
8569 | arg13,
|
---|
8570 | arg14,
|
---|
8571 | arg15,
|
---|
8572 | arg16,
|
---|
8573 | arg17,
|
---|
8574 | arg18,
|
---|
8575 | arg19,
|
---|
8576 | arg20,
|
---|
8577 | arg21,
|
---|
8578 | arg22,
|
---|
8579 | arg23,
|
---|
8580 | arg24,
|
---|
8581 | arg25,
|
---|
8582 | arg26,
|
---|
8583 | arg27);
|
---|
8584 | }
|
---|
8585 |
|
---|
8586 |
|
---|
8587 | };
|
---|
8588 |
|
---|
8589 | template<
|
---|
8590 | typename T0,
|
---|
8591 | typename T1,
|
---|
8592 | typename T2,
|
---|
8593 | typename T3,
|
---|
8594 | typename T4,
|
---|
8595 | typename T5,
|
---|
8596 | typename T6,
|
---|
8597 | typename T7,
|
---|
8598 | typename T8,
|
---|
8599 | typename T9,
|
---|
8600 | typename T10,
|
---|
8601 | typename T11,
|
---|
8602 | typename T12,
|
---|
8603 | typename T13,
|
---|
8604 | typename T14,
|
---|
8605 | typename T15,
|
---|
8606 | typename T16,
|
---|
8607 | typename T17,
|
---|
8608 | typename T18,
|
---|
8609 | typename T19,
|
---|
8610 | typename T20,
|
---|
8611 | typename T21,
|
---|
8612 | typename T22,
|
---|
8613 | typename T23,
|
---|
8614 | typename T24,
|
---|
8615 | typename T25,
|
---|
8616 | typename T26>
|
---|
8617 | struct functionImplementation_
|
---|
8618 | < T0,
|
---|
8619 | T1,
|
---|
8620 | T2,
|
---|
8621 | T3,
|
---|
8622 | T4,
|
---|
8623 | T5,
|
---|
8624 | T6,
|
---|
8625 | T7,
|
---|
8626 | T8,
|
---|
8627 | T9,
|
---|
8628 | T10,
|
---|
8629 | T11,
|
---|
8630 | T12,
|
---|
8631 | T13,
|
---|
8632 | T14,
|
---|
8633 | T15,
|
---|
8634 | T16,
|
---|
8635 | T17,
|
---|
8636 | T18,
|
---|
8637 | T19,
|
---|
8638 | T20,
|
---|
8639 | T21,
|
---|
8640 | T22,
|
---|
8641 | T23,
|
---|
8642 | T24,
|
---|
8643 | T25,
|
---|
8644 | T26,
|
---|
8645 | NullType,
|
---|
8646 | NullType,
|
---|
8647 | NullType,
|
---|
8648 | NullType,
|
---|
8649 | NullType>
|
---|
8650 | {
|
---|
8651 | typedef detail::KernelFunctorGlobal<
|
---|
8652 | T0,
|
---|
8653 | T1,
|
---|
8654 | T2,
|
---|
8655 | T3,
|
---|
8656 | T4,
|
---|
8657 | T5,
|
---|
8658 | T6,
|
---|
8659 | T7,
|
---|
8660 | T8,
|
---|
8661 | T9,
|
---|
8662 | T10,
|
---|
8663 | T11,
|
---|
8664 | T12,
|
---|
8665 | T13,
|
---|
8666 | T14,
|
---|
8667 | T15,
|
---|
8668 | T16,
|
---|
8669 | T17,
|
---|
8670 | T18,
|
---|
8671 | T19,
|
---|
8672 | T20,
|
---|
8673 | T21,
|
---|
8674 | T22,
|
---|
8675 | T23,
|
---|
8676 | T24,
|
---|
8677 | T25,
|
---|
8678 | T26,
|
---|
8679 | NullType,
|
---|
8680 | NullType,
|
---|
8681 | NullType,
|
---|
8682 | NullType,
|
---|
8683 | NullType> FunctorType;
|
---|
8684 |
|
---|
8685 | FunctorType functor_;
|
---|
8686 |
|
---|
8687 | functionImplementation_(const FunctorType &functor) :
|
---|
8688 | functor_(functor)
|
---|
8689 | {
|
---|
8690 |
|
---|
8691 | #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 27))
|
---|
8692 | // Fail variadic expansion for dev11
|
---|
8693 | static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
|
---|
8694 | #endif
|
---|
8695 |
|
---|
8696 | }
|
---|
8697 |
|
---|
8698 | //! \brief Return type of the functor
|
---|
8699 | typedef Event result_type;
|
---|
8700 |
|
---|
8701 | //! \brief Function signature of kernel functor with no event dependency.
|
---|
8702 | typedef Event type_(
|
---|
8703 | const EnqueueArgs&,
|
---|
8704 | T0,
|
---|
8705 | T1,
|
---|
8706 | T2,
|
---|
8707 | T3,
|
---|
8708 | T4,
|
---|
8709 | T5,
|
---|
8710 | T6,
|
---|
8711 | T7,
|
---|
8712 | T8,
|
---|
8713 | T9,
|
---|
8714 | T10,
|
---|
8715 | T11,
|
---|
8716 | T12,
|
---|
8717 | T13,
|
---|
8718 | T14,
|
---|
8719 | T15,
|
---|
8720 | T16,
|
---|
8721 | T17,
|
---|
8722 | T18,
|
---|
8723 | T19,
|
---|
8724 | T20,
|
---|
8725 | T21,
|
---|
8726 | T22,
|
---|
8727 | T23,
|
---|
8728 | T24,
|
---|
8729 | T25,
|
---|
8730 | T26);
|
---|
8731 |
|
---|
8732 | Event operator()(
|
---|
8733 | const EnqueueArgs& enqueueArgs,
|
---|
8734 | T0 arg0,
|
---|
8735 | T1 arg1,
|
---|
8736 | T2 arg2,
|
---|
8737 | T3 arg3,
|
---|
8738 | T4 arg4,
|
---|
8739 | T5 arg5,
|
---|
8740 | T6 arg6,
|
---|
8741 | T7 arg7,
|
---|
8742 | T8 arg8,
|
---|
8743 | T9 arg9,
|
---|
8744 | T10 arg10,
|
---|
8745 | T11 arg11,
|
---|
8746 | T12 arg12,
|
---|
8747 | T13 arg13,
|
---|
8748 | T14 arg14,
|
---|
8749 | T15 arg15,
|
---|
8750 | T16 arg16,
|
---|
8751 | T17 arg17,
|
---|
8752 | T18 arg18,
|
---|
8753 | T19 arg19,
|
---|
8754 | T20 arg20,
|
---|
8755 | T21 arg21,
|
---|
8756 | T22 arg22,
|
---|
8757 | T23 arg23,
|
---|
8758 | T24 arg24,
|
---|
8759 | T25 arg25,
|
---|
8760 | T26 arg26)
|
---|
8761 | {
|
---|
8762 | return functor_(
|
---|
8763 | enqueueArgs,
|
---|
8764 | arg0,
|
---|
8765 | arg1,
|
---|
8766 | arg2,
|
---|
8767 | arg3,
|
---|
8768 | arg4,
|
---|
8769 | arg5,
|
---|
8770 | arg6,
|
---|
8771 | arg7,
|
---|
8772 | arg8,
|
---|
8773 | arg9,
|
---|
8774 | arg10,
|
---|
8775 | arg11,
|
---|
8776 | arg12,
|
---|
8777 | arg13,
|
---|
8778 | arg14,
|
---|
8779 | arg15,
|
---|
8780 | arg16,
|
---|
8781 | arg17,
|
---|
8782 | arg18,
|
---|
8783 | arg19,
|
---|
8784 | arg20,
|
---|
8785 | arg21,
|
---|
8786 | arg22,
|
---|
8787 | arg23,
|
---|
8788 | arg24,
|
---|
8789 | arg25,
|
---|
8790 | arg26);
|
---|
8791 | }
|
---|
8792 |
|
---|
8793 |
|
---|
8794 | };
|
---|
8795 |
|
---|
8796 | template<
|
---|
8797 | typename T0,
|
---|
8798 | typename T1,
|
---|
8799 | typename T2,
|
---|
8800 | typename T3,
|
---|
8801 | typename T4,
|
---|
8802 | typename T5,
|
---|
8803 | typename T6,
|
---|
8804 | typename T7,
|
---|
8805 | typename T8,
|
---|
8806 | typename T9,
|
---|
8807 | typename T10,
|
---|
8808 | typename T11,
|
---|
8809 | typename T12,
|
---|
8810 | typename T13,
|
---|
8811 | typename T14,
|
---|
8812 | typename T15,
|
---|
8813 | typename T16,
|
---|
8814 | typename T17,
|
---|
8815 | typename T18,
|
---|
8816 | typename T19,
|
---|
8817 | typename T20,
|
---|
8818 | typename T21,
|
---|
8819 | typename T22,
|
---|
8820 | typename T23,
|
---|
8821 | typename T24,
|
---|
8822 | typename T25>
|
---|
8823 | struct functionImplementation_
|
---|
8824 | < T0,
|
---|
8825 | T1,
|
---|
8826 | T2,
|
---|
8827 | T3,
|
---|
8828 | T4,
|
---|
8829 | T5,
|
---|
8830 | T6,
|
---|
8831 | T7,
|
---|
8832 | T8,
|
---|
8833 | T9,
|
---|
8834 | T10,
|
---|
8835 | T11,
|
---|
8836 | T12,
|
---|
8837 | T13,
|
---|
8838 | T14,
|
---|
8839 | T15,
|
---|
8840 | T16,
|
---|
8841 | T17,
|
---|
8842 | T18,
|
---|
8843 | T19,
|
---|
8844 | T20,
|
---|
8845 | T21,
|
---|
8846 | T22,
|
---|
8847 | T23,
|
---|
8848 | T24,
|
---|
8849 | T25,
|
---|
8850 | NullType,
|
---|
8851 | NullType,
|
---|
8852 | NullType,
|
---|
8853 | NullType,
|
---|
8854 | NullType,
|
---|
8855 | NullType>
|
---|
8856 | {
|
---|
8857 | typedef detail::KernelFunctorGlobal<
|
---|
8858 | T0,
|
---|
8859 | T1,
|
---|
8860 | T2,
|
---|
8861 | T3,
|
---|
8862 | T4,
|
---|
8863 | T5,
|
---|
8864 | T6,
|
---|
8865 | T7,
|
---|
8866 | T8,
|
---|
8867 | T9,
|
---|
8868 | T10,
|
---|
8869 | T11,
|
---|
8870 | T12,
|
---|
8871 | T13,
|
---|
8872 | T14,
|
---|
8873 | T15,
|
---|
8874 | T16,
|
---|
8875 | T17,
|
---|
8876 | T18,
|
---|
8877 | T19,
|
---|
8878 | T20,
|
---|
8879 | T21,
|
---|
8880 | T22,
|
---|
8881 | T23,
|
---|
8882 | T24,
|
---|
8883 | T25,
|
---|
8884 | NullType,
|
---|
8885 | NullType,
|
---|
8886 | NullType,
|
---|
8887 | NullType,
|
---|
8888 | NullType,
|
---|
8889 | NullType> FunctorType;
|
---|
8890 |
|
---|
8891 | FunctorType functor_;
|
---|
8892 |
|
---|
8893 | functionImplementation_(const FunctorType &functor) :
|
---|
8894 | functor_(functor)
|
---|
8895 | {
|
---|
8896 |
|
---|
8897 | #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 26))
|
---|
8898 | // Fail variadic expansion for dev11
|
---|
8899 | static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
|
---|
8900 | #endif
|
---|
8901 |
|
---|
8902 | }
|
---|
8903 |
|
---|
8904 | //! \brief Return type of the functor
|
---|
8905 | typedef Event result_type;
|
---|
8906 |
|
---|
8907 | //! \brief Function signature of kernel functor with no event dependency.
|
---|
8908 | typedef Event type_(
|
---|
8909 | const EnqueueArgs&,
|
---|
8910 | T0,
|
---|
8911 | T1,
|
---|
8912 | T2,
|
---|
8913 | T3,
|
---|
8914 | T4,
|
---|
8915 | T5,
|
---|
8916 | T6,
|
---|
8917 | T7,
|
---|
8918 | T8,
|
---|
8919 | T9,
|
---|
8920 | T10,
|
---|
8921 | T11,
|
---|
8922 | T12,
|
---|
8923 | T13,
|
---|
8924 | T14,
|
---|
8925 | T15,
|
---|
8926 | T16,
|
---|
8927 | T17,
|
---|
8928 | T18,
|
---|
8929 | T19,
|
---|
8930 | T20,
|
---|
8931 | T21,
|
---|
8932 | T22,
|
---|
8933 | T23,
|
---|
8934 | T24,
|
---|
8935 | T25);
|
---|
8936 |
|
---|
8937 | Event operator()(
|
---|
8938 | const EnqueueArgs& enqueueArgs,
|
---|
8939 | T0 arg0,
|
---|
8940 | T1 arg1,
|
---|
8941 | T2 arg2,
|
---|
8942 | T3 arg3,
|
---|
8943 | T4 arg4,
|
---|
8944 | T5 arg5,
|
---|
8945 | T6 arg6,
|
---|
8946 | T7 arg7,
|
---|
8947 | T8 arg8,
|
---|
8948 | T9 arg9,
|
---|
8949 | T10 arg10,
|
---|
8950 | T11 arg11,
|
---|
8951 | T12 arg12,
|
---|
8952 | T13 arg13,
|
---|
8953 | T14 arg14,
|
---|
8954 | T15 arg15,
|
---|
8955 | T16 arg16,
|
---|
8956 | T17 arg17,
|
---|
8957 | T18 arg18,
|
---|
8958 | T19 arg19,
|
---|
8959 | T20 arg20,
|
---|
8960 | T21 arg21,
|
---|
8961 | T22 arg22,
|
---|
8962 | T23 arg23,
|
---|
8963 | T24 arg24,
|
---|
8964 | T25 arg25)
|
---|
8965 | {
|
---|
8966 | return functor_(
|
---|
8967 | enqueueArgs,
|
---|
8968 | arg0,
|
---|
8969 | arg1,
|
---|
8970 | arg2,
|
---|
8971 | arg3,
|
---|
8972 | arg4,
|
---|
8973 | arg5,
|
---|
8974 | arg6,
|
---|
8975 | arg7,
|
---|
8976 | arg8,
|
---|
8977 | arg9,
|
---|
8978 | arg10,
|
---|
8979 | arg11,
|
---|
8980 | arg12,
|
---|
8981 | arg13,
|
---|
8982 | arg14,
|
---|
8983 | arg15,
|
---|
8984 | arg16,
|
---|
8985 | arg17,
|
---|
8986 | arg18,
|
---|
8987 | arg19,
|
---|
8988 | arg20,
|
---|
8989 | arg21,
|
---|
8990 | arg22,
|
---|
8991 | arg23,
|
---|
8992 | arg24,
|
---|
8993 | arg25);
|
---|
8994 | }
|
---|
8995 |
|
---|
8996 |
|
---|
8997 | };
|
---|
8998 |
|
---|
8999 | template<
|
---|
9000 | typename T0,
|
---|
9001 | typename T1,
|
---|
9002 | typename T2,
|
---|
9003 | typename T3,
|
---|
9004 | typename T4,
|
---|
9005 | typename T5,
|
---|
9006 | typename T6,
|
---|
9007 | typename T7,
|
---|
9008 | typename T8,
|
---|
9009 | typename T9,
|
---|
9010 | typename T10,
|
---|
9011 | typename T11,
|
---|
9012 | typename T12,
|
---|
9013 | typename T13,
|
---|
9014 | typename T14,
|
---|
9015 | typename T15,
|
---|
9016 | typename T16,
|
---|
9017 | typename T17,
|
---|
9018 | typename T18,
|
---|
9019 | typename T19,
|
---|
9020 | typename T20,
|
---|
9021 | typename T21,
|
---|
9022 | typename T22,
|
---|
9023 | typename T23,
|
---|
9024 | typename T24>
|
---|
9025 | struct functionImplementation_
|
---|
9026 | < T0,
|
---|
9027 | T1,
|
---|
9028 | T2,
|
---|
9029 | T3,
|
---|
9030 | T4,
|
---|
9031 | T5,
|
---|
9032 | T6,
|
---|
9033 | T7,
|
---|
9034 | T8,
|
---|
9035 | T9,
|
---|
9036 | T10,
|
---|
9037 | T11,
|
---|
9038 | T12,
|
---|
9039 | T13,
|
---|
9040 | T14,
|
---|
9041 | T15,
|
---|
9042 | T16,
|
---|
9043 | T17,
|
---|
9044 | T18,
|
---|
9045 | T19,
|
---|
9046 | T20,
|
---|
9047 | T21,
|
---|
9048 | T22,
|
---|
9049 | T23,
|
---|
9050 | T24,
|
---|
9051 | NullType,
|
---|
9052 | NullType,
|
---|
9053 | NullType,
|
---|
9054 | NullType,
|
---|
9055 | NullType,
|
---|
9056 | NullType,
|
---|
9057 | NullType>
|
---|
9058 | {
|
---|
9059 | typedef detail::KernelFunctorGlobal<
|
---|
9060 | T0,
|
---|
9061 | T1,
|
---|
9062 | T2,
|
---|
9063 | T3,
|
---|
9064 | T4,
|
---|
9065 | T5,
|
---|
9066 | T6,
|
---|
9067 | T7,
|
---|
9068 | T8,
|
---|
9069 | T9,
|
---|
9070 | T10,
|
---|
9071 | T11,
|
---|
9072 | T12,
|
---|
9073 | T13,
|
---|
9074 | T14,
|
---|
9075 | T15,
|
---|
9076 | T16,
|
---|
9077 | T17,
|
---|
9078 | T18,
|
---|
9079 | T19,
|
---|
9080 | T20,
|
---|
9081 | T21,
|
---|
9082 | T22,
|
---|
9083 | T23,
|
---|
9084 | T24,
|
---|
9085 | NullType,
|
---|
9086 | NullType,
|
---|
9087 | NullType,
|
---|
9088 | NullType,
|
---|
9089 | NullType,
|
---|
9090 | NullType,
|
---|
9091 | NullType> FunctorType;
|
---|
9092 |
|
---|
9093 | FunctorType functor_;
|
---|
9094 |
|
---|
9095 | functionImplementation_(const FunctorType &functor) :
|
---|
9096 | functor_(functor)
|
---|
9097 | {
|
---|
9098 |
|
---|
9099 | #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 25))
|
---|
9100 | // Fail variadic expansion for dev11
|
---|
9101 | static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
|
---|
9102 | #endif
|
---|
9103 |
|
---|
9104 | }
|
---|
9105 |
|
---|
9106 | //! \brief Return type of the functor
|
---|
9107 | typedef Event result_type;
|
---|
9108 |
|
---|
9109 | //! \brief Function signature of kernel functor with no event dependency.
|
---|
9110 | typedef Event type_(
|
---|
9111 | const EnqueueArgs&,
|
---|
9112 | T0,
|
---|
9113 | T1,
|
---|
9114 | T2,
|
---|
9115 | T3,
|
---|
9116 | T4,
|
---|
9117 | T5,
|
---|
9118 | T6,
|
---|
9119 | T7,
|
---|
9120 | T8,
|
---|
9121 | T9,
|
---|
9122 | T10,
|
---|
9123 | T11,
|
---|
9124 | T12,
|
---|
9125 | T13,
|
---|
9126 | T14,
|
---|
9127 | T15,
|
---|
9128 | T16,
|
---|
9129 | T17,
|
---|
9130 | T18,
|
---|
9131 | T19,
|
---|
9132 | T20,
|
---|
9133 | T21,
|
---|
9134 | T22,
|
---|
9135 | T23,
|
---|
9136 | T24);
|
---|
9137 |
|
---|
9138 | Event operator()(
|
---|
9139 | const EnqueueArgs& enqueueArgs,
|
---|
9140 | T0 arg0,
|
---|
9141 | T1 arg1,
|
---|
9142 | T2 arg2,
|
---|
9143 | T3 arg3,
|
---|
9144 | T4 arg4,
|
---|
9145 | T5 arg5,
|
---|
9146 | T6 arg6,
|
---|
9147 | T7 arg7,
|
---|
9148 | T8 arg8,
|
---|
9149 | T9 arg9,
|
---|
9150 | T10 arg10,
|
---|
9151 | T11 arg11,
|
---|
9152 | T12 arg12,
|
---|
9153 | T13 arg13,
|
---|
9154 | T14 arg14,
|
---|
9155 | T15 arg15,
|
---|
9156 | T16 arg16,
|
---|
9157 | T17 arg17,
|
---|
9158 | T18 arg18,
|
---|
9159 | T19 arg19,
|
---|
9160 | T20 arg20,
|
---|
9161 | T21 arg21,
|
---|
9162 | T22 arg22,
|
---|
9163 | T23 arg23,
|
---|
9164 | T24 arg24)
|
---|
9165 | {
|
---|
9166 | return functor_(
|
---|
9167 | enqueueArgs,
|
---|
9168 | arg0,
|
---|
9169 | arg1,
|
---|
9170 | arg2,
|
---|
9171 | arg3,
|
---|
9172 | arg4,
|
---|
9173 | arg5,
|
---|
9174 | arg6,
|
---|
9175 | arg7,
|
---|
9176 | arg8,
|
---|
9177 | arg9,
|
---|
9178 | arg10,
|
---|
9179 | arg11,
|
---|
9180 | arg12,
|
---|
9181 | arg13,
|
---|
9182 | arg14,
|
---|
9183 | arg15,
|
---|
9184 | arg16,
|
---|
9185 | arg17,
|
---|
9186 | arg18,
|
---|
9187 | arg19,
|
---|
9188 | arg20,
|
---|
9189 | arg21,
|
---|
9190 | arg22,
|
---|
9191 | arg23,
|
---|
9192 | arg24);
|
---|
9193 | }
|
---|
9194 |
|
---|
9195 |
|
---|
9196 | };
|
---|
9197 |
|
---|
9198 | template<
|
---|
9199 | typename T0,
|
---|
9200 | typename T1,
|
---|
9201 | typename T2,
|
---|
9202 | typename T3,
|
---|
9203 | typename T4,
|
---|
9204 | typename T5,
|
---|
9205 | typename T6,
|
---|
9206 | typename T7,
|
---|
9207 | typename T8,
|
---|
9208 | typename T9,
|
---|
9209 | typename T10,
|
---|
9210 | typename T11,
|
---|
9211 | typename T12,
|
---|
9212 | typename T13,
|
---|
9213 | typename T14,
|
---|
9214 | typename T15,
|
---|
9215 | typename T16,
|
---|
9216 | typename T17,
|
---|
9217 | typename T18,
|
---|
9218 | typename T19,
|
---|
9219 | typename T20,
|
---|
9220 | typename T21,
|
---|
9221 | typename T22,
|
---|
9222 | typename T23>
|
---|
9223 | struct functionImplementation_
|
---|
9224 | < T0,
|
---|
9225 | T1,
|
---|
9226 | T2,
|
---|
9227 | T3,
|
---|
9228 | T4,
|
---|
9229 | T5,
|
---|
9230 | T6,
|
---|
9231 | T7,
|
---|
9232 | T8,
|
---|
9233 | T9,
|
---|
9234 | T10,
|
---|
9235 | T11,
|
---|
9236 | T12,
|
---|
9237 | T13,
|
---|
9238 | T14,
|
---|
9239 | T15,
|
---|
9240 | T16,
|
---|
9241 | T17,
|
---|
9242 | T18,
|
---|
9243 | T19,
|
---|
9244 | T20,
|
---|
9245 | T21,
|
---|
9246 | T22,
|
---|
9247 | T23,
|
---|
9248 | NullType,
|
---|
9249 | NullType,
|
---|
9250 | NullType,
|
---|
9251 | NullType,
|
---|
9252 | NullType,
|
---|
9253 | NullType,
|
---|
9254 | NullType,
|
---|
9255 | NullType>
|
---|
9256 | {
|
---|
9257 | typedef detail::KernelFunctorGlobal<
|
---|
9258 | T0,
|
---|
9259 | T1,
|
---|
9260 | T2,
|
---|
9261 | T3,
|
---|
9262 | T4,
|
---|
9263 | T5,
|
---|
9264 | T6,
|
---|
9265 | T7,
|
---|
9266 | T8,
|
---|
9267 | T9,
|
---|
9268 | T10,
|
---|
9269 | T11,
|
---|
9270 | T12,
|
---|
9271 | T13,
|
---|
9272 | T14,
|
---|
9273 | T15,
|
---|
9274 | T16,
|
---|
9275 | T17,
|
---|
9276 | T18,
|
---|
9277 | T19,
|
---|
9278 | T20,
|
---|
9279 | T21,
|
---|
9280 | T22,
|
---|
9281 | T23,
|
---|
9282 | NullType,
|
---|
9283 | NullType,
|
---|
9284 | NullType,
|
---|
9285 | NullType,
|
---|
9286 | NullType,
|
---|
9287 | NullType,
|
---|
9288 | NullType,
|
---|
9289 | NullType> FunctorType;
|
---|
9290 |
|
---|
9291 | FunctorType functor_;
|
---|
9292 |
|
---|
9293 | functionImplementation_(const FunctorType &functor) :
|
---|
9294 | functor_(functor)
|
---|
9295 | {
|
---|
9296 |
|
---|
9297 | #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 24))
|
---|
9298 | // Fail variadic expansion for dev11
|
---|
9299 | static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
|
---|
9300 | #endif
|
---|
9301 |
|
---|
9302 | }
|
---|
9303 |
|
---|
9304 | //! \brief Return type of the functor
|
---|
9305 | typedef Event result_type;
|
---|
9306 |
|
---|
9307 | //! \brief Function signature of kernel functor with no event dependency.
|
---|
9308 | typedef Event type_(
|
---|
9309 | const EnqueueArgs&,
|
---|
9310 | T0,
|
---|
9311 | T1,
|
---|
9312 | T2,
|
---|
9313 | T3,
|
---|
9314 | T4,
|
---|
9315 | T5,
|
---|
9316 | T6,
|
---|
9317 | T7,
|
---|
9318 | T8,
|
---|
9319 | T9,
|
---|
9320 | T10,
|
---|
9321 | T11,
|
---|
9322 | T12,
|
---|
9323 | T13,
|
---|
9324 | T14,
|
---|
9325 | T15,
|
---|
9326 | T16,
|
---|
9327 | T17,
|
---|
9328 | T18,
|
---|
9329 | T19,
|
---|
9330 | T20,
|
---|
9331 | T21,
|
---|
9332 | T22,
|
---|
9333 | T23);
|
---|
9334 |
|
---|
9335 | Event operator()(
|
---|
9336 | const EnqueueArgs& enqueueArgs,
|
---|
9337 | T0 arg0,
|
---|
9338 | T1 arg1,
|
---|
9339 | T2 arg2,
|
---|
9340 | T3 arg3,
|
---|
9341 | T4 arg4,
|
---|
9342 | T5 arg5,
|
---|
9343 | T6 arg6,
|
---|
9344 | T7 arg7,
|
---|
9345 | T8 arg8,
|
---|
9346 | T9 arg9,
|
---|
9347 | T10 arg10,
|
---|
9348 | T11 arg11,
|
---|
9349 | T12 arg12,
|
---|
9350 | T13 arg13,
|
---|
9351 | T14 arg14,
|
---|
9352 | T15 arg15,
|
---|
9353 | T16 arg16,
|
---|
9354 | T17 arg17,
|
---|
9355 | T18 arg18,
|
---|
9356 | T19 arg19,
|
---|
9357 | T20 arg20,
|
---|
9358 | T21 arg21,
|
---|
9359 | T22 arg22,
|
---|
9360 | T23 arg23)
|
---|
9361 | {
|
---|
9362 | return functor_(
|
---|
9363 | enqueueArgs,
|
---|
9364 | arg0,
|
---|
9365 | arg1,
|
---|
9366 | arg2,
|
---|
9367 | arg3,
|
---|
9368 | arg4,
|
---|
9369 | arg5,
|
---|
9370 | arg6,
|
---|
9371 | arg7,
|
---|
9372 | arg8,
|
---|
9373 | arg9,
|
---|
9374 | arg10,
|
---|
9375 | arg11,
|
---|
9376 | arg12,
|
---|
9377 | arg13,
|
---|
9378 | arg14,
|
---|
9379 | arg15,
|
---|
9380 | arg16,
|
---|
9381 | arg17,
|
---|
9382 | arg18,
|
---|
9383 | arg19,
|
---|
9384 | arg20,
|
---|
9385 | arg21,
|
---|
9386 | arg22,
|
---|
9387 | arg23);
|
---|
9388 | }
|
---|
9389 |
|
---|
9390 |
|
---|
9391 | };
|
---|
9392 |
|
---|
9393 | template<
|
---|
9394 | typename T0,
|
---|
9395 | typename T1,
|
---|
9396 | typename T2,
|
---|
9397 | typename T3,
|
---|
9398 | typename T4,
|
---|
9399 | typename T5,
|
---|
9400 | typename T6,
|
---|
9401 | typename T7,
|
---|
9402 | typename T8,
|
---|
9403 | typename T9,
|
---|
9404 | typename T10,
|
---|
9405 | typename T11,
|
---|
9406 | typename T12,
|
---|
9407 | typename T13,
|
---|
9408 | typename T14,
|
---|
9409 | typename T15,
|
---|
9410 | typename T16,
|
---|
9411 | typename T17,
|
---|
9412 | typename T18,
|
---|
9413 | typename T19,
|
---|
9414 | typename T20,
|
---|
9415 | typename T21,
|
---|
9416 | typename T22>
|
---|
9417 | struct functionImplementation_
|
---|
9418 | < T0,
|
---|
9419 | T1,
|
---|
9420 | T2,
|
---|
9421 | T3,
|
---|
9422 | T4,
|
---|
9423 | T5,
|
---|
9424 | T6,
|
---|
9425 | T7,
|
---|
9426 | T8,
|
---|
9427 | T9,
|
---|
9428 | T10,
|
---|
9429 | T11,
|
---|
9430 | T12,
|
---|
9431 | T13,
|
---|
9432 | T14,
|
---|
9433 | T15,
|
---|
9434 | T16,
|
---|
9435 | T17,
|
---|
9436 | T18,
|
---|
9437 | T19,
|
---|
9438 | T20,
|
---|
9439 | T21,
|
---|
9440 | T22,
|
---|
9441 | NullType,
|
---|
9442 | NullType,
|
---|
9443 | NullType,
|
---|
9444 | NullType,
|
---|
9445 | NullType,
|
---|
9446 | NullType,
|
---|
9447 | NullType,
|
---|
9448 | NullType,
|
---|
9449 | NullType>
|
---|
9450 | {
|
---|
9451 | typedef detail::KernelFunctorGlobal<
|
---|
9452 | T0,
|
---|
9453 | T1,
|
---|
9454 | T2,
|
---|
9455 | T3,
|
---|
9456 | T4,
|
---|
9457 | T5,
|
---|
9458 | T6,
|
---|
9459 | T7,
|
---|
9460 | T8,
|
---|
9461 | T9,
|
---|
9462 | T10,
|
---|
9463 | T11,
|
---|
9464 | T12,
|
---|
9465 | T13,
|
---|
9466 | T14,
|
---|
9467 | T15,
|
---|
9468 | T16,
|
---|
9469 | T17,
|
---|
9470 | T18,
|
---|
9471 | T19,
|
---|
9472 | T20,
|
---|
9473 | T21,
|
---|
9474 | T22,
|
---|
9475 | NullType,
|
---|
9476 | NullType,
|
---|
9477 | NullType,
|
---|
9478 | NullType,
|
---|
9479 | NullType,
|
---|
9480 | NullType,
|
---|
9481 | NullType,
|
---|
9482 | NullType,
|
---|
9483 | NullType> FunctorType;
|
---|
9484 |
|
---|
9485 | FunctorType functor_;
|
---|
9486 |
|
---|
9487 | functionImplementation_(const FunctorType &functor) :
|
---|
9488 | functor_(functor)
|
---|
9489 | {
|
---|
9490 |
|
---|
9491 | #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 23))
|
---|
9492 | // Fail variadic expansion for dev11
|
---|
9493 | static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
|
---|
9494 | #endif
|
---|
9495 |
|
---|
9496 | }
|
---|
9497 |
|
---|
9498 | //! \brief Return type of the functor
|
---|
9499 | typedef Event result_type;
|
---|
9500 |
|
---|
9501 | //! \brief Function signature of kernel functor with no event dependency.
|
---|
9502 | typedef Event type_(
|
---|
9503 | const EnqueueArgs&,
|
---|
9504 | T0,
|
---|
9505 | T1,
|
---|
9506 | T2,
|
---|
9507 | T3,
|
---|
9508 | T4,
|
---|
9509 | T5,
|
---|
9510 | T6,
|
---|
9511 | T7,
|
---|
9512 | T8,
|
---|
9513 | T9,
|
---|
9514 | T10,
|
---|
9515 | T11,
|
---|
9516 | T12,
|
---|
9517 | T13,
|
---|
9518 | T14,
|
---|
9519 | T15,
|
---|
9520 | T16,
|
---|
9521 | T17,
|
---|
9522 | T18,
|
---|
9523 | T19,
|
---|
9524 | T20,
|
---|
9525 | T21,
|
---|
9526 | T22);
|
---|
9527 |
|
---|
9528 | Event operator()(
|
---|
9529 | const EnqueueArgs& enqueueArgs,
|
---|
9530 | T0 arg0,
|
---|
9531 | T1 arg1,
|
---|
9532 | T2 arg2,
|
---|
9533 | T3 arg3,
|
---|
9534 | T4 arg4,
|
---|
9535 | T5 arg5,
|
---|
9536 | T6 arg6,
|
---|
9537 | T7 arg7,
|
---|
9538 | T8 arg8,
|
---|
9539 | T9 arg9,
|
---|
9540 | T10 arg10,
|
---|
9541 | T11 arg11,
|
---|
9542 | T12 arg12,
|
---|
9543 | T13 arg13,
|
---|
9544 | T14 arg14,
|
---|
9545 | T15 arg15,
|
---|
9546 | T16 arg16,
|
---|
9547 | T17 arg17,
|
---|
9548 | T18 arg18,
|
---|
9549 | T19 arg19,
|
---|
9550 | T20 arg20,
|
---|
9551 | T21 arg21,
|
---|
9552 | T22 arg22)
|
---|
9553 | {
|
---|
9554 | return functor_(
|
---|
9555 | enqueueArgs,
|
---|
9556 | arg0,
|
---|
9557 | arg1,
|
---|
9558 | arg2,
|
---|
9559 | arg3,
|
---|
9560 | arg4,
|
---|
9561 | arg5,
|
---|
9562 | arg6,
|
---|
9563 | arg7,
|
---|
9564 | arg8,
|
---|
9565 | arg9,
|
---|
9566 | arg10,
|
---|
9567 | arg11,
|
---|
9568 | arg12,
|
---|
9569 | arg13,
|
---|
9570 | arg14,
|
---|
9571 | arg15,
|
---|
9572 | arg16,
|
---|
9573 | arg17,
|
---|
9574 | arg18,
|
---|
9575 | arg19,
|
---|
9576 | arg20,
|
---|
9577 | arg21,
|
---|
9578 | arg22);
|
---|
9579 | }
|
---|
9580 |
|
---|
9581 |
|
---|
9582 | };
|
---|
9583 |
|
---|
9584 | template<
|
---|
9585 | typename T0,
|
---|
9586 | typename T1,
|
---|
9587 | typename T2,
|
---|
9588 | typename T3,
|
---|
9589 | typename T4,
|
---|
9590 | typename T5,
|
---|
9591 | typename T6,
|
---|
9592 | typename T7,
|
---|
9593 | typename T8,
|
---|
9594 | typename T9,
|
---|
9595 | typename T10,
|
---|
9596 | typename T11,
|
---|
9597 | typename T12,
|
---|
9598 | typename T13,
|
---|
9599 | typename T14,
|
---|
9600 | typename T15,
|
---|
9601 | typename T16,
|
---|
9602 | typename T17,
|
---|
9603 | typename T18,
|
---|
9604 | typename T19,
|
---|
9605 | typename T20,
|
---|
9606 | typename T21>
|
---|
9607 | struct functionImplementation_
|
---|
9608 | < T0,
|
---|
9609 | T1,
|
---|
9610 | T2,
|
---|
9611 | T3,
|
---|
9612 | T4,
|
---|
9613 | T5,
|
---|
9614 | T6,
|
---|
9615 | T7,
|
---|
9616 | T8,
|
---|
9617 | T9,
|
---|
9618 | T10,
|
---|
9619 | T11,
|
---|
9620 | T12,
|
---|
9621 | T13,
|
---|
9622 | T14,
|
---|
9623 | T15,
|
---|
9624 | T16,
|
---|
9625 | T17,
|
---|
9626 | T18,
|
---|
9627 | T19,
|
---|
9628 | T20,
|
---|
9629 | T21,
|
---|
9630 | NullType,
|
---|
9631 | NullType,
|
---|
9632 | NullType,
|
---|
9633 | NullType,
|
---|
9634 | NullType,
|
---|
9635 | NullType,
|
---|
9636 | NullType,
|
---|
9637 | NullType,
|
---|
9638 | NullType,
|
---|
9639 | NullType>
|
---|
9640 | {
|
---|
9641 | typedef detail::KernelFunctorGlobal<
|
---|
9642 | T0,
|
---|
9643 | T1,
|
---|
9644 | T2,
|
---|
9645 | T3,
|
---|
9646 | T4,
|
---|
9647 | T5,
|
---|
9648 | T6,
|
---|
9649 | T7,
|
---|
9650 | T8,
|
---|
9651 | T9,
|
---|
9652 | T10,
|
---|
9653 | T11,
|
---|
9654 | T12,
|
---|
9655 | T13,
|
---|
9656 | T14,
|
---|
9657 | T15,
|
---|
9658 | T16,
|
---|
9659 | T17,
|
---|
9660 | T18,
|
---|
9661 | T19,
|
---|
9662 | T20,
|
---|
9663 | T21,
|
---|
9664 | NullType,
|
---|
9665 | NullType,
|
---|
9666 | NullType,
|
---|
9667 | NullType,
|
---|
9668 | NullType,
|
---|
9669 | NullType,
|
---|
9670 | NullType,
|
---|
9671 | NullType,
|
---|
9672 | NullType,
|
---|
9673 | NullType> FunctorType;
|
---|
9674 |
|
---|
9675 | FunctorType functor_;
|
---|
9676 |
|
---|
9677 | functionImplementation_(const FunctorType &functor) :
|
---|
9678 | functor_(functor)
|
---|
9679 | {
|
---|
9680 |
|
---|
9681 | #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 22))
|
---|
9682 | // Fail variadic expansion for dev11
|
---|
9683 | static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
|
---|
9684 | #endif
|
---|
9685 |
|
---|
9686 | }
|
---|
9687 |
|
---|
9688 | //! \brief Return type of the functor
|
---|
9689 | typedef Event result_type;
|
---|
9690 |
|
---|
9691 | //! \brief Function signature of kernel functor with no event dependency.
|
---|
9692 | typedef Event type_(
|
---|
9693 | const EnqueueArgs&,
|
---|
9694 | T0,
|
---|
9695 | T1,
|
---|
9696 | T2,
|
---|
9697 | T3,
|
---|
9698 | T4,
|
---|
9699 | T5,
|
---|
9700 | T6,
|
---|
9701 | T7,
|
---|
9702 | T8,
|
---|
9703 | T9,
|
---|
9704 | T10,
|
---|
9705 | T11,
|
---|
9706 | T12,
|
---|
9707 | T13,
|
---|
9708 | T14,
|
---|
9709 | T15,
|
---|
9710 | T16,
|
---|
9711 | T17,
|
---|
9712 | T18,
|
---|
9713 | T19,
|
---|
9714 | T20,
|
---|
9715 | T21);
|
---|
9716 |
|
---|
9717 | Event operator()(
|
---|
9718 | const EnqueueArgs& enqueueArgs,
|
---|
9719 | T0 arg0,
|
---|
9720 | T1 arg1,
|
---|
9721 | T2 arg2,
|
---|
9722 | T3 arg3,
|
---|
9723 | T4 arg4,
|
---|
9724 | T5 arg5,
|
---|
9725 | T6 arg6,
|
---|
9726 | T7 arg7,
|
---|
9727 | T8 arg8,
|
---|
9728 | T9 arg9,
|
---|
9729 | T10 arg10,
|
---|
9730 | T11 arg11,
|
---|
9731 | T12 arg12,
|
---|
9732 | T13 arg13,
|
---|
9733 | T14 arg14,
|
---|
9734 | T15 arg15,
|
---|
9735 | T16 arg16,
|
---|
9736 | T17 arg17,
|
---|
9737 | T18 arg18,
|
---|
9738 | T19 arg19,
|
---|
9739 | T20 arg20,
|
---|
9740 | T21 arg21)
|
---|
9741 | {
|
---|
9742 | return functor_(
|
---|
9743 | enqueueArgs,
|
---|
9744 | arg0,
|
---|
9745 | arg1,
|
---|
9746 | arg2,
|
---|
9747 | arg3,
|
---|
9748 | arg4,
|
---|
9749 | arg5,
|
---|
9750 | arg6,
|
---|
9751 | arg7,
|
---|
9752 | arg8,
|
---|
9753 | arg9,
|
---|
9754 | arg10,
|
---|
9755 | arg11,
|
---|
9756 | arg12,
|
---|
9757 | arg13,
|
---|
9758 | arg14,
|
---|
9759 | arg15,
|
---|
9760 | arg16,
|
---|
9761 | arg17,
|
---|
9762 | arg18,
|
---|
9763 | arg19,
|
---|
9764 | arg20,
|
---|
9765 | arg21);
|
---|
9766 | }
|
---|
9767 |
|
---|
9768 |
|
---|
9769 | };
|
---|
9770 |
|
---|
9771 | template<
|
---|
9772 | typename T0,
|
---|
9773 | typename T1,
|
---|
9774 | typename T2,
|
---|
9775 | typename T3,
|
---|
9776 | typename T4,
|
---|
9777 | typename T5,
|
---|
9778 | typename T6,
|
---|
9779 | typename T7,
|
---|
9780 | typename T8,
|
---|
9781 | typename T9,
|
---|
9782 | typename T10,
|
---|
9783 | typename T11,
|
---|
9784 | typename T12,
|
---|
9785 | typename T13,
|
---|
9786 | typename T14,
|
---|
9787 | typename T15,
|
---|
9788 | typename T16,
|
---|
9789 | typename T17,
|
---|
9790 | typename T18,
|
---|
9791 | typename T19,
|
---|
9792 | typename T20>
|
---|
9793 | struct functionImplementation_
|
---|
9794 | < T0,
|
---|
9795 | T1,
|
---|
9796 | T2,
|
---|
9797 | T3,
|
---|
9798 | T4,
|
---|
9799 | T5,
|
---|
9800 | T6,
|
---|
9801 | T7,
|
---|
9802 | T8,
|
---|
9803 | T9,
|
---|
9804 | T10,
|
---|
9805 | T11,
|
---|
9806 | T12,
|
---|
9807 | T13,
|
---|
9808 | T14,
|
---|
9809 | T15,
|
---|
9810 | T16,
|
---|
9811 | T17,
|
---|
9812 | T18,
|
---|
9813 | T19,
|
---|
9814 | T20,
|
---|
9815 | NullType,
|
---|
9816 | NullType,
|
---|
9817 | NullType,
|
---|
9818 | NullType,
|
---|
9819 | NullType,
|
---|
9820 | NullType,
|
---|
9821 | NullType,
|
---|
9822 | NullType,
|
---|
9823 | NullType,
|
---|
9824 | NullType,
|
---|
9825 | NullType>
|
---|
9826 | {
|
---|
9827 | typedef detail::KernelFunctorGlobal<
|
---|
9828 | T0,
|
---|
9829 | T1,
|
---|
9830 | T2,
|
---|
9831 | T3,
|
---|
9832 | T4,
|
---|
9833 | T5,
|
---|
9834 | T6,
|
---|
9835 | T7,
|
---|
9836 | T8,
|
---|
9837 | T9,
|
---|
9838 | T10,
|
---|
9839 | T11,
|
---|
9840 | T12,
|
---|
9841 | T13,
|
---|
9842 | T14,
|
---|
9843 | T15,
|
---|
9844 | T16,
|
---|
9845 | T17,
|
---|
9846 | T18,
|
---|
9847 | T19,
|
---|
9848 | T20,
|
---|
9849 | NullType,
|
---|
9850 | NullType,
|
---|
9851 | NullType,
|
---|
9852 | NullType,
|
---|
9853 | NullType,
|
---|
9854 | NullType,
|
---|
9855 | NullType,
|
---|
9856 | NullType,
|
---|
9857 | NullType,
|
---|
9858 | NullType,
|
---|
9859 | NullType> FunctorType;
|
---|
9860 |
|
---|
9861 | FunctorType functor_;
|
---|
9862 |
|
---|
9863 | functionImplementation_(const FunctorType &functor) :
|
---|
9864 | functor_(functor)
|
---|
9865 | {
|
---|
9866 |
|
---|
9867 | #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 21))
|
---|
9868 | // Fail variadic expansion for dev11
|
---|
9869 | static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
|
---|
9870 | #endif
|
---|
9871 |
|
---|
9872 | }
|
---|
9873 |
|
---|
9874 | //! \brief Return type of the functor
|
---|
9875 | typedef Event result_type;
|
---|
9876 |
|
---|
9877 | //! \brief Function signature of kernel functor with no event dependency.
|
---|
9878 | typedef Event type_(
|
---|
9879 | const EnqueueArgs&,
|
---|
9880 | T0,
|
---|
9881 | T1,
|
---|
9882 | T2,
|
---|
9883 | T3,
|
---|
9884 | T4,
|
---|
9885 | T5,
|
---|
9886 | T6,
|
---|
9887 | T7,
|
---|
9888 | T8,
|
---|
9889 | T9,
|
---|
9890 | T10,
|
---|
9891 | T11,
|
---|
9892 | T12,
|
---|
9893 | T13,
|
---|
9894 | T14,
|
---|
9895 | T15,
|
---|
9896 | T16,
|
---|
9897 | T17,
|
---|
9898 | T18,
|
---|
9899 | T19,
|
---|
9900 | T20);
|
---|
9901 |
|
---|
9902 | Event operator()(
|
---|
9903 | const EnqueueArgs& enqueueArgs,
|
---|
9904 | T0 arg0,
|
---|
9905 | T1 arg1,
|
---|
9906 | T2 arg2,
|
---|
9907 | T3 arg3,
|
---|
9908 | T4 arg4,
|
---|
9909 | T5 arg5,
|
---|
9910 | T6 arg6,
|
---|
9911 | T7 arg7,
|
---|
9912 | T8 arg8,
|
---|
9913 | T9 arg9,
|
---|
9914 | T10 arg10,
|
---|
9915 | T11 arg11,
|
---|
9916 | T12 arg12,
|
---|
9917 | T13 arg13,
|
---|
9918 | T14 arg14,
|
---|
9919 | T15 arg15,
|
---|
9920 | T16 arg16,
|
---|
9921 | T17 arg17,
|
---|
9922 | T18 arg18,
|
---|
9923 | T19 arg19,
|
---|
9924 | T20 arg20)
|
---|
9925 | {
|
---|
9926 | return functor_(
|
---|
9927 | enqueueArgs,
|
---|
9928 | arg0,
|
---|
9929 | arg1,
|
---|
9930 | arg2,
|
---|
9931 | arg3,
|
---|
9932 | arg4,
|
---|
9933 | arg5,
|
---|
9934 | arg6,
|
---|
9935 | arg7,
|
---|
9936 | arg8,
|
---|
9937 | arg9,
|
---|
9938 | arg10,
|
---|
9939 | arg11,
|
---|
9940 | arg12,
|
---|
9941 | arg13,
|
---|
9942 | arg14,
|
---|
9943 | arg15,
|
---|
9944 | arg16,
|
---|
9945 | arg17,
|
---|
9946 | arg18,
|
---|
9947 | arg19,
|
---|
9948 | arg20);
|
---|
9949 | }
|
---|
9950 |
|
---|
9951 |
|
---|
9952 | };
|
---|
9953 |
|
---|
9954 | template<
|
---|
9955 | typename T0,
|
---|
9956 | typename T1,
|
---|
9957 | typename T2,
|
---|
9958 | typename T3,
|
---|
9959 | typename T4,
|
---|
9960 | typename T5,
|
---|
9961 | typename T6,
|
---|
9962 | typename T7,
|
---|
9963 | typename T8,
|
---|
9964 | typename T9,
|
---|
9965 | typename T10,
|
---|
9966 | typename T11,
|
---|
9967 | typename T12,
|
---|
9968 | typename T13,
|
---|
9969 | typename T14,
|
---|
9970 | typename T15,
|
---|
9971 | typename T16,
|
---|
9972 | typename T17,
|
---|
9973 | typename T18,
|
---|
9974 | typename T19>
|
---|
9975 | struct functionImplementation_
|
---|
9976 | < T0,
|
---|
9977 | T1,
|
---|
9978 | T2,
|
---|
9979 | T3,
|
---|
9980 | T4,
|
---|
9981 | T5,
|
---|
9982 | T6,
|
---|
9983 | T7,
|
---|
9984 | T8,
|
---|
9985 | T9,
|
---|
9986 | T10,
|
---|
9987 | T11,
|
---|
9988 | T12,
|
---|
9989 | T13,
|
---|
9990 | T14,
|
---|
9991 | T15,
|
---|
9992 | T16,
|
---|
9993 | T17,
|
---|
9994 | T18,
|
---|
9995 | T19,
|
---|
9996 | NullType,
|
---|
9997 | NullType,
|
---|
9998 | NullType,
|
---|
9999 | NullType,
|
---|
10000 | NullType,
|
---|
10001 | NullType,
|
---|
10002 | NullType,
|
---|
10003 | NullType,
|
---|
10004 | NullType,
|
---|
10005 | NullType,
|
---|
10006 | NullType,
|
---|
10007 | NullType>
|
---|
10008 | {
|
---|
10009 | typedef detail::KernelFunctorGlobal<
|
---|
10010 | T0,
|
---|
10011 | T1,
|
---|
10012 | T2,
|
---|
10013 | T3,
|
---|
10014 | T4,
|
---|
10015 | T5,
|
---|
10016 | T6,
|
---|
10017 | T7,
|
---|
10018 | T8,
|
---|
10019 | T9,
|
---|
10020 | T10,
|
---|
10021 | T11,
|
---|
10022 | T12,
|
---|
10023 | T13,
|
---|
10024 | T14,
|
---|
10025 | T15,
|
---|
10026 | T16,
|
---|
10027 | T17,
|
---|
10028 | T18,
|
---|
10029 | T19,
|
---|
10030 | NullType,
|
---|
10031 | NullType,
|
---|
10032 | NullType,
|
---|
10033 | NullType,
|
---|
10034 | NullType,
|
---|
10035 | NullType,
|
---|
10036 | NullType,
|
---|
10037 | NullType,
|
---|
10038 | NullType,
|
---|
10039 | NullType,
|
---|
10040 | NullType,
|
---|
10041 | NullType> FunctorType;
|
---|
10042 |
|
---|
10043 | FunctorType functor_;
|
---|
10044 |
|
---|
10045 | functionImplementation_(const FunctorType &functor) :
|
---|
10046 | functor_(functor)
|
---|
10047 | {
|
---|
10048 |
|
---|
10049 | #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 20))
|
---|
10050 | // Fail variadic expansion for dev11
|
---|
10051 | static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
|
---|
10052 | #endif
|
---|
10053 |
|
---|
10054 | }
|
---|
10055 |
|
---|
10056 | //! \brief Return type of the functor
|
---|
10057 | typedef Event result_type;
|
---|
10058 |
|
---|
10059 | //! \brief Function signature of kernel functor with no event dependency.
|
---|
10060 | typedef Event type_(
|
---|
10061 | const EnqueueArgs&,
|
---|
10062 | T0,
|
---|
10063 | T1,
|
---|
10064 | T2,
|
---|
10065 | T3,
|
---|
10066 | T4,
|
---|
10067 | T5,
|
---|
10068 | T6,
|
---|
10069 | T7,
|
---|
10070 | T8,
|
---|
10071 | T9,
|
---|
10072 | T10,
|
---|
10073 | T11,
|
---|
10074 | T12,
|
---|
10075 | T13,
|
---|
10076 | T14,
|
---|
10077 | T15,
|
---|
10078 | T16,
|
---|
10079 | T17,
|
---|
10080 | T18,
|
---|
10081 | T19);
|
---|
10082 |
|
---|
10083 | Event operator()(
|
---|
10084 | const EnqueueArgs& enqueueArgs,
|
---|
10085 | T0 arg0,
|
---|
10086 | T1 arg1,
|
---|
10087 | T2 arg2,
|
---|
10088 | T3 arg3,
|
---|
10089 | T4 arg4,
|
---|
10090 | T5 arg5,
|
---|
10091 | T6 arg6,
|
---|
10092 | T7 arg7,
|
---|
10093 | T8 arg8,
|
---|
10094 | T9 arg9,
|
---|
10095 | T10 arg10,
|
---|
10096 | T11 arg11,
|
---|
10097 | T12 arg12,
|
---|
10098 | T13 arg13,
|
---|
10099 | T14 arg14,
|
---|
10100 | T15 arg15,
|
---|
10101 | T16 arg16,
|
---|
10102 | T17 arg17,
|
---|
10103 | T18 arg18,
|
---|
10104 | T19 arg19)
|
---|
10105 | {
|
---|
10106 | return functor_(
|
---|
10107 | enqueueArgs,
|
---|
10108 | arg0,
|
---|
10109 | arg1,
|
---|
10110 | arg2,
|
---|
10111 | arg3,
|
---|
10112 | arg4,
|
---|
10113 | arg5,
|
---|
10114 | arg6,
|
---|
10115 | arg7,
|
---|
10116 | arg8,
|
---|
10117 | arg9,
|
---|
10118 | arg10,
|
---|
10119 | arg11,
|
---|
10120 | arg12,
|
---|
10121 | arg13,
|
---|
10122 | arg14,
|
---|
10123 | arg15,
|
---|
10124 | arg16,
|
---|
10125 | arg17,
|
---|
10126 | arg18,
|
---|
10127 | arg19);
|
---|
10128 | }
|
---|
10129 |
|
---|
10130 |
|
---|
10131 | };
|
---|
10132 |
|
---|
10133 | template<
|
---|
10134 | typename T0,
|
---|
10135 | typename T1,
|
---|
10136 | typename T2,
|
---|
10137 | typename T3,
|
---|
10138 | typename T4,
|
---|
10139 | typename T5,
|
---|
10140 | typename T6,
|
---|
10141 | typename T7,
|
---|
10142 | typename T8,
|
---|
10143 | typename T9,
|
---|
10144 | typename T10,
|
---|
10145 | typename T11,
|
---|
10146 | typename T12,
|
---|
10147 | typename T13,
|
---|
10148 | typename T14,
|
---|
10149 | typename T15,
|
---|
10150 | typename T16,
|
---|
10151 | typename T17,
|
---|
10152 | typename T18>
|
---|
10153 | struct functionImplementation_
|
---|
10154 | < T0,
|
---|
10155 | T1,
|
---|
10156 | T2,
|
---|
10157 | T3,
|
---|
10158 | T4,
|
---|
10159 | T5,
|
---|
10160 | T6,
|
---|
10161 | T7,
|
---|
10162 | T8,
|
---|
10163 | T9,
|
---|
10164 | T10,
|
---|
10165 | T11,
|
---|
10166 | T12,
|
---|
10167 | T13,
|
---|
10168 | T14,
|
---|
10169 | T15,
|
---|
10170 | T16,
|
---|
10171 | T17,
|
---|
10172 | T18,
|
---|
10173 | NullType,
|
---|
10174 | NullType,
|
---|
10175 | NullType,
|
---|
10176 | NullType,
|
---|
10177 | NullType,
|
---|
10178 | NullType,
|
---|
10179 | NullType,
|
---|
10180 | NullType,
|
---|
10181 | NullType,
|
---|
10182 | NullType,
|
---|
10183 | NullType,
|
---|
10184 | NullType,
|
---|
10185 | NullType>
|
---|
10186 | {
|
---|
10187 | typedef detail::KernelFunctorGlobal<
|
---|
10188 | T0,
|
---|
10189 | T1,
|
---|
10190 | T2,
|
---|
10191 | T3,
|
---|
10192 | T4,
|
---|
10193 | T5,
|
---|
10194 | T6,
|
---|
10195 | T7,
|
---|
10196 | T8,
|
---|
10197 | T9,
|
---|
10198 | T10,
|
---|
10199 | T11,
|
---|
10200 | T12,
|
---|
10201 | T13,
|
---|
10202 | T14,
|
---|
10203 | T15,
|
---|
10204 | T16,
|
---|
10205 | T17,
|
---|
10206 | T18,
|
---|
10207 | NullType,
|
---|
10208 | NullType,
|
---|
10209 | NullType,
|
---|
10210 | NullType,
|
---|
10211 | NullType,
|
---|
10212 | NullType,
|
---|
10213 | NullType,
|
---|
10214 | NullType,
|
---|
10215 | NullType,
|
---|
10216 | NullType,
|
---|
10217 | NullType,
|
---|
10218 | NullType,
|
---|
10219 | NullType> FunctorType;
|
---|
10220 |
|
---|
10221 | FunctorType functor_;
|
---|
10222 |
|
---|
10223 | functionImplementation_(const FunctorType &functor) :
|
---|
10224 | functor_(functor)
|
---|
10225 | {
|
---|
10226 |
|
---|
10227 | #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 19))
|
---|
10228 | // Fail variadic expansion for dev11
|
---|
10229 | static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
|
---|
10230 | #endif
|
---|
10231 |
|
---|
10232 | }
|
---|
10233 |
|
---|
10234 | //! \brief Return type of the functor
|
---|
10235 | typedef Event result_type;
|
---|
10236 |
|
---|
10237 | //! \brief Function signature of kernel functor with no event dependency.
|
---|
10238 | typedef Event type_(
|
---|
10239 | const EnqueueArgs&,
|
---|
10240 | T0,
|
---|
10241 | T1,
|
---|
10242 | T2,
|
---|
10243 | T3,
|
---|
10244 | T4,
|
---|
10245 | T5,
|
---|
10246 | T6,
|
---|
10247 | T7,
|
---|
10248 | T8,
|
---|
10249 | T9,
|
---|
10250 | T10,
|
---|
10251 | T11,
|
---|
10252 | T12,
|
---|
10253 | T13,
|
---|
10254 | T14,
|
---|
10255 | T15,
|
---|
10256 | T16,
|
---|
10257 | T17,
|
---|
10258 | T18);
|
---|
10259 |
|
---|
10260 | Event operator()(
|
---|
10261 | const EnqueueArgs& enqueueArgs,
|
---|
10262 | T0 arg0,
|
---|
10263 | T1 arg1,
|
---|
10264 | T2 arg2,
|
---|
10265 | T3 arg3,
|
---|
10266 | T4 arg4,
|
---|
10267 | T5 arg5,
|
---|
10268 | T6 arg6,
|
---|
10269 | T7 arg7,
|
---|
10270 | T8 arg8,
|
---|
10271 | T9 arg9,
|
---|
10272 | T10 arg10,
|
---|
10273 | T11 arg11,
|
---|
10274 | T12 arg12,
|
---|
10275 | T13 arg13,
|
---|
10276 | T14 arg14,
|
---|
10277 | T15 arg15,
|
---|
10278 | T16 arg16,
|
---|
10279 | T17 arg17,
|
---|
10280 | T18 arg18)
|
---|
10281 | {
|
---|
10282 | return functor_(
|
---|
10283 | enqueueArgs,
|
---|
10284 | arg0,
|
---|
10285 | arg1,
|
---|
10286 | arg2,
|
---|
10287 | arg3,
|
---|
10288 | arg4,
|
---|
10289 | arg5,
|
---|
10290 | arg6,
|
---|
10291 | arg7,
|
---|
10292 | arg8,
|
---|
10293 | arg9,
|
---|
10294 | arg10,
|
---|
10295 | arg11,
|
---|
10296 | arg12,
|
---|
10297 | arg13,
|
---|
10298 | arg14,
|
---|
10299 | arg15,
|
---|
10300 | arg16,
|
---|
10301 | arg17,
|
---|
10302 | arg18);
|
---|
10303 | }
|
---|
10304 |
|
---|
10305 |
|
---|
10306 | };
|
---|
10307 |
|
---|
10308 | template<
|
---|
10309 | typename T0,
|
---|
10310 | typename T1,
|
---|
10311 | typename T2,
|
---|
10312 | typename T3,
|
---|
10313 | typename T4,
|
---|
10314 | typename T5,
|
---|
10315 | typename T6,
|
---|
10316 | typename T7,
|
---|
10317 | typename T8,
|
---|
10318 | typename T9,
|
---|
10319 | typename T10,
|
---|
10320 | typename T11,
|
---|
10321 | typename T12,
|
---|
10322 | typename T13,
|
---|
10323 | typename T14,
|
---|
10324 | typename T15,
|
---|
10325 | typename T16,
|
---|
10326 | typename T17>
|
---|
10327 | struct functionImplementation_
|
---|
10328 | < T0,
|
---|
10329 | T1,
|
---|
10330 | T2,
|
---|
10331 | T3,
|
---|
10332 | T4,
|
---|
10333 | T5,
|
---|
10334 | T6,
|
---|
10335 | T7,
|
---|
10336 | T8,
|
---|
10337 | T9,
|
---|
10338 | T10,
|
---|
10339 | T11,
|
---|
10340 | T12,
|
---|
10341 | T13,
|
---|
10342 | T14,
|
---|
10343 | T15,
|
---|
10344 | T16,
|
---|
10345 | T17,
|
---|
10346 | NullType,
|
---|
10347 | NullType,
|
---|
10348 | NullType,
|
---|
10349 | NullType,
|
---|
10350 | NullType,
|
---|
10351 | NullType,
|
---|
10352 | NullType,
|
---|
10353 | NullType,
|
---|
10354 | NullType,
|
---|
10355 | NullType,
|
---|
10356 | NullType,
|
---|
10357 | NullType,
|
---|
10358 | NullType,
|
---|
10359 | NullType>
|
---|
10360 | {
|
---|
10361 | typedef detail::KernelFunctorGlobal<
|
---|
10362 | T0,
|
---|
10363 | T1,
|
---|
10364 | T2,
|
---|
10365 | T3,
|
---|
10366 | T4,
|
---|
10367 | T5,
|
---|
10368 | T6,
|
---|
10369 | T7,
|
---|
10370 | T8,
|
---|
10371 | T9,
|
---|
10372 | T10,
|
---|
10373 | T11,
|
---|
10374 | T12,
|
---|
10375 | T13,
|
---|
10376 | T14,
|
---|
10377 | T15,
|
---|
10378 | T16,
|
---|
10379 | T17,
|
---|
10380 | NullType,
|
---|
10381 | NullType,
|
---|
10382 | NullType,
|
---|
10383 | NullType,
|
---|
10384 | NullType,
|
---|
10385 | NullType,
|
---|
10386 | NullType,
|
---|
10387 | NullType,
|
---|
10388 | NullType,
|
---|
10389 | NullType,
|
---|
10390 | NullType,
|
---|
10391 | NullType,
|
---|
10392 | NullType,
|
---|
10393 | NullType> FunctorType;
|
---|
10394 |
|
---|
10395 | FunctorType functor_;
|
---|
10396 |
|
---|
10397 | functionImplementation_(const FunctorType &functor) :
|
---|
10398 | functor_(functor)
|
---|
10399 | {
|
---|
10400 |
|
---|
10401 | #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 18))
|
---|
10402 | // Fail variadic expansion for dev11
|
---|
10403 | static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
|
---|
10404 | #endif
|
---|
10405 |
|
---|
10406 | }
|
---|
10407 |
|
---|
10408 | //! \brief Return type of the functor
|
---|
10409 | typedef Event result_type;
|
---|
10410 |
|
---|
10411 | //! \brief Function signature of kernel functor with no event dependency.
|
---|
10412 | typedef Event type_(
|
---|
10413 | const EnqueueArgs&,
|
---|
10414 | T0,
|
---|
10415 | T1,
|
---|
10416 | T2,
|
---|
10417 | T3,
|
---|
10418 | T4,
|
---|
10419 | T5,
|
---|
10420 | T6,
|
---|
10421 | T7,
|
---|
10422 | T8,
|
---|
10423 | T9,
|
---|
10424 | T10,
|
---|
10425 | T11,
|
---|
10426 | T12,
|
---|
10427 | T13,
|
---|
10428 | T14,
|
---|
10429 | T15,
|
---|
10430 | T16,
|
---|
10431 | T17);
|
---|
10432 |
|
---|
10433 | Event operator()(
|
---|
10434 | const EnqueueArgs& enqueueArgs,
|
---|
10435 | T0 arg0,
|
---|
10436 | T1 arg1,
|
---|
10437 | T2 arg2,
|
---|
10438 | T3 arg3,
|
---|
10439 | T4 arg4,
|
---|
10440 | T5 arg5,
|
---|
10441 | T6 arg6,
|
---|
10442 | T7 arg7,
|
---|
10443 | T8 arg8,
|
---|
10444 | T9 arg9,
|
---|
10445 | T10 arg10,
|
---|
10446 | T11 arg11,
|
---|
10447 | T12 arg12,
|
---|
10448 | T13 arg13,
|
---|
10449 | T14 arg14,
|
---|
10450 | T15 arg15,
|
---|
10451 | T16 arg16,
|
---|
10452 | T17 arg17)
|
---|
10453 | {
|
---|
10454 | return functor_(
|
---|
10455 | enqueueArgs,
|
---|
10456 | arg0,
|
---|
10457 | arg1,
|
---|
10458 | arg2,
|
---|
10459 | arg3,
|
---|
10460 | arg4,
|
---|
10461 | arg5,
|
---|
10462 | arg6,
|
---|
10463 | arg7,
|
---|
10464 | arg8,
|
---|
10465 | arg9,
|
---|
10466 | arg10,
|
---|
10467 | arg11,
|
---|
10468 | arg12,
|
---|
10469 | arg13,
|
---|
10470 | arg14,
|
---|
10471 | arg15,
|
---|
10472 | arg16,
|
---|
10473 | arg17);
|
---|
10474 | }
|
---|
10475 |
|
---|
10476 |
|
---|
10477 | };
|
---|
10478 |
|
---|
10479 | template<
|
---|
10480 | typename T0,
|
---|
10481 | typename T1,
|
---|
10482 | typename T2,
|
---|
10483 | typename T3,
|
---|
10484 | typename T4,
|
---|
10485 | typename T5,
|
---|
10486 | typename T6,
|
---|
10487 | typename T7,
|
---|
10488 | typename T8,
|
---|
10489 | typename T9,
|
---|
10490 | typename T10,
|
---|
10491 | typename T11,
|
---|
10492 | typename T12,
|
---|
10493 | typename T13,
|
---|
10494 | typename T14,
|
---|
10495 | typename T15,
|
---|
10496 | typename T16>
|
---|
10497 | struct functionImplementation_
|
---|
10498 | < T0,
|
---|
10499 | T1,
|
---|
10500 | T2,
|
---|
10501 | T3,
|
---|
10502 | T4,
|
---|
10503 | T5,
|
---|
10504 | T6,
|
---|
10505 | T7,
|
---|
10506 | T8,
|
---|
10507 | T9,
|
---|
10508 | T10,
|
---|
10509 | T11,
|
---|
10510 | T12,
|
---|
10511 | T13,
|
---|
10512 | T14,
|
---|
10513 | T15,
|
---|
10514 | T16,
|
---|
10515 | NullType,
|
---|
10516 | NullType,
|
---|
10517 | NullType,
|
---|
10518 | NullType,
|
---|
10519 | NullType,
|
---|
10520 | NullType,
|
---|
10521 | NullType,
|
---|
10522 | NullType,
|
---|
10523 | NullType,
|
---|
10524 | NullType,
|
---|
10525 | NullType,
|
---|
10526 | NullType,
|
---|
10527 | NullType,
|
---|
10528 | NullType,
|
---|
10529 | NullType>
|
---|
10530 | {
|
---|
10531 | typedef detail::KernelFunctorGlobal<
|
---|
10532 | T0,
|
---|
10533 | T1,
|
---|
10534 | T2,
|
---|
10535 | T3,
|
---|
10536 | T4,
|
---|
10537 | T5,
|
---|
10538 | T6,
|
---|
10539 | T7,
|
---|
10540 | T8,
|
---|
10541 | T9,
|
---|
10542 | T10,
|
---|
10543 | T11,
|
---|
10544 | T12,
|
---|
10545 | T13,
|
---|
10546 | T14,
|
---|
10547 | T15,
|
---|
10548 | T16,
|
---|
10549 | NullType,
|
---|
10550 | NullType,
|
---|
10551 | NullType,
|
---|
10552 | NullType,
|
---|
10553 | NullType,
|
---|
10554 | NullType,
|
---|
10555 | NullType,
|
---|
10556 | NullType,
|
---|
10557 | NullType,
|
---|
10558 | NullType,
|
---|
10559 | NullType,
|
---|
10560 | NullType,
|
---|
10561 | NullType,
|
---|
10562 | NullType,
|
---|
10563 | NullType> FunctorType;
|
---|
10564 |
|
---|
10565 | FunctorType functor_;
|
---|
10566 |
|
---|
10567 | functionImplementation_(const FunctorType &functor) :
|
---|
10568 | functor_(functor)
|
---|
10569 | {
|
---|
10570 |
|
---|
10571 | #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 17))
|
---|
10572 | // Fail variadic expansion for dev11
|
---|
10573 | static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
|
---|
10574 | #endif
|
---|
10575 |
|
---|
10576 | }
|
---|
10577 |
|
---|
10578 | //! \brief Return type of the functor
|
---|
10579 | typedef Event result_type;
|
---|
10580 |
|
---|
10581 | //! \brief Function signature of kernel functor with no event dependency.
|
---|
10582 | typedef Event type_(
|
---|
10583 | const EnqueueArgs&,
|
---|
10584 | T0,
|
---|
10585 | T1,
|
---|
10586 | T2,
|
---|
10587 | T3,
|
---|
10588 | T4,
|
---|
10589 | T5,
|
---|
10590 | T6,
|
---|
10591 | T7,
|
---|
10592 | T8,
|
---|
10593 | T9,
|
---|
10594 | T10,
|
---|
10595 | T11,
|
---|
10596 | T12,
|
---|
10597 | T13,
|
---|
10598 | T14,
|
---|
10599 | T15,
|
---|
10600 | T16);
|
---|
10601 |
|
---|
10602 | Event operator()(
|
---|
10603 | const EnqueueArgs& enqueueArgs,
|
---|
10604 | T0 arg0,
|
---|
10605 | T1 arg1,
|
---|
10606 | T2 arg2,
|
---|
10607 | T3 arg3,
|
---|
10608 | T4 arg4,
|
---|
10609 | T5 arg5,
|
---|
10610 | T6 arg6,
|
---|
10611 | T7 arg7,
|
---|
10612 | T8 arg8,
|
---|
10613 | T9 arg9,
|
---|
10614 | T10 arg10,
|
---|
10615 | T11 arg11,
|
---|
10616 | T12 arg12,
|
---|
10617 | T13 arg13,
|
---|
10618 | T14 arg14,
|
---|
10619 | T15 arg15,
|
---|
10620 | T16 arg16)
|
---|
10621 | {
|
---|
10622 | return functor_(
|
---|
10623 | enqueueArgs,
|
---|
10624 | arg0,
|
---|
10625 | arg1,
|
---|
10626 | arg2,
|
---|
10627 | arg3,
|
---|
10628 | arg4,
|
---|
10629 | arg5,
|
---|
10630 | arg6,
|
---|
10631 | arg7,
|
---|
10632 | arg8,
|
---|
10633 | arg9,
|
---|
10634 | arg10,
|
---|
10635 | arg11,
|
---|
10636 | arg12,
|
---|
10637 | arg13,
|
---|
10638 | arg14,
|
---|
10639 | arg15,
|
---|
10640 | arg16);
|
---|
10641 | }
|
---|
10642 |
|
---|
10643 |
|
---|
10644 | };
|
---|
10645 |
|
---|
10646 | template<
|
---|
10647 | typename T0,
|
---|
10648 | typename T1,
|
---|
10649 | typename T2,
|
---|
10650 | typename T3,
|
---|
10651 | typename T4,
|
---|
10652 | typename T5,
|
---|
10653 | typename T6,
|
---|
10654 | typename T7,
|
---|
10655 | typename T8,
|
---|
10656 | typename T9,
|
---|
10657 | typename T10,
|
---|
10658 | typename T11,
|
---|
10659 | typename T12,
|
---|
10660 | typename T13,
|
---|
10661 | typename T14,
|
---|
10662 | typename T15>
|
---|
10663 | struct functionImplementation_
|
---|
10664 | < T0,
|
---|
10665 | T1,
|
---|
10666 | T2,
|
---|
10667 | T3,
|
---|
10668 | T4,
|
---|
10669 | T5,
|
---|
10670 | T6,
|
---|
10671 | T7,
|
---|
10672 | T8,
|
---|
10673 | T9,
|
---|
10674 | T10,
|
---|
10675 | T11,
|
---|
10676 | T12,
|
---|
10677 | T13,
|
---|
10678 | T14,
|
---|
10679 | T15,
|
---|
10680 | NullType,
|
---|
10681 | NullType,
|
---|
10682 | NullType,
|
---|
10683 | NullType,
|
---|
10684 | NullType,
|
---|
10685 | NullType,
|
---|
10686 | NullType,
|
---|
10687 | NullType,
|
---|
10688 | NullType,
|
---|
10689 | NullType,
|
---|
10690 | NullType,
|
---|
10691 | NullType,
|
---|
10692 | NullType,
|
---|
10693 | NullType,
|
---|
10694 | NullType,
|
---|
10695 | NullType>
|
---|
10696 | {
|
---|
10697 | typedef detail::KernelFunctorGlobal<
|
---|
10698 | T0,
|
---|
10699 | T1,
|
---|
10700 | T2,
|
---|
10701 | T3,
|
---|
10702 | T4,
|
---|
10703 | T5,
|
---|
10704 | T6,
|
---|
10705 | T7,
|
---|
10706 | T8,
|
---|
10707 | T9,
|
---|
10708 | T10,
|
---|
10709 | T11,
|
---|
10710 | T12,
|
---|
10711 | T13,
|
---|
10712 | T14,
|
---|
10713 | T15,
|
---|
10714 | NullType,
|
---|
10715 | NullType,
|
---|
10716 | NullType,
|
---|
10717 | NullType,
|
---|
10718 | NullType,
|
---|
10719 | NullType,
|
---|
10720 | NullType,
|
---|
10721 | NullType,
|
---|
10722 | NullType,
|
---|
10723 | NullType,
|
---|
10724 | NullType,
|
---|
10725 | NullType,
|
---|
10726 | NullType,
|
---|
10727 | NullType,
|
---|
10728 | NullType,
|
---|
10729 | NullType> FunctorType;
|
---|
10730 |
|
---|
10731 | FunctorType functor_;
|
---|
10732 |
|
---|
10733 | functionImplementation_(const FunctorType &functor) :
|
---|
10734 | functor_(functor)
|
---|
10735 | {
|
---|
10736 |
|
---|
10737 | #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 16))
|
---|
10738 | // Fail variadic expansion for dev11
|
---|
10739 | static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
|
---|
10740 | #endif
|
---|
10741 |
|
---|
10742 | }
|
---|
10743 |
|
---|
10744 | //! \brief Return type of the functor
|
---|
10745 | typedef Event result_type;
|
---|
10746 |
|
---|
10747 | //! \brief Function signature of kernel functor with no event dependency.
|
---|
10748 | typedef Event type_(
|
---|
10749 | const EnqueueArgs&,
|
---|
10750 | T0,
|
---|
10751 | T1,
|
---|
10752 | T2,
|
---|
10753 | T3,
|
---|
10754 | T4,
|
---|
10755 | T5,
|
---|
10756 | T6,
|
---|
10757 | T7,
|
---|
10758 | T8,
|
---|
10759 | T9,
|
---|
10760 | T10,
|
---|
10761 | T11,
|
---|
10762 | T12,
|
---|
10763 | T13,
|
---|
10764 | T14,
|
---|
10765 | T15);
|
---|
10766 |
|
---|
10767 | Event operator()(
|
---|
10768 | const EnqueueArgs& enqueueArgs,
|
---|
10769 | T0 arg0,
|
---|
10770 | T1 arg1,
|
---|
10771 | T2 arg2,
|
---|
10772 | T3 arg3,
|
---|
10773 | T4 arg4,
|
---|
10774 | T5 arg5,
|
---|
10775 | T6 arg6,
|
---|
10776 | T7 arg7,
|
---|
10777 | T8 arg8,
|
---|
10778 | T9 arg9,
|
---|
10779 | T10 arg10,
|
---|
10780 | T11 arg11,
|
---|
10781 | T12 arg12,
|
---|
10782 | T13 arg13,
|
---|
10783 | T14 arg14,
|
---|
10784 | T15 arg15)
|
---|
10785 | {
|
---|
10786 | return functor_(
|
---|
10787 | enqueueArgs,
|
---|
10788 | arg0,
|
---|
10789 | arg1,
|
---|
10790 | arg2,
|
---|
10791 | arg3,
|
---|
10792 | arg4,
|
---|
10793 | arg5,
|
---|
10794 | arg6,
|
---|
10795 | arg7,
|
---|
10796 | arg8,
|
---|
10797 | arg9,
|
---|
10798 | arg10,
|
---|
10799 | arg11,
|
---|
10800 | arg12,
|
---|
10801 | arg13,
|
---|
10802 | arg14,
|
---|
10803 | arg15);
|
---|
10804 | }
|
---|
10805 |
|
---|
10806 |
|
---|
10807 | };
|
---|
10808 |
|
---|
10809 | template<
|
---|
10810 | typename T0,
|
---|
10811 | typename T1,
|
---|
10812 | typename T2,
|
---|
10813 | typename T3,
|
---|
10814 | typename T4,
|
---|
10815 | typename T5,
|
---|
10816 | typename T6,
|
---|
10817 | typename T7,
|
---|
10818 | typename T8,
|
---|
10819 | typename T9,
|
---|
10820 | typename T10,
|
---|
10821 | typename T11,
|
---|
10822 | typename T12,
|
---|
10823 | typename T13,
|
---|
10824 | typename T14>
|
---|
10825 | struct functionImplementation_
|
---|
10826 | < T0,
|
---|
10827 | T1,
|
---|
10828 | T2,
|
---|
10829 | T3,
|
---|
10830 | T4,
|
---|
10831 | T5,
|
---|
10832 | T6,
|
---|
10833 | T7,
|
---|
10834 | T8,
|
---|
10835 | T9,
|
---|
10836 | T10,
|
---|
10837 | T11,
|
---|
10838 | T12,
|
---|
10839 | T13,
|
---|
10840 | T14,
|
---|
10841 | NullType,
|
---|
10842 | NullType,
|
---|
10843 | NullType,
|
---|
10844 | NullType,
|
---|
10845 | NullType,
|
---|
10846 | NullType,
|
---|
10847 | NullType,
|
---|
10848 | NullType,
|
---|
10849 | NullType,
|
---|
10850 | NullType,
|
---|
10851 | NullType,
|
---|
10852 | NullType,
|
---|
10853 | NullType,
|
---|
10854 | NullType,
|
---|
10855 | NullType,
|
---|
10856 | NullType,
|
---|
10857 | NullType>
|
---|
10858 | {
|
---|
10859 | typedef detail::KernelFunctorGlobal<
|
---|
10860 | T0,
|
---|
10861 | T1,
|
---|
10862 | T2,
|
---|
10863 | T3,
|
---|
10864 | T4,
|
---|
10865 | T5,
|
---|
10866 | T6,
|
---|
10867 | T7,
|
---|
10868 | T8,
|
---|
10869 | T9,
|
---|
10870 | T10,
|
---|
10871 | T11,
|
---|
10872 | T12,
|
---|
10873 | T13,
|
---|
10874 | T14,
|
---|
10875 | NullType,
|
---|
10876 | NullType,
|
---|
10877 | NullType,
|
---|
10878 | NullType,
|
---|
10879 | NullType,
|
---|
10880 | NullType,
|
---|
10881 | NullType,
|
---|
10882 | NullType,
|
---|
10883 | NullType,
|
---|
10884 | NullType,
|
---|
10885 | NullType,
|
---|
10886 | NullType,
|
---|
10887 | NullType,
|
---|
10888 | NullType,
|
---|
10889 | NullType,
|
---|
10890 | NullType,
|
---|
10891 | NullType> FunctorType;
|
---|
10892 |
|
---|
10893 | FunctorType functor_;
|
---|
10894 |
|
---|
10895 | functionImplementation_(const FunctorType &functor) :
|
---|
10896 | functor_(functor)
|
---|
10897 | {
|
---|
10898 |
|
---|
10899 | #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 15))
|
---|
10900 | // Fail variadic expansion for dev11
|
---|
10901 | static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
|
---|
10902 | #endif
|
---|
10903 |
|
---|
10904 | }
|
---|
10905 |
|
---|
10906 | //! \brief Return type of the functor
|
---|
10907 | typedef Event result_type;
|
---|
10908 |
|
---|
10909 | //! \brief Function signature of kernel functor with no event dependency.
|
---|
10910 | typedef Event type_(
|
---|
10911 | const EnqueueArgs&,
|
---|
10912 | T0,
|
---|
10913 | T1,
|
---|
10914 | T2,
|
---|
10915 | T3,
|
---|
10916 | T4,
|
---|
10917 | T5,
|
---|
10918 | T6,
|
---|
10919 | T7,
|
---|
10920 | T8,
|
---|
10921 | T9,
|
---|
10922 | T10,
|
---|
10923 | T11,
|
---|
10924 | T12,
|
---|
10925 | T13,
|
---|
10926 | T14);
|
---|
10927 |
|
---|
10928 | Event operator()(
|
---|
10929 | const EnqueueArgs& enqueueArgs,
|
---|
10930 | T0 arg0,
|
---|
10931 | T1 arg1,
|
---|
10932 | T2 arg2,
|
---|
10933 | T3 arg3,
|
---|
10934 | T4 arg4,
|
---|
10935 | T5 arg5,
|
---|
10936 | T6 arg6,
|
---|
10937 | T7 arg7,
|
---|
10938 | T8 arg8,
|
---|
10939 | T9 arg9,
|
---|
10940 | T10 arg10,
|
---|
10941 | T11 arg11,
|
---|
10942 | T12 arg12,
|
---|
10943 | T13 arg13,
|
---|
10944 | T14 arg14)
|
---|
10945 | {
|
---|
10946 | return functor_(
|
---|
10947 | enqueueArgs,
|
---|
10948 | arg0,
|
---|
10949 | arg1,
|
---|
10950 | arg2,
|
---|
10951 | arg3,
|
---|
10952 | arg4,
|
---|
10953 | arg5,
|
---|
10954 | arg6,
|
---|
10955 | arg7,
|
---|
10956 | arg8,
|
---|
10957 | arg9,
|
---|
10958 | arg10,
|
---|
10959 | arg11,
|
---|
10960 | arg12,
|
---|
10961 | arg13,
|
---|
10962 | arg14);
|
---|
10963 | }
|
---|
10964 |
|
---|
10965 |
|
---|
10966 | };
|
---|
10967 |
|
---|
10968 | template<
|
---|
10969 | typename T0,
|
---|
10970 | typename T1,
|
---|
10971 | typename T2,
|
---|
10972 | typename T3,
|
---|
10973 | typename T4,
|
---|
10974 | typename T5,
|
---|
10975 | typename T6,
|
---|
10976 | typename T7,
|
---|
10977 | typename T8,
|
---|
10978 | typename T9,
|
---|
10979 | typename T10,
|
---|
10980 | typename T11,
|
---|
10981 | typename T12,
|
---|
10982 | typename T13>
|
---|
10983 | struct functionImplementation_
|
---|
10984 | < T0,
|
---|
10985 | T1,
|
---|
10986 | T2,
|
---|
10987 | T3,
|
---|
10988 | T4,
|
---|
10989 | T5,
|
---|
10990 | T6,
|
---|
10991 | T7,
|
---|
10992 | T8,
|
---|
10993 | T9,
|
---|
10994 | T10,
|
---|
10995 | T11,
|
---|
10996 | T12,
|
---|
10997 | T13,
|
---|
10998 | NullType,
|
---|
10999 | NullType,
|
---|
11000 | NullType,
|
---|
11001 | NullType,
|
---|
11002 | NullType,
|
---|
11003 | NullType,
|
---|
11004 | NullType,
|
---|
11005 | NullType,
|
---|
11006 | NullType,
|
---|
11007 | NullType,
|
---|
11008 | NullType,
|
---|
11009 | NullType,
|
---|
11010 | NullType,
|
---|
11011 | NullType,
|
---|
11012 | NullType,
|
---|
11013 | NullType,
|
---|
11014 | NullType,
|
---|
11015 | NullType>
|
---|
11016 | {
|
---|
11017 | typedef detail::KernelFunctorGlobal<
|
---|
11018 | T0,
|
---|
11019 | T1,
|
---|
11020 | T2,
|
---|
11021 | T3,
|
---|
11022 | T4,
|
---|
11023 | T5,
|
---|
11024 | T6,
|
---|
11025 | T7,
|
---|
11026 | T8,
|
---|
11027 | T9,
|
---|
11028 | T10,
|
---|
11029 | T11,
|
---|
11030 | T12,
|
---|
11031 | T13,
|
---|
11032 | NullType,
|
---|
11033 | NullType,
|
---|
11034 | NullType,
|
---|
11035 | NullType,
|
---|
11036 | NullType,
|
---|
11037 | NullType,
|
---|
11038 | NullType,
|
---|
11039 | NullType,
|
---|
11040 | NullType,
|
---|
11041 | NullType,
|
---|
11042 | NullType,
|
---|
11043 | NullType,
|
---|
11044 | NullType,
|
---|
11045 | NullType,
|
---|
11046 | NullType,
|
---|
11047 | NullType,
|
---|
11048 | NullType,
|
---|
11049 | NullType> FunctorType;
|
---|
11050 |
|
---|
11051 | FunctorType functor_;
|
---|
11052 |
|
---|
11053 | functionImplementation_(const FunctorType &functor) :
|
---|
11054 | functor_(functor)
|
---|
11055 | {
|
---|
11056 |
|
---|
11057 | #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 14))
|
---|
11058 | // Fail variadic expansion for dev11
|
---|
11059 | static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
|
---|
11060 | #endif
|
---|
11061 |
|
---|
11062 | }
|
---|
11063 |
|
---|
11064 | //! \brief Return type of the functor
|
---|
11065 | typedef Event result_type;
|
---|
11066 |
|
---|
11067 | //! \brief Function signature of kernel functor with no event dependency.
|
---|
11068 | typedef Event type_(
|
---|
11069 | const EnqueueArgs&,
|
---|
11070 | T0,
|
---|
11071 | T1,
|
---|
11072 | T2,
|
---|
11073 | T3,
|
---|
11074 | T4,
|
---|
11075 | T5,
|
---|
11076 | T6,
|
---|
11077 | T7,
|
---|
11078 | T8,
|
---|
11079 | T9,
|
---|
11080 | T10,
|
---|
11081 | T11,
|
---|
11082 | T12,
|
---|
11083 | T13);
|
---|
11084 |
|
---|
11085 | Event operator()(
|
---|
11086 | const EnqueueArgs& enqueueArgs,
|
---|
11087 | T0 arg0,
|
---|
11088 | T1 arg1,
|
---|
11089 | T2 arg2,
|
---|
11090 | T3 arg3,
|
---|
11091 | T4 arg4,
|
---|
11092 | T5 arg5,
|
---|
11093 | T6 arg6,
|
---|
11094 | T7 arg7,
|
---|
11095 | T8 arg8,
|
---|
11096 | T9 arg9,
|
---|
11097 | T10 arg10,
|
---|
11098 | T11 arg11,
|
---|
11099 | T12 arg12,
|
---|
11100 | T13 arg13)
|
---|
11101 | {
|
---|
11102 | return functor_(
|
---|
11103 | enqueueArgs,
|
---|
11104 | arg0,
|
---|
11105 | arg1,
|
---|
11106 | arg2,
|
---|
11107 | arg3,
|
---|
11108 | arg4,
|
---|
11109 | arg5,
|
---|
11110 | arg6,
|
---|
11111 | arg7,
|
---|
11112 | arg8,
|
---|
11113 | arg9,
|
---|
11114 | arg10,
|
---|
11115 | arg11,
|
---|
11116 | arg12,
|
---|
11117 | arg13);
|
---|
11118 | }
|
---|
11119 |
|
---|
11120 |
|
---|
11121 | };
|
---|
11122 |
|
---|
11123 | template<
|
---|
11124 | typename T0,
|
---|
11125 | typename T1,
|
---|
11126 | typename T2,
|
---|
11127 | typename T3,
|
---|
11128 | typename T4,
|
---|
11129 | typename T5,
|
---|
11130 | typename T6,
|
---|
11131 | typename T7,
|
---|
11132 | typename T8,
|
---|
11133 | typename T9,
|
---|
11134 | typename T10,
|
---|
11135 | typename T11,
|
---|
11136 | typename T12>
|
---|
11137 | struct functionImplementation_
|
---|
11138 | < T0,
|
---|
11139 | T1,
|
---|
11140 | T2,
|
---|
11141 | T3,
|
---|
11142 | T4,
|
---|
11143 | T5,
|
---|
11144 | T6,
|
---|
11145 | T7,
|
---|
11146 | T8,
|
---|
11147 | T9,
|
---|
11148 | T10,
|
---|
11149 | T11,
|
---|
11150 | T12,
|
---|
11151 | NullType,
|
---|
11152 | NullType,
|
---|
11153 | NullType,
|
---|
11154 | NullType,
|
---|
11155 | NullType,
|
---|
11156 | NullType,
|
---|
11157 | NullType,
|
---|
11158 | NullType,
|
---|
11159 | NullType,
|
---|
11160 | NullType,
|
---|
11161 | NullType,
|
---|
11162 | NullType,
|
---|
11163 | NullType,
|
---|
11164 | NullType,
|
---|
11165 | NullType,
|
---|
11166 | NullType,
|
---|
11167 | NullType,
|
---|
11168 | NullType,
|
---|
11169 | NullType>
|
---|
11170 | {
|
---|
11171 | typedef detail::KernelFunctorGlobal<
|
---|
11172 | T0,
|
---|
11173 | T1,
|
---|
11174 | T2,
|
---|
11175 | T3,
|
---|
11176 | T4,
|
---|
11177 | T5,
|
---|
11178 | T6,
|
---|
11179 | T7,
|
---|
11180 | T8,
|
---|
11181 | T9,
|
---|
11182 | T10,
|
---|
11183 | T11,
|
---|
11184 | T12,
|
---|
11185 | NullType,
|
---|
11186 | NullType,
|
---|
11187 | NullType,
|
---|
11188 | NullType,
|
---|
11189 | NullType,
|
---|
11190 | NullType,
|
---|
11191 | NullType,
|
---|
11192 | NullType,
|
---|
11193 | NullType,
|
---|
11194 | NullType,
|
---|
11195 | NullType,
|
---|
11196 | NullType,
|
---|
11197 | NullType,
|
---|
11198 | NullType,
|
---|
11199 | NullType,
|
---|
11200 | NullType,
|
---|
11201 | NullType,
|
---|
11202 | NullType,
|
---|
11203 | NullType> FunctorType;
|
---|
11204 |
|
---|
11205 | FunctorType functor_;
|
---|
11206 |
|
---|
11207 | functionImplementation_(const FunctorType &functor) :
|
---|
11208 | functor_(functor)
|
---|
11209 | {
|
---|
11210 |
|
---|
11211 | #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 13))
|
---|
11212 | // Fail variadic expansion for dev11
|
---|
11213 | static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
|
---|
11214 | #endif
|
---|
11215 |
|
---|
11216 | }
|
---|
11217 |
|
---|
11218 | //! \brief Return type of the functor
|
---|
11219 | typedef Event result_type;
|
---|
11220 |
|
---|
11221 | //! \brief Function signature of kernel functor with no event dependency.
|
---|
11222 | typedef Event type_(
|
---|
11223 | const EnqueueArgs&,
|
---|
11224 | T0,
|
---|
11225 | T1,
|
---|
11226 | T2,
|
---|
11227 | T3,
|
---|
11228 | T4,
|
---|
11229 | T5,
|
---|
11230 | T6,
|
---|
11231 | T7,
|
---|
11232 | T8,
|
---|
11233 | T9,
|
---|
11234 | T10,
|
---|
11235 | T11,
|
---|
11236 | T12);
|
---|
11237 |
|
---|
11238 | Event operator()(
|
---|
11239 | const EnqueueArgs& enqueueArgs,
|
---|
11240 | T0 arg0,
|
---|
11241 | T1 arg1,
|
---|
11242 | T2 arg2,
|
---|
11243 | T3 arg3,
|
---|
11244 | T4 arg4,
|
---|
11245 | T5 arg5,
|
---|
11246 | T6 arg6,
|
---|
11247 | T7 arg7,
|
---|
11248 | T8 arg8,
|
---|
11249 | T9 arg9,
|
---|
11250 | T10 arg10,
|
---|
11251 | T11 arg11,
|
---|
11252 | T12 arg12)
|
---|
11253 | {
|
---|
11254 | return functor_(
|
---|
11255 | enqueueArgs,
|
---|
11256 | arg0,
|
---|
11257 | arg1,
|
---|
11258 | arg2,
|
---|
11259 | arg3,
|
---|
11260 | arg4,
|
---|
11261 | arg5,
|
---|
11262 | arg6,
|
---|
11263 | arg7,
|
---|
11264 | arg8,
|
---|
11265 | arg9,
|
---|
11266 | arg10,
|
---|
11267 | arg11,
|
---|
11268 | arg12);
|
---|
11269 | }
|
---|
11270 |
|
---|
11271 |
|
---|
11272 | };
|
---|
11273 |
|
---|
11274 | template<
|
---|
11275 | typename T0,
|
---|
11276 | typename T1,
|
---|
11277 | typename T2,
|
---|
11278 | typename T3,
|
---|
11279 | typename T4,
|
---|
11280 | typename T5,
|
---|
11281 | typename T6,
|
---|
11282 | typename T7,
|
---|
11283 | typename T8,
|
---|
11284 | typename T9,
|
---|
11285 | typename T10,
|
---|
11286 | typename T11>
|
---|
11287 | struct functionImplementation_
|
---|
11288 | < T0,
|
---|
11289 | T1,
|
---|
11290 | T2,
|
---|
11291 | T3,
|
---|
11292 | T4,
|
---|
11293 | T5,
|
---|
11294 | T6,
|
---|
11295 | T7,
|
---|
11296 | T8,
|
---|
11297 | T9,
|
---|
11298 | T10,
|
---|
11299 | T11,
|
---|
11300 | NullType,
|
---|
11301 | NullType,
|
---|
11302 | NullType,
|
---|
11303 | NullType,
|
---|
11304 | NullType,
|
---|
11305 | NullType,
|
---|
11306 | NullType,
|
---|
11307 | NullType,
|
---|
11308 | NullType,
|
---|
11309 | NullType,
|
---|
11310 | NullType,
|
---|
11311 | NullType,
|
---|
11312 | NullType,
|
---|
11313 | NullType,
|
---|
11314 | NullType,
|
---|
11315 | NullType,
|
---|
11316 | NullType,
|
---|
11317 | NullType,
|
---|
11318 | NullType,
|
---|
11319 | NullType>
|
---|
11320 | {
|
---|
11321 | typedef detail::KernelFunctorGlobal<
|
---|
11322 | T0,
|
---|
11323 | T1,
|
---|
11324 | T2,
|
---|
11325 | T3,
|
---|
11326 | T4,
|
---|
11327 | T5,
|
---|
11328 | T6,
|
---|
11329 | T7,
|
---|
11330 | T8,
|
---|
11331 | T9,
|
---|
11332 | T10,
|
---|
11333 | T11,
|
---|
11334 | NullType,
|
---|
11335 | NullType,
|
---|
11336 | NullType,
|
---|
11337 | NullType,
|
---|
11338 | NullType,
|
---|
11339 | NullType,
|
---|
11340 | NullType,
|
---|
11341 | NullType,
|
---|
11342 | NullType,
|
---|
11343 | NullType,
|
---|
11344 | NullType,
|
---|
11345 | NullType,
|
---|
11346 | NullType,
|
---|
11347 | NullType,
|
---|
11348 | NullType,
|
---|
11349 | NullType,
|
---|
11350 | NullType,
|
---|
11351 | NullType,
|
---|
11352 | NullType,
|
---|
11353 | NullType> FunctorType;
|
---|
11354 |
|
---|
11355 | FunctorType functor_;
|
---|
11356 |
|
---|
11357 | functionImplementation_(const FunctorType &functor) :
|
---|
11358 | functor_(functor)
|
---|
11359 | {
|
---|
11360 |
|
---|
11361 | #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 12))
|
---|
11362 | // Fail variadic expansion for dev11
|
---|
11363 | static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
|
---|
11364 | #endif
|
---|
11365 |
|
---|
11366 | }
|
---|
11367 |
|
---|
11368 | //! \brief Return type of the functor
|
---|
11369 | typedef Event result_type;
|
---|
11370 |
|
---|
11371 | //! \brief Function signature of kernel functor with no event dependency.
|
---|
11372 | typedef Event type_(
|
---|
11373 | const EnqueueArgs&,
|
---|
11374 | T0,
|
---|
11375 | T1,
|
---|
11376 | T2,
|
---|
11377 | T3,
|
---|
11378 | T4,
|
---|
11379 | T5,
|
---|
11380 | T6,
|
---|
11381 | T7,
|
---|
11382 | T8,
|
---|
11383 | T9,
|
---|
11384 | T10,
|
---|
11385 | T11);
|
---|
11386 |
|
---|
11387 | Event operator()(
|
---|
11388 | const EnqueueArgs& enqueueArgs,
|
---|
11389 | T0 arg0,
|
---|
11390 | T1 arg1,
|
---|
11391 | T2 arg2,
|
---|
11392 | T3 arg3,
|
---|
11393 | T4 arg4,
|
---|
11394 | T5 arg5,
|
---|
11395 | T6 arg6,
|
---|
11396 | T7 arg7,
|
---|
11397 | T8 arg8,
|
---|
11398 | T9 arg9,
|
---|
11399 | T10 arg10,
|
---|
11400 | T11 arg11)
|
---|
11401 | {
|
---|
11402 | return functor_(
|
---|
11403 | enqueueArgs,
|
---|
11404 | arg0,
|
---|
11405 | arg1,
|
---|
11406 | arg2,
|
---|
11407 | arg3,
|
---|
11408 | arg4,
|
---|
11409 | arg5,
|
---|
11410 | arg6,
|
---|
11411 | arg7,
|
---|
11412 | arg8,
|
---|
11413 | arg9,
|
---|
11414 | arg10,
|
---|
11415 | arg11);
|
---|
11416 | }
|
---|
11417 |
|
---|
11418 |
|
---|
11419 | };
|
---|
11420 |
|
---|
11421 | template<
|
---|
11422 | typename T0,
|
---|
11423 | typename T1,
|
---|
11424 | typename T2,
|
---|
11425 | typename T3,
|
---|
11426 | typename T4,
|
---|
11427 | typename T5,
|
---|
11428 | typename T6,
|
---|
11429 | typename T7,
|
---|
11430 | typename T8,
|
---|
11431 | typename T9,
|
---|
11432 | typename T10>
|
---|
11433 | struct functionImplementation_
|
---|
11434 | < T0,
|
---|
11435 | T1,
|
---|
11436 | T2,
|
---|
11437 | T3,
|
---|
11438 | T4,
|
---|
11439 | T5,
|
---|
11440 | T6,
|
---|
11441 | T7,
|
---|
11442 | T8,
|
---|
11443 | T9,
|
---|
11444 | T10,
|
---|
11445 | NullType,
|
---|
11446 | NullType,
|
---|
11447 | NullType,
|
---|
11448 | NullType,
|
---|
11449 | NullType,
|
---|
11450 | NullType,
|
---|
11451 | NullType,
|
---|
11452 | NullType,
|
---|
11453 | NullType,
|
---|
11454 | NullType,
|
---|
11455 | NullType,
|
---|
11456 | NullType,
|
---|
11457 | NullType,
|
---|
11458 | NullType,
|
---|
11459 | NullType,
|
---|
11460 | NullType,
|
---|
11461 | NullType,
|
---|
11462 | NullType,
|
---|
11463 | NullType,
|
---|
11464 | NullType,
|
---|
11465 | NullType>
|
---|
11466 | {
|
---|
11467 | typedef detail::KernelFunctorGlobal<
|
---|
11468 | T0,
|
---|
11469 | T1,
|
---|
11470 | T2,
|
---|
11471 | T3,
|
---|
11472 | T4,
|
---|
11473 | T5,
|
---|
11474 | T6,
|
---|
11475 | T7,
|
---|
11476 | T8,
|
---|
11477 | T9,
|
---|
11478 | T10,
|
---|
11479 | NullType,
|
---|
11480 | NullType,
|
---|
11481 | NullType,
|
---|
11482 | NullType,
|
---|
11483 | NullType,
|
---|
11484 | NullType,
|
---|
11485 | NullType,
|
---|
11486 | NullType,
|
---|
11487 | NullType,
|
---|
11488 | NullType,
|
---|
11489 | NullType,
|
---|
11490 | NullType,
|
---|
11491 | NullType,
|
---|
11492 | NullType,
|
---|
11493 | NullType,
|
---|
11494 | NullType,
|
---|
11495 | NullType,
|
---|
11496 | NullType,
|
---|
11497 | NullType,
|
---|
11498 | NullType,
|
---|
11499 | NullType> FunctorType;
|
---|
11500 |
|
---|
11501 | FunctorType functor_;
|
---|
11502 |
|
---|
11503 | functionImplementation_(const FunctorType &functor) :
|
---|
11504 | functor_(functor)
|
---|
11505 | {
|
---|
11506 |
|
---|
11507 | #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 11))
|
---|
11508 | // Fail variadic expansion for dev11
|
---|
11509 | static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
|
---|
11510 | #endif
|
---|
11511 |
|
---|
11512 | }
|
---|
11513 |
|
---|
11514 | //! \brief Return type of the functor
|
---|
11515 | typedef Event result_type;
|
---|
11516 |
|
---|
11517 | //! \brief Function signature of kernel functor with no event dependency.
|
---|
11518 | typedef Event type_(
|
---|
11519 | const EnqueueArgs&,
|
---|
11520 | T0,
|
---|
11521 | T1,
|
---|
11522 | T2,
|
---|
11523 | T3,
|
---|
11524 | T4,
|
---|
11525 | T5,
|
---|
11526 | T6,
|
---|
11527 | T7,
|
---|
11528 | T8,
|
---|
11529 | T9,
|
---|
11530 | T10);
|
---|
11531 |
|
---|
11532 | Event operator()(
|
---|
11533 | const EnqueueArgs& enqueueArgs,
|
---|
11534 | T0 arg0,
|
---|
11535 | T1 arg1,
|
---|
11536 | T2 arg2,
|
---|
11537 | T3 arg3,
|
---|
11538 | T4 arg4,
|
---|
11539 | T5 arg5,
|
---|
11540 | T6 arg6,
|
---|
11541 | T7 arg7,
|
---|
11542 | T8 arg8,
|
---|
11543 | T9 arg9,
|
---|
11544 | T10 arg10)
|
---|
11545 | {
|
---|
11546 | return functor_(
|
---|
11547 | enqueueArgs,
|
---|
11548 | arg0,
|
---|
11549 | arg1,
|
---|
11550 | arg2,
|
---|
11551 | arg3,
|
---|
11552 | arg4,
|
---|
11553 | arg5,
|
---|
11554 | arg6,
|
---|
11555 | arg7,
|
---|
11556 | arg8,
|
---|
11557 | arg9,
|
---|
11558 | arg10);
|
---|
11559 | }
|
---|
11560 |
|
---|
11561 |
|
---|
11562 | };
|
---|
11563 |
|
---|
11564 | template<
|
---|
11565 | typename T0,
|
---|
11566 | typename T1,
|
---|
11567 | typename T2,
|
---|
11568 | typename T3,
|
---|
11569 | typename T4,
|
---|
11570 | typename T5,
|
---|
11571 | typename T6,
|
---|
11572 | typename T7,
|
---|
11573 | typename T8,
|
---|
11574 | typename T9>
|
---|
11575 | struct functionImplementation_
|
---|
11576 | < T0,
|
---|
11577 | T1,
|
---|
11578 | T2,
|
---|
11579 | T3,
|
---|
11580 | T4,
|
---|
11581 | T5,
|
---|
11582 | T6,
|
---|
11583 | T7,
|
---|
11584 | T8,
|
---|
11585 | T9,
|
---|
11586 | NullType,
|
---|
11587 | NullType,
|
---|
11588 | NullType,
|
---|
11589 | NullType,
|
---|
11590 | NullType,
|
---|
11591 | NullType,
|
---|
11592 | NullType,
|
---|
11593 | NullType,
|
---|
11594 | NullType,
|
---|
11595 | NullType,
|
---|
11596 | NullType,
|
---|
11597 | NullType,
|
---|
11598 | NullType,
|
---|
11599 | NullType,
|
---|
11600 | NullType,
|
---|
11601 | NullType,
|
---|
11602 | NullType,
|
---|
11603 | NullType,
|
---|
11604 | NullType,
|
---|
11605 | NullType,
|
---|
11606 | NullType,
|
---|
11607 | NullType>
|
---|
11608 | {
|
---|
11609 | typedef detail::KernelFunctorGlobal<
|
---|
11610 | T0,
|
---|
11611 | T1,
|
---|
11612 | T2,
|
---|
11613 | T3,
|
---|
11614 | T4,
|
---|
11615 | T5,
|
---|
11616 | T6,
|
---|
11617 | T7,
|
---|
11618 | T8,
|
---|
11619 | T9,
|
---|
11620 | NullType,
|
---|
11621 | NullType,
|
---|
11622 | NullType,
|
---|
11623 | NullType,
|
---|
11624 | NullType,
|
---|
11625 | NullType,
|
---|
11626 | NullType,
|
---|
11627 | NullType,
|
---|
11628 | NullType,
|
---|
11629 | NullType,
|
---|
11630 | NullType,
|
---|
11631 | NullType,
|
---|
11632 | NullType,
|
---|
11633 | NullType,
|
---|
11634 | NullType,
|
---|
11635 | NullType,
|
---|
11636 | NullType,
|
---|
11637 | NullType,
|
---|
11638 | NullType,
|
---|
11639 | NullType,
|
---|
11640 | NullType,
|
---|
11641 | NullType> FunctorType;
|
---|
11642 |
|
---|
11643 | FunctorType functor_;
|
---|
11644 |
|
---|
11645 | functionImplementation_(const FunctorType &functor) :
|
---|
11646 | functor_(functor)
|
---|
11647 | {
|
---|
11648 |
|
---|
11649 | #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 10))
|
---|
11650 | // Fail variadic expansion for dev11
|
---|
11651 | static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
|
---|
11652 | #endif
|
---|
11653 |
|
---|
11654 | }
|
---|
11655 |
|
---|
11656 | //! \brief Return type of the functor
|
---|
11657 | typedef Event result_type;
|
---|
11658 |
|
---|
11659 | //! \brief Function signature of kernel functor with no event dependency.
|
---|
11660 | typedef Event type_(
|
---|
11661 | const EnqueueArgs&,
|
---|
11662 | T0,
|
---|
11663 | T1,
|
---|
11664 | T2,
|
---|
11665 | T3,
|
---|
11666 | T4,
|
---|
11667 | T5,
|
---|
11668 | T6,
|
---|
11669 | T7,
|
---|
11670 | T8,
|
---|
11671 | T9);
|
---|
11672 |
|
---|
11673 | Event operator()(
|
---|
11674 | const EnqueueArgs& enqueueArgs,
|
---|
11675 | T0 arg0,
|
---|
11676 | T1 arg1,
|
---|
11677 | T2 arg2,
|
---|
11678 | T3 arg3,
|
---|
11679 | T4 arg4,
|
---|
11680 | T5 arg5,
|
---|
11681 | T6 arg6,
|
---|
11682 | T7 arg7,
|
---|
11683 | T8 arg8,
|
---|
11684 | T9 arg9)
|
---|
11685 | {
|
---|
11686 | return functor_(
|
---|
11687 | enqueueArgs,
|
---|
11688 | arg0,
|
---|
11689 | arg1,
|
---|
11690 | arg2,
|
---|
11691 | arg3,
|
---|
11692 | arg4,
|
---|
11693 | arg5,
|
---|
11694 | arg6,
|
---|
11695 | arg7,
|
---|
11696 | arg8,
|
---|
11697 | arg9);
|
---|
11698 | }
|
---|
11699 |
|
---|
11700 |
|
---|
11701 | };
|
---|
11702 |
|
---|
11703 | template<
|
---|
11704 | typename T0,
|
---|
11705 | typename T1,
|
---|
11706 | typename T2,
|
---|
11707 | typename T3,
|
---|
11708 | typename T4,
|
---|
11709 | typename T5,
|
---|
11710 | typename T6,
|
---|
11711 | typename T7,
|
---|
11712 | typename T8>
|
---|
11713 | struct functionImplementation_
|
---|
11714 | < T0,
|
---|
11715 | T1,
|
---|
11716 | T2,
|
---|
11717 | T3,
|
---|
11718 | T4,
|
---|
11719 | T5,
|
---|
11720 | T6,
|
---|
11721 | T7,
|
---|
11722 | T8,
|
---|
11723 | NullType,
|
---|
11724 | NullType,
|
---|
11725 | NullType,
|
---|
11726 | NullType,
|
---|
11727 | NullType,
|
---|
11728 | NullType,
|
---|
11729 | NullType,
|
---|
11730 | NullType,
|
---|
11731 | NullType,
|
---|
11732 | NullType,
|
---|
11733 | NullType,
|
---|
11734 | NullType,
|
---|
11735 | NullType,
|
---|
11736 | NullType,
|
---|
11737 | NullType,
|
---|
11738 | NullType,
|
---|
11739 | NullType,
|
---|
11740 | NullType,
|
---|
11741 | NullType,
|
---|
11742 | NullType,
|
---|
11743 | NullType,
|
---|
11744 | NullType,
|
---|
11745 | NullType>
|
---|
11746 | {
|
---|
11747 | typedef detail::KernelFunctorGlobal<
|
---|
11748 | T0,
|
---|
11749 | T1,
|
---|
11750 | T2,
|
---|
11751 | T3,
|
---|
11752 | T4,
|
---|
11753 | T5,
|
---|
11754 | T6,
|
---|
11755 | T7,
|
---|
11756 | T8,
|
---|
11757 | NullType,
|
---|
11758 | NullType,
|
---|
11759 | NullType,
|
---|
11760 | NullType,
|
---|
11761 | NullType,
|
---|
11762 | NullType,
|
---|
11763 | NullType,
|
---|
11764 | NullType,
|
---|
11765 | NullType,
|
---|
11766 | NullType,
|
---|
11767 | NullType,
|
---|
11768 | NullType,
|
---|
11769 | NullType,
|
---|
11770 | NullType,
|
---|
11771 | NullType,
|
---|
11772 | NullType,
|
---|
11773 | NullType,
|
---|
11774 | NullType,
|
---|
11775 | NullType,
|
---|
11776 | NullType,
|
---|
11777 | NullType,
|
---|
11778 | NullType,
|
---|
11779 | NullType> FunctorType;
|
---|
11780 |
|
---|
11781 | FunctorType functor_;
|
---|
11782 |
|
---|
11783 | functionImplementation_(const FunctorType &functor) :
|
---|
11784 | functor_(functor)
|
---|
11785 | {
|
---|
11786 |
|
---|
11787 | #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 9))
|
---|
11788 | // Fail variadic expansion for dev11
|
---|
11789 | static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
|
---|
11790 | #endif
|
---|
11791 |
|
---|
11792 | }
|
---|
11793 |
|
---|
11794 | //! \brief Return type of the functor
|
---|
11795 | typedef Event result_type;
|
---|
11796 |
|
---|
11797 | //! \brief Function signature of kernel functor with no event dependency.
|
---|
11798 | typedef Event type_(
|
---|
11799 | const EnqueueArgs&,
|
---|
11800 | T0,
|
---|
11801 | T1,
|
---|
11802 | T2,
|
---|
11803 | T3,
|
---|
11804 | T4,
|
---|
11805 | T5,
|
---|
11806 | T6,
|
---|
11807 | T7,
|
---|
11808 | T8);
|
---|
11809 |
|
---|
11810 | Event operator()(
|
---|
11811 | const EnqueueArgs& enqueueArgs,
|
---|
11812 | T0 arg0,
|
---|
11813 | T1 arg1,
|
---|
11814 | T2 arg2,
|
---|
11815 | T3 arg3,
|
---|
11816 | T4 arg4,
|
---|
11817 | T5 arg5,
|
---|
11818 | T6 arg6,
|
---|
11819 | T7 arg7,
|
---|
11820 | T8 arg8)
|
---|
11821 | {
|
---|
11822 | return functor_(
|
---|
11823 | enqueueArgs,
|
---|
11824 | arg0,
|
---|
11825 | arg1,
|
---|
11826 | arg2,
|
---|
11827 | arg3,
|
---|
11828 | arg4,
|
---|
11829 | arg5,
|
---|
11830 | arg6,
|
---|
11831 | arg7,
|
---|
11832 | arg8);
|
---|
11833 | }
|
---|
11834 |
|
---|
11835 |
|
---|
11836 | };
|
---|
11837 |
|
---|
11838 | template<
|
---|
11839 | typename T0,
|
---|
11840 | typename T1,
|
---|
11841 | typename T2,
|
---|
11842 | typename T3,
|
---|
11843 | typename T4,
|
---|
11844 | typename T5,
|
---|
11845 | typename T6,
|
---|
11846 | typename T7>
|
---|
11847 | struct functionImplementation_
|
---|
11848 | < T0,
|
---|
11849 | T1,
|
---|
11850 | T2,
|
---|
11851 | T3,
|
---|
11852 | T4,
|
---|
11853 | T5,
|
---|
11854 | T6,
|
---|
11855 | T7,
|
---|
11856 | NullType,
|
---|
11857 | NullType,
|
---|
11858 | NullType,
|
---|
11859 | NullType,
|
---|
11860 | NullType,
|
---|
11861 | NullType,
|
---|
11862 | NullType,
|
---|
11863 | NullType,
|
---|
11864 | NullType,
|
---|
11865 | NullType,
|
---|
11866 | NullType,
|
---|
11867 | NullType,
|
---|
11868 | NullType,
|
---|
11869 | NullType,
|
---|
11870 | NullType,
|
---|
11871 | NullType,
|
---|
11872 | NullType,
|
---|
11873 | NullType,
|
---|
11874 | NullType,
|
---|
11875 | NullType,
|
---|
11876 | NullType,
|
---|
11877 | NullType,
|
---|
11878 | NullType,
|
---|
11879 | NullType>
|
---|
11880 | {
|
---|
11881 | typedef detail::KernelFunctorGlobal<
|
---|
11882 | T0,
|
---|
11883 | T1,
|
---|
11884 | T2,
|
---|
11885 | T3,
|
---|
11886 | T4,
|
---|
11887 | T5,
|
---|
11888 | T6,
|
---|
11889 | T7,
|
---|
11890 | NullType,
|
---|
11891 | NullType,
|
---|
11892 | NullType,
|
---|
11893 | NullType,
|
---|
11894 | NullType,
|
---|
11895 | NullType,
|
---|
11896 | NullType,
|
---|
11897 | NullType,
|
---|
11898 | NullType,
|
---|
11899 | NullType,
|
---|
11900 | NullType,
|
---|
11901 | NullType,
|
---|
11902 | NullType,
|
---|
11903 | NullType,
|
---|
11904 | NullType,
|
---|
11905 | NullType,
|
---|
11906 | NullType,
|
---|
11907 | NullType,
|
---|
11908 | NullType,
|
---|
11909 | NullType,
|
---|
11910 | NullType,
|
---|
11911 | NullType,
|
---|
11912 | NullType,
|
---|
11913 | NullType> FunctorType;
|
---|
11914 |
|
---|
11915 | FunctorType functor_;
|
---|
11916 |
|
---|
11917 | functionImplementation_(const FunctorType &functor) :
|
---|
11918 | functor_(functor)
|
---|
11919 | {
|
---|
11920 |
|
---|
11921 | #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 8))
|
---|
11922 | // Fail variadic expansion for dev11
|
---|
11923 | static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
|
---|
11924 | #endif
|
---|
11925 |
|
---|
11926 | }
|
---|
11927 |
|
---|
11928 | //! \brief Return type of the functor
|
---|
11929 | typedef Event result_type;
|
---|
11930 |
|
---|
11931 | //! \brief Function signature of kernel functor with no event dependency.
|
---|
11932 | typedef Event type_(
|
---|
11933 | const EnqueueArgs&,
|
---|
11934 | T0,
|
---|
11935 | T1,
|
---|
11936 | T2,
|
---|
11937 | T3,
|
---|
11938 | T4,
|
---|
11939 | T5,
|
---|
11940 | T6,
|
---|
11941 | T7);
|
---|
11942 |
|
---|
11943 | Event operator()(
|
---|
11944 | const EnqueueArgs& enqueueArgs,
|
---|
11945 | T0 arg0,
|
---|
11946 | T1 arg1,
|
---|
11947 | T2 arg2,
|
---|
11948 | T3 arg3,
|
---|
11949 | T4 arg4,
|
---|
11950 | T5 arg5,
|
---|
11951 | T6 arg6,
|
---|
11952 | T7 arg7)
|
---|
11953 | {
|
---|
11954 | return functor_(
|
---|
11955 | enqueueArgs,
|
---|
11956 | arg0,
|
---|
11957 | arg1,
|
---|
11958 | arg2,
|
---|
11959 | arg3,
|
---|
11960 | arg4,
|
---|
11961 | arg5,
|
---|
11962 | arg6,
|
---|
11963 | arg7);
|
---|
11964 | }
|
---|
11965 |
|
---|
11966 |
|
---|
11967 | };
|
---|
11968 |
|
---|
11969 | template<
|
---|
11970 | typename T0,
|
---|
11971 | typename T1,
|
---|
11972 | typename T2,
|
---|
11973 | typename T3,
|
---|
11974 | typename T4,
|
---|
11975 | typename T5,
|
---|
11976 | typename T6>
|
---|
11977 | struct functionImplementation_
|
---|
11978 | < T0,
|
---|
11979 | T1,
|
---|
11980 | T2,
|
---|
11981 | T3,
|
---|
11982 | T4,
|
---|
11983 | T5,
|
---|
11984 | T6,
|
---|
11985 | NullType,
|
---|
11986 | NullType,
|
---|
11987 | NullType,
|
---|
11988 | NullType,
|
---|
11989 | NullType,
|
---|
11990 | NullType,
|
---|
11991 | NullType,
|
---|
11992 | NullType,
|
---|
11993 | NullType,
|
---|
11994 | NullType,
|
---|
11995 | NullType,
|
---|
11996 | NullType,
|
---|
11997 | NullType,
|
---|
11998 | NullType,
|
---|
11999 | NullType,
|
---|
12000 | NullType,
|
---|
12001 | NullType,
|
---|
12002 | NullType,
|
---|
12003 | NullType,
|
---|
12004 | NullType,
|
---|
12005 | NullType,
|
---|
12006 | NullType,
|
---|
12007 | NullType,
|
---|
12008 | NullType,
|
---|
12009 | NullType>
|
---|
12010 | {
|
---|
12011 | typedef detail::KernelFunctorGlobal<
|
---|
12012 | T0,
|
---|
12013 | T1,
|
---|
12014 | T2,
|
---|
12015 | T3,
|
---|
12016 | T4,
|
---|
12017 | T5,
|
---|
12018 | T6,
|
---|
12019 | NullType,
|
---|
12020 | NullType,
|
---|
12021 | NullType,
|
---|
12022 | NullType,
|
---|
12023 | NullType,
|
---|
12024 | NullType,
|
---|
12025 | NullType,
|
---|
12026 | NullType,
|
---|
12027 | NullType,
|
---|
12028 | NullType,
|
---|
12029 | NullType,
|
---|
12030 | NullType,
|
---|
12031 | NullType,
|
---|
12032 | NullType,
|
---|
12033 | NullType,
|
---|
12034 | NullType,
|
---|
12035 | NullType,
|
---|
12036 | NullType,
|
---|
12037 | NullType,
|
---|
12038 | NullType,
|
---|
12039 | NullType,
|
---|
12040 | NullType,
|
---|
12041 | NullType,
|
---|
12042 | NullType,
|
---|
12043 | NullType> FunctorType;
|
---|
12044 |
|
---|
12045 | FunctorType functor_;
|
---|
12046 |
|
---|
12047 | functionImplementation_(const FunctorType &functor) :
|
---|
12048 | functor_(functor)
|
---|
12049 | {
|
---|
12050 |
|
---|
12051 | #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 7))
|
---|
12052 | // Fail variadic expansion for dev11
|
---|
12053 | static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
|
---|
12054 | #endif
|
---|
12055 |
|
---|
12056 | }
|
---|
12057 |
|
---|
12058 | //! \brief Return type of the functor
|
---|
12059 | typedef Event result_type;
|
---|
12060 |
|
---|
12061 | //! \brief Function signature of kernel functor with no event dependency.
|
---|
12062 | typedef Event type_(
|
---|
12063 | const EnqueueArgs&,
|
---|
12064 | T0,
|
---|
12065 | T1,
|
---|
12066 | T2,
|
---|
12067 | T3,
|
---|
12068 | T4,
|
---|
12069 | T5,
|
---|
12070 | T6);
|
---|
12071 |
|
---|
12072 | Event operator()(
|
---|
12073 | const EnqueueArgs& enqueueArgs,
|
---|
12074 | T0 arg0,
|
---|
12075 | T1 arg1,
|
---|
12076 | T2 arg2,
|
---|
12077 | T3 arg3,
|
---|
12078 | T4 arg4,
|
---|
12079 | T5 arg5,
|
---|
12080 | T6 arg6)
|
---|
12081 | {
|
---|
12082 | return functor_(
|
---|
12083 | enqueueArgs,
|
---|
12084 | arg0,
|
---|
12085 | arg1,
|
---|
12086 | arg2,
|
---|
12087 | arg3,
|
---|
12088 | arg4,
|
---|
12089 | arg5,
|
---|
12090 | arg6);
|
---|
12091 | }
|
---|
12092 |
|
---|
12093 |
|
---|
12094 | };
|
---|
12095 |
|
---|
12096 | template<
|
---|
12097 | typename T0,
|
---|
12098 | typename T1,
|
---|
12099 | typename T2,
|
---|
12100 | typename T3,
|
---|
12101 | typename T4,
|
---|
12102 | typename T5>
|
---|
12103 | struct functionImplementation_
|
---|
12104 | < T0,
|
---|
12105 | T1,
|
---|
12106 | T2,
|
---|
12107 | T3,
|
---|
12108 | T4,
|
---|
12109 | T5,
|
---|
12110 | NullType,
|
---|
12111 | NullType,
|
---|
12112 | NullType,
|
---|
12113 | NullType,
|
---|
12114 | NullType,
|
---|
12115 | NullType,
|
---|
12116 | NullType,
|
---|
12117 | NullType,
|
---|
12118 | NullType,
|
---|
12119 | NullType,
|
---|
12120 | NullType,
|
---|
12121 | NullType,
|
---|
12122 | NullType,
|
---|
12123 | NullType,
|
---|
12124 | NullType,
|
---|
12125 | NullType,
|
---|
12126 | NullType,
|
---|
12127 | NullType,
|
---|
12128 | NullType,
|
---|
12129 | NullType,
|
---|
12130 | NullType,
|
---|
12131 | NullType,
|
---|
12132 | NullType,
|
---|
12133 | NullType,
|
---|
12134 | NullType,
|
---|
12135 | NullType>
|
---|
12136 | {
|
---|
12137 | typedef detail::KernelFunctorGlobal<
|
---|
12138 | T0,
|
---|
12139 | T1,
|
---|
12140 | T2,
|
---|
12141 | T3,
|
---|
12142 | T4,
|
---|
12143 | T5,
|
---|
12144 | NullType,
|
---|
12145 | NullType,
|
---|
12146 | NullType,
|
---|
12147 | NullType,
|
---|
12148 | NullType,
|
---|
12149 | NullType,
|
---|
12150 | NullType,
|
---|
12151 | NullType,
|
---|
12152 | NullType,
|
---|
12153 | NullType,
|
---|
12154 | NullType,
|
---|
12155 | NullType,
|
---|
12156 | NullType,
|
---|
12157 | NullType,
|
---|
12158 | NullType,
|
---|
12159 | NullType,
|
---|
12160 | NullType,
|
---|
12161 | NullType,
|
---|
12162 | NullType,
|
---|
12163 | NullType,
|
---|
12164 | NullType,
|
---|
12165 | NullType,
|
---|
12166 | NullType,
|
---|
12167 | NullType,
|
---|
12168 | NullType,
|
---|
12169 | NullType> FunctorType;
|
---|
12170 |
|
---|
12171 | FunctorType functor_;
|
---|
12172 |
|
---|
12173 | functionImplementation_(const FunctorType &functor) :
|
---|
12174 | functor_(functor)
|
---|
12175 | {
|
---|
12176 |
|
---|
12177 | #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 6))
|
---|
12178 | // Fail variadic expansion for dev11
|
---|
12179 | static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
|
---|
12180 | #endif
|
---|
12181 |
|
---|
12182 | }
|
---|
12183 |
|
---|
12184 | //! \brief Return type of the functor
|
---|
12185 | typedef Event result_type;
|
---|
12186 |
|
---|
12187 | //! \brief Function signature of kernel functor with no event dependency.
|
---|
12188 | typedef Event type_(
|
---|
12189 | const EnqueueArgs&,
|
---|
12190 | T0,
|
---|
12191 | T1,
|
---|
12192 | T2,
|
---|
12193 | T3,
|
---|
12194 | T4,
|
---|
12195 | T5);
|
---|
12196 |
|
---|
12197 | Event operator()(
|
---|
12198 | const EnqueueArgs& enqueueArgs,
|
---|
12199 | T0 arg0,
|
---|
12200 | T1 arg1,
|
---|
12201 | T2 arg2,
|
---|
12202 | T3 arg3,
|
---|
12203 | T4 arg4,
|
---|
12204 | T5 arg5)
|
---|
12205 | {
|
---|
12206 | return functor_(
|
---|
12207 | enqueueArgs,
|
---|
12208 | arg0,
|
---|
12209 | arg1,
|
---|
12210 | arg2,
|
---|
12211 | arg3,
|
---|
12212 | arg4,
|
---|
12213 | arg5);
|
---|
12214 | }
|
---|
12215 |
|
---|
12216 |
|
---|
12217 | };
|
---|
12218 |
|
---|
12219 | template<
|
---|
12220 | typename T0,
|
---|
12221 | typename T1,
|
---|
12222 | typename T2,
|
---|
12223 | typename T3,
|
---|
12224 | typename T4>
|
---|
12225 | struct functionImplementation_
|
---|
12226 | < T0,
|
---|
12227 | T1,
|
---|
12228 | T2,
|
---|
12229 | T3,
|
---|
12230 | T4,
|
---|
12231 | NullType,
|
---|
12232 | NullType,
|
---|
12233 | NullType,
|
---|
12234 | NullType,
|
---|
12235 | NullType,
|
---|
12236 | NullType,
|
---|
12237 | NullType,
|
---|
12238 | NullType,
|
---|
12239 | NullType,
|
---|
12240 | NullType,
|
---|
12241 | NullType,
|
---|
12242 | NullType,
|
---|
12243 | NullType,
|
---|
12244 | NullType,
|
---|
12245 | NullType,
|
---|
12246 | NullType,
|
---|
12247 | NullType,
|
---|
12248 | NullType,
|
---|
12249 | NullType,
|
---|
12250 | NullType,
|
---|
12251 | NullType,
|
---|
12252 | NullType,
|
---|
12253 | NullType,
|
---|
12254 | NullType,
|
---|
12255 | NullType,
|
---|
12256 | NullType,
|
---|
12257 | NullType>
|
---|
12258 | {
|
---|
12259 | typedef detail::KernelFunctorGlobal<
|
---|
12260 | T0,
|
---|
12261 | T1,
|
---|
12262 | T2,
|
---|
12263 | T3,
|
---|
12264 | T4,
|
---|
12265 | NullType,
|
---|
12266 | NullType,
|
---|
12267 | NullType,
|
---|
12268 | NullType,
|
---|
12269 | NullType,
|
---|
12270 | NullType,
|
---|
12271 | NullType,
|
---|
12272 | NullType,
|
---|
12273 | NullType,
|
---|
12274 | NullType,
|
---|
12275 | NullType,
|
---|
12276 | NullType,
|
---|
12277 | NullType,
|
---|
12278 | NullType,
|
---|
12279 | NullType,
|
---|
12280 | NullType,
|
---|
12281 | NullType,
|
---|
12282 | NullType,
|
---|
12283 | NullType,
|
---|
12284 | NullType,
|
---|
12285 | NullType,
|
---|
12286 | NullType,
|
---|
12287 | NullType,
|
---|
12288 | NullType,
|
---|
12289 | NullType,
|
---|
12290 | NullType,
|
---|
12291 | NullType> FunctorType;
|
---|
12292 |
|
---|
12293 | FunctorType functor_;
|
---|
12294 |
|
---|
12295 | functionImplementation_(const FunctorType &functor) :
|
---|
12296 | functor_(functor)
|
---|
12297 | {
|
---|
12298 |
|
---|
12299 | #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 5))
|
---|
12300 | // Fail variadic expansion for dev11
|
---|
12301 | static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
|
---|
12302 | #endif
|
---|
12303 |
|
---|
12304 | }
|
---|
12305 |
|
---|
12306 | //! \brief Return type of the functor
|
---|
12307 | typedef Event result_type;
|
---|
12308 |
|
---|
12309 | //! \brief Function signature of kernel functor with no event dependency.
|
---|
12310 | typedef Event type_(
|
---|
12311 | const EnqueueArgs&,
|
---|
12312 | T0,
|
---|
12313 | T1,
|
---|
12314 | T2,
|
---|
12315 | T3,
|
---|
12316 | T4);
|
---|
12317 |
|
---|
12318 | Event operator()(
|
---|
12319 | const EnqueueArgs& enqueueArgs,
|
---|
12320 | T0 arg0,
|
---|
12321 | T1 arg1,
|
---|
12322 | T2 arg2,
|
---|
12323 | T3 arg3,
|
---|
12324 | T4 arg4)
|
---|
12325 | {
|
---|
12326 | return functor_(
|
---|
12327 | enqueueArgs,
|
---|
12328 | arg0,
|
---|
12329 | arg1,
|
---|
12330 | arg2,
|
---|
12331 | arg3,
|
---|
12332 | arg4);
|
---|
12333 | }
|
---|
12334 |
|
---|
12335 |
|
---|
12336 | };
|
---|
12337 |
|
---|
12338 | template<
|
---|
12339 | typename T0,
|
---|
12340 | typename T1,
|
---|
12341 | typename T2,
|
---|
12342 | typename T3>
|
---|
12343 | struct functionImplementation_
|
---|
12344 | < T0,
|
---|
12345 | T1,
|
---|
12346 | T2,
|
---|
12347 | T3,
|
---|
12348 | NullType,
|
---|
12349 | NullType,
|
---|
12350 | NullType,
|
---|
12351 | NullType,
|
---|
12352 | NullType,
|
---|
12353 | NullType,
|
---|
12354 | NullType,
|
---|
12355 | NullType,
|
---|
12356 | NullType,
|
---|
12357 | NullType,
|
---|
12358 | NullType,
|
---|
12359 | NullType,
|
---|
12360 | NullType,
|
---|
12361 | NullType,
|
---|
12362 | NullType,
|
---|
12363 | NullType,
|
---|
12364 | NullType,
|
---|
12365 | NullType,
|
---|
12366 | NullType,
|
---|
12367 | NullType,
|
---|
12368 | NullType,
|
---|
12369 | NullType,
|
---|
12370 | NullType,
|
---|
12371 | NullType,
|
---|
12372 | NullType,
|
---|
12373 | NullType,
|
---|
12374 | NullType,
|
---|
12375 | NullType>
|
---|
12376 | {
|
---|
12377 | typedef detail::KernelFunctorGlobal<
|
---|
12378 | T0,
|
---|
12379 | T1,
|
---|
12380 | T2,
|
---|
12381 | T3,
|
---|
12382 | NullType,
|
---|
12383 | NullType,
|
---|
12384 | NullType,
|
---|
12385 | NullType,
|
---|
12386 | NullType,
|
---|
12387 | NullType,
|
---|
12388 | NullType,
|
---|
12389 | NullType,
|
---|
12390 | NullType,
|
---|
12391 | NullType,
|
---|
12392 | NullType,
|
---|
12393 | NullType,
|
---|
12394 | NullType,
|
---|
12395 | NullType,
|
---|
12396 | NullType,
|
---|
12397 | NullType,
|
---|
12398 | NullType,
|
---|
12399 | NullType,
|
---|
12400 | NullType,
|
---|
12401 | NullType,
|
---|
12402 | NullType,
|
---|
12403 | NullType,
|
---|
12404 | NullType,
|
---|
12405 | NullType,
|
---|
12406 | NullType,
|
---|
12407 | NullType,
|
---|
12408 | NullType,
|
---|
12409 | NullType> FunctorType;
|
---|
12410 |
|
---|
12411 | FunctorType functor_;
|
---|
12412 |
|
---|
12413 | functionImplementation_(const FunctorType &functor) :
|
---|
12414 | functor_(functor)
|
---|
12415 | {
|
---|
12416 |
|
---|
12417 | #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 4))
|
---|
12418 | // Fail variadic expansion for dev11
|
---|
12419 | static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
|
---|
12420 | #endif
|
---|
12421 |
|
---|
12422 | }
|
---|
12423 |
|
---|
12424 | //! \brief Return type of the functor
|
---|
12425 | typedef Event result_type;
|
---|
12426 |
|
---|
12427 | //! \brief Function signature of kernel functor with no event dependency.
|
---|
12428 | typedef Event type_(
|
---|
12429 | const EnqueueArgs&,
|
---|
12430 | T0,
|
---|
12431 | T1,
|
---|
12432 | T2,
|
---|
12433 | T3);
|
---|
12434 |
|
---|
12435 | Event operator()(
|
---|
12436 | const EnqueueArgs& enqueueArgs,
|
---|
12437 | T0 arg0,
|
---|
12438 | T1 arg1,
|
---|
12439 | T2 arg2,
|
---|
12440 | T3 arg3)
|
---|
12441 | {
|
---|
12442 | return functor_(
|
---|
12443 | enqueueArgs,
|
---|
12444 | arg0,
|
---|
12445 | arg1,
|
---|
12446 | arg2,
|
---|
12447 | arg3);
|
---|
12448 | }
|
---|
12449 |
|
---|
12450 |
|
---|
12451 | };
|
---|
12452 |
|
---|
12453 | template<
|
---|
12454 | typename T0,
|
---|
12455 | typename T1,
|
---|
12456 | typename T2>
|
---|
12457 | struct functionImplementation_
|
---|
12458 | < T0,
|
---|
12459 | T1,
|
---|
12460 | T2,
|
---|
12461 | NullType,
|
---|
12462 | NullType,
|
---|
12463 | NullType,
|
---|
12464 | NullType,
|
---|
12465 | NullType,
|
---|
12466 | NullType,
|
---|
12467 | NullType,
|
---|
12468 | NullType,
|
---|
12469 | NullType,
|
---|
12470 | NullType,
|
---|
12471 | NullType,
|
---|
12472 | NullType,
|
---|
12473 | NullType,
|
---|
12474 | NullType,
|
---|
12475 | NullType,
|
---|
12476 | NullType,
|
---|
12477 | NullType,
|
---|
12478 | NullType,
|
---|
12479 | NullType,
|
---|
12480 | NullType,
|
---|
12481 | NullType,
|
---|
12482 | NullType,
|
---|
12483 | NullType,
|
---|
12484 | NullType,
|
---|
12485 | NullType,
|
---|
12486 | NullType,
|
---|
12487 | NullType,
|
---|
12488 | NullType,
|
---|
12489 | NullType>
|
---|
12490 | {
|
---|
12491 | typedef detail::KernelFunctorGlobal<
|
---|
12492 | T0,
|
---|
12493 | T1,
|
---|
12494 | T2,
|
---|
12495 | NullType,
|
---|
12496 | NullType,
|
---|
12497 | NullType,
|
---|
12498 | NullType,
|
---|
12499 | NullType,
|
---|
12500 | NullType,
|
---|
12501 | NullType,
|
---|
12502 | NullType,
|
---|
12503 | NullType,
|
---|
12504 | NullType,
|
---|
12505 | NullType,
|
---|
12506 | NullType,
|
---|
12507 | NullType,
|
---|
12508 | NullType,
|
---|
12509 | NullType,
|
---|
12510 | NullType,
|
---|
12511 | NullType,
|
---|
12512 | NullType,
|
---|
12513 | NullType,
|
---|
12514 | NullType,
|
---|
12515 | NullType,
|
---|
12516 | NullType,
|
---|
12517 | NullType,
|
---|
12518 | NullType,
|
---|
12519 | NullType,
|
---|
12520 | NullType,
|
---|
12521 | NullType,
|
---|
12522 | NullType,
|
---|
12523 | NullType> FunctorType;
|
---|
12524 |
|
---|
12525 | FunctorType functor_;
|
---|
12526 |
|
---|
12527 | functionImplementation_(const FunctorType &functor) :
|
---|
12528 | functor_(functor)
|
---|
12529 | {
|
---|
12530 |
|
---|
12531 | #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 3))
|
---|
12532 | // Fail variadic expansion for dev11
|
---|
12533 | static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
|
---|
12534 | #endif
|
---|
12535 |
|
---|
12536 | }
|
---|
12537 |
|
---|
12538 | //! \brief Return type of the functor
|
---|
12539 | typedef Event result_type;
|
---|
12540 |
|
---|
12541 | //! \brief Function signature of kernel functor with no event dependency.
|
---|
12542 | typedef Event type_(
|
---|
12543 | const EnqueueArgs&,
|
---|
12544 | T0,
|
---|
12545 | T1,
|
---|
12546 | T2);
|
---|
12547 |
|
---|
12548 | Event operator()(
|
---|
12549 | const EnqueueArgs& enqueueArgs,
|
---|
12550 | T0 arg0,
|
---|
12551 | T1 arg1,
|
---|
12552 | T2 arg2)
|
---|
12553 | {
|
---|
12554 | return functor_(
|
---|
12555 | enqueueArgs,
|
---|
12556 | arg0,
|
---|
12557 | arg1,
|
---|
12558 | arg2);
|
---|
12559 | }
|
---|
12560 |
|
---|
12561 |
|
---|
12562 | };
|
---|
12563 |
|
---|
12564 | template<
|
---|
12565 | typename T0,
|
---|
12566 | typename T1>
|
---|
12567 | struct functionImplementation_
|
---|
12568 | < T0,
|
---|
12569 | T1,
|
---|
12570 | NullType,
|
---|
12571 | NullType,
|
---|
12572 | NullType,
|
---|
12573 | NullType,
|
---|
12574 | NullType,
|
---|
12575 | NullType,
|
---|
12576 | NullType,
|
---|
12577 | NullType,
|
---|
12578 | NullType,
|
---|
12579 | NullType,
|
---|
12580 | NullType,
|
---|
12581 | NullType,
|
---|
12582 | NullType,
|
---|
12583 | NullType,
|
---|
12584 | NullType,
|
---|
12585 | NullType,
|
---|
12586 | NullType,
|
---|
12587 | NullType,
|
---|
12588 | NullType,
|
---|
12589 | NullType,
|
---|
12590 | NullType,
|
---|
12591 | NullType,
|
---|
12592 | NullType,
|
---|
12593 | NullType,
|
---|
12594 | NullType,
|
---|
12595 | NullType,
|
---|
12596 | NullType,
|
---|
12597 | NullType,
|
---|
12598 | NullType,
|
---|
12599 | NullType>
|
---|
12600 | {
|
---|
12601 | typedef detail::KernelFunctorGlobal<
|
---|
12602 | T0,
|
---|
12603 | T1,
|
---|
12604 | NullType,
|
---|
12605 | NullType,
|
---|
12606 | NullType,
|
---|
12607 | NullType,
|
---|
12608 | NullType,
|
---|
12609 | NullType,
|
---|
12610 | NullType,
|
---|
12611 | NullType,
|
---|
12612 | NullType,
|
---|
12613 | NullType,
|
---|
12614 | NullType,
|
---|
12615 | NullType,
|
---|
12616 | NullType,
|
---|
12617 | NullType,
|
---|
12618 | NullType,
|
---|
12619 | NullType,
|
---|
12620 | NullType,
|
---|
12621 | NullType,
|
---|
12622 | NullType,
|
---|
12623 | NullType,
|
---|
12624 | NullType,
|
---|
12625 | NullType,
|
---|
12626 | NullType,
|
---|
12627 | NullType,
|
---|
12628 | NullType,
|
---|
12629 | NullType,
|
---|
12630 | NullType,
|
---|
12631 | NullType,
|
---|
12632 | NullType,
|
---|
12633 | NullType> FunctorType;
|
---|
12634 |
|
---|
12635 | FunctorType functor_;
|
---|
12636 |
|
---|
12637 | functionImplementation_(const FunctorType &functor) :
|
---|
12638 | functor_(functor)
|
---|
12639 | {
|
---|
12640 |
|
---|
12641 | #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 2))
|
---|
12642 | // Fail variadic expansion for dev11
|
---|
12643 | static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
|
---|
12644 | #endif
|
---|
12645 |
|
---|
12646 | }
|
---|
12647 |
|
---|
12648 | //! \brief Return type of the functor
|
---|
12649 | typedef Event result_type;
|
---|
12650 |
|
---|
12651 | //! \brief Function signature of kernel functor with no event dependency.
|
---|
12652 | typedef Event type_(
|
---|
12653 | const EnqueueArgs&,
|
---|
12654 | T0,
|
---|
12655 | T1);
|
---|
12656 |
|
---|
12657 | Event operator()(
|
---|
12658 | const EnqueueArgs& enqueueArgs,
|
---|
12659 | T0 arg0,
|
---|
12660 | T1 arg1)
|
---|
12661 | {
|
---|
12662 | return functor_(
|
---|
12663 | enqueueArgs,
|
---|
12664 | arg0,
|
---|
12665 | arg1);
|
---|
12666 | }
|
---|
12667 |
|
---|
12668 |
|
---|
12669 | };
|
---|
12670 |
|
---|
12671 | template<
|
---|
12672 | typename T0>
|
---|
12673 | struct functionImplementation_
|
---|
12674 | < T0,
|
---|
12675 | NullType,
|
---|
12676 | NullType,
|
---|
12677 | NullType,
|
---|
12678 | NullType,
|
---|
12679 | NullType,
|
---|
12680 | NullType,
|
---|
12681 | NullType,
|
---|
12682 | NullType,
|
---|
12683 | NullType,
|
---|
12684 | NullType,
|
---|
12685 | NullType,
|
---|
12686 | NullType,
|
---|
12687 | NullType,
|
---|
12688 | NullType,
|
---|
12689 | NullType,
|
---|
12690 | NullType,
|
---|
12691 | NullType,
|
---|
12692 | NullType,
|
---|
12693 | NullType,
|
---|
12694 | NullType,
|
---|
12695 | NullType,
|
---|
12696 | NullType,
|
---|
12697 | NullType,
|
---|
12698 | NullType,
|
---|
12699 | NullType,
|
---|
12700 | NullType,
|
---|
12701 | NullType,
|
---|
12702 | NullType,
|
---|
12703 | NullType,
|
---|
12704 | NullType,
|
---|
12705 | NullType>
|
---|
12706 | {
|
---|
12707 | typedef detail::KernelFunctorGlobal<
|
---|
12708 | T0,
|
---|
12709 | NullType,
|
---|
12710 | NullType,
|
---|
12711 | NullType,
|
---|
12712 | NullType,
|
---|
12713 | NullType,
|
---|
12714 | NullType,
|
---|
12715 | NullType,
|
---|
12716 | NullType,
|
---|
12717 | NullType,
|
---|
12718 | NullType,
|
---|
12719 | NullType,
|
---|
12720 | NullType,
|
---|
12721 | NullType,
|
---|
12722 | NullType,
|
---|
12723 | NullType,
|
---|
12724 | NullType,
|
---|
12725 | NullType,
|
---|
12726 | NullType,
|
---|
12727 | NullType,
|
---|
12728 | NullType,
|
---|
12729 | NullType,
|
---|
12730 | NullType,
|
---|
12731 | NullType,
|
---|
12732 | NullType,
|
---|
12733 | NullType,
|
---|
12734 | NullType,
|
---|
12735 | NullType,
|
---|
12736 | NullType,
|
---|
12737 | NullType,
|
---|
12738 | NullType,
|
---|
12739 | NullType> FunctorType;
|
---|
12740 |
|
---|
12741 | FunctorType functor_;
|
---|
12742 |
|
---|
12743 | functionImplementation_(const FunctorType &functor) :
|
---|
12744 | functor_(functor)
|
---|
12745 | {
|
---|
12746 |
|
---|
12747 | #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 1))
|
---|
12748 | // Fail variadic expansion for dev11
|
---|
12749 | static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
|
---|
12750 | #endif
|
---|
12751 |
|
---|
12752 | }
|
---|
12753 |
|
---|
12754 | //! \brief Return type of the functor
|
---|
12755 | typedef Event result_type;
|
---|
12756 |
|
---|
12757 | //! \brief Function signature of kernel functor with no event dependency.
|
---|
12758 | typedef Event type_(
|
---|
12759 | const EnqueueArgs&,
|
---|
12760 | T0);
|
---|
12761 |
|
---|
12762 | Event operator()(
|
---|
12763 | const EnqueueArgs& enqueueArgs,
|
---|
12764 | T0 arg0)
|
---|
12765 | {
|
---|
12766 | return functor_(
|
---|
12767 | enqueueArgs,
|
---|
12768 | arg0);
|
---|
12769 | }
|
---|
12770 |
|
---|
12771 |
|
---|
12772 | };
|
---|
12773 |
|
---|
12774 |
|
---|
12775 |
|
---|
12776 |
|
---|
12777 |
|
---|
12778 | } // namespace detail
|
---|
12779 |
|
---|
12780 | //----------------------------------------------------------------------------------------------
|
---|
12781 |
|
---|
12782 | template <
|
---|
12783 | typename T0, typename T1 = detail::NullType, typename T2 = detail::NullType,
|
---|
12784 | typename T3 = detail::NullType, typename T4 = detail::NullType,
|
---|
12785 | typename T5 = detail::NullType, typename T6 = detail::NullType,
|
---|
12786 | typename T7 = detail::NullType, typename T8 = detail::NullType,
|
---|
12787 | typename T9 = detail::NullType, typename T10 = detail::NullType,
|
---|
12788 | typename T11 = detail::NullType, typename T12 = detail::NullType,
|
---|
12789 | typename T13 = detail::NullType, typename T14 = detail::NullType,
|
---|
12790 | typename T15 = detail::NullType, typename T16 = detail::NullType,
|
---|
12791 | typename T17 = detail::NullType, typename T18 = detail::NullType,
|
---|
12792 | typename T19 = detail::NullType, typename T20 = detail::NullType,
|
---|
12793 | typename T21 = detail::NullType, typename T22 = detail::NullType,
|
---|
12794 | typename T23 = detail::NullType, typename T24 = detail::NullType,
|
---|
12795 | typename T25 = detail::NullType, typename T26 = detail::NullType,
|
---|
12796 | typename T27 = detail::NullType, typename T28 = detail::NullType,
|
---|
12797 | typename T29 = detail::NullType, typename T30 = detail::NullType,
|
---|
12798 | typename T31 = detail::NullType
|
---|
12799 | >
|
---|
12800 | struct make_kernel :
|
---|
12801 | public detail::functionImplementation_<
|
---|
12802 | T0, T1, T2, T3,
|
---|
12803 | T4, T5, T6, T7,
|
---|
12804 | T8, T9, T10, T11,
|
---|
12805 | T12, T13, T14, T15,
|
---|
12806 | T16, T17, T18, T19,
|
---|
12807 | T20, T21, T22, T23,
|
---|
12808 | T24, T25, T26, T27,
|
---|
12809 | T28, T29, T30, T31
|
---|
12810 | >
|
---|
12811 | {
|
---|
12812 | public:
|
---|
12813 | typedef detail::KernelFunctorGlobal<
|
---|
12814 | T0, T1, T2, T3,
|
---|
12815 | T4, T5, T6, T7,
|
---|
12816 | T8, T9, T10, T11,
|
---|
12817 | T12, T13, T14, T15,
|
---|
12818 | T16, T17, T18, T19,
|
---|
12819 | T20, T21, T22, T23,
|
---|
12820 | T24, T25, T26, T27,
|
---|
12821 | T28, T29, T30, T31
|
---|
12822 | > FunctorType;
|
---|
12823 |
|
---|
12824 | make_kernel(
|
---|
12825 | const Program& program,
|
---|
12826 | const STRING_CLASS name,
|
---|
12827 | cl_int * err = NULL) :
|
---|
12828 | detail::functionImplementation_<
|
---|
12829 | T0, T1, T2, T3,
|
---|
12830 | T4, T5, T6, T7,
|
---|
12831 | T8, T9, T10, T11,
|
---|
12832 | T12, T13, T14, T15,
|
---|
12833 | T16, T17, T18, T19,
|
---|
12834 | T20, T21, T22, T23,
|
---|
12835 | T24, T25, T26, T27,
|
---|
12836 | T28, T29, T30, T31
|
---|
12837 | >(
|
---|
12838 | FunctorType(program, name, err))
|
---|
12839 | {}
|
---|
12840 |
|
---|
12841 | make_kernel(
|
---|
12842 | const Kernel kernel) :
|
---|
12843 | detail::functionImplementation_<
|
---|
12844 | T0, T1, T2, T3,
|
---|
12845 | T4, T5, T6, T7,
|
---|
12846 | T8, T9, T10, T11,
|
---|
12847 | T12, T13, T14, T15,
|
---|
12848 | T16, T17, T18, T19,
|
---|
12849 | T20, T21, T22, T23,
|
---|
12850 | T24, T25, T26, T27,
|
---|
12851 | T28, T29, T30, T31
|
---|
12852 | >(
|
---|
12853 | FunctorType(kernel))
|
---|
12854 | {}
|
---|
12855 | };
|
---|
12856 |
|
---|
12857 |
|
---|
12858 | //----------------------------------------------------------------------------------------------------------------------
|
---|
12859 |
|
---|
12860 | #undef __ERR_STR
|
---|
12861 | #if !defined(__CL_USER_OVERRIDE_ERROR_STRINGS)
|
---|
12862 | #undef __GET_DEVICE_INFO_ERR
|
---|
12863 | #undef __GET_PLATFORM_INFO_ERR
|
---|
12864 | #undef __GET_DEVICE_IDS_ERR
|
---|
12865 | #undef __GET_CONTEXT_INFO_ERR
|
---|
12866 | #undef __GET_EVENT_INFO_ERR
|
---|
12867 | #undef __GET_EVENT_PROFILE_INFO_ERR
|
---|
12868 | #undef __GET_MEM_OBJECT_INFO_ERR
|
---|
12869 | #undef __GET_IMAGE_INFO_ERR
|
---|
12870 | #undef __GET_SAMPLER_INFO_ERR
|
---|
12871 | #undef __GET_KERNEL_INFO_ERR
|
---|
12872 | #undef __GET_KERNEL_ARG_INFO_ERR
|
---|
12873 | #undef __GET_KERNEL_WORK_GROUP_INFO_ERR
|
---|
12874 | #undef __GET_PROGRAM_INFO_ERR
|
---|
12875 | #undef __GET_PROGRAM_BUILD_INFO_ERR
|
---|
12876 | #undef __GET_COMMAND_QUEUE_INFO_ERR
|
---|
12877 |
|
---|
12878 | #undef __CREATE_CONTEXT_ERR
|
---|
12879 | #undef __CREATE_CONTEXT_FROM_TYPE_ERR
|
---|
12880 | #undef __GET_SUPPORTED_IMAGE_FORMATS_ERR
|
---|
12881 |
|
---|
12882 | #undef __CREATE_BUFFER_ERR
|
---|
12883 | #undef __CREATE_SUBBUFFER_ERR
|
---|
12884 | #undef __CREATE_IMAGE2D_ERR
|
---|
12885 | #undef __CREATE_IMAGE3D_ERR
|
---|
12886 | #undef __CREATE_SAMPLER_ERR
|
---|
12887 | #undef __SET_MEM_OBJECT_DESTRUCTOR_CALLBACK_ERR
|
---|
12888 |
|
---|
12889 | #undef __CREATE_USER_EVENT_ERR
|
---|
12890 | #undef __SET_USER_EVENT_STATUS_ERR
|
---|
12891 | #undef __SET_EVENT_CALLBACK_ERR
|
---|
12892 | #undef __SET_PRINTF_CALLBACK_ERR
|
---|
12893 |
|
---|
12894 | #undef __WAIT_FOR_EVENTS_ERR
|
---|
12895 |
|
---|
12896 | #undef __CREATE_KERNEL_ERR
|
---|
12897 | #undef __SET_KERNEL_ARGS_ERR
|
---|
12898 | #undef __CREATE_PROGRAM_WITH_SOURCE_ERR
|
---|
12899 | #undef __CREATE_PROGRAM_WITH_BINARY_ERR
|
---|
12900 | #undef __CREATE_PROGRAM_WITH_BUILT_IN_KERNELS_ERR
|
---|
12901 | #undef __BUILD_PROGRAM_ERR
|
---|
12902 | #undef __CREATE_KERNELS_IN_PROGRAM_ERR
|
---|
12903 |
|
---|
12904 | #undef __CREATE_COMMAND_QUEUE_ERR
|
---|
12905 | #undef __SET_COMMAND_QUEUE_PROPERTY_ERR
|
---|
12906 | #undef __ENQUEUE_READ_BUFFER_ERR
|
---|
12907 | #undef __ENQUEUE_WRITE_BUFFER_ERR
|
---|
12908 | #undef __ENQUEUE_READ_BUFFER_RECT_ERR
|
---|
12909 | #undef __ENQUEUE_WRITE_BUFFER_RECT_ERR
|
---|
12910 | #undef __ENQEUE_COPY_BUFFER_ERR
|
---|
12911 | #undef __ENQEUE_COPY_BUFFER_RECT_ERR
|
---|
12912 | #undef __ENQUEUE_READ_IMAGE_ERR
|
---|
12913 | #undef __ENQUEUE_WRITE_IMAGE_ERR
|
---|
12914 | #undef __ENQUEUE_COPY_IMAGE_ERR
|
---|
12915 | #undef __ENQUEUE_COPY_IMAGE_TO_BUFFER_ERR
|
---|
12916 | #undef __ENQUEUE_COPY_BUFFER_TO_IMAGE_ERR
|
---|
12917 | #undef __ENQUEUE_MAP_BUFFER_ERR
|
---|
12918 | #undef __ENQUEUE_MAP_IMAGE_ERR
|
---|
12919 | #undef __ENQUEUE_UNMAP_MEM_OBJECT_ERR
|
---|
12920 | #undef __ENQUEUE_NDRANGE_KERNEL_ERR
|
---|
12921 | #undef __ENQUEUE_TASK_ERR
|
---|
12922 | #undef __ENQUEUE_NATIVE_KERNEL
|
---|
12923 |
|
---|
12924 | #undef __CL_EXPLICIT_CONSTRUCTORS
|
---|
12925 |
|
---|
12926 | #undef __UNLOAD_COMPILER_ERR
|
---|
12927 | #endif //__CL_USER_OVERRIDE_ERROR_STRINGS
|
---|
12928 |
|
---|
12929 | #undef __CL_FUNCTION_TYPE
|
---|
12930 |
|
---|
12931 | // Extensions
|
---|
12932 | /**
|
---|
12933 | * Deprecated APIs for 1.2
|
---|
12934 | */
|
---|
12935 | #if defined(CL_VERSION_1_1)
|
---|
12936 | #undef __INIT_CL_EXT_FCN_PTR
|
---|
12937 | #endif // #if defined(CL_VERSION_1_1)
|
---|
12938 | #undef __CREATE_SUB_DEVICES
|
---|
12939 |
|
---|
12940 | #if defined(USE_CL_DEVICE_FISSION)
|
---|
12941 | #undef __PARAM_NAME_DEVICE_FISSION
|
---|
12942 | #endif // USE_CL_DEVICE_FISSION
|
---|
12943 |
|
---|
12944 | #undef __DEFAULT_NOT_INITIALIZED
|
---|
12945 | #undef __DEFAULT_BEING_INITIALIZED
|
---|
12946 | #undef __DEFAULT_INITIALIZED
|
---|
12947 |
|
---|
12948 | #undef CL_HPP_RVALUE_REFERENCES_SUPPORTED
|
---|
12949 | #undef CL_HPP_NOEXCEPT
|
---|
12950 |
|
---|
12951 | } // namespace cl
|
---|
12952 |
|
---|
12953 | #endif // CL_HPP_
|
---|