C++ API Reference
|
Introduced in 2023.0 More...
#include <MOpenCLUtils.h>
Public Types | |
enum | UploadMode |
Upload mode. | |
Static Public Member Functions | |
static cl_int | uploadToGPU (size_t size, void *host_ptr, MOpenCLBuffer &buffer, UploadMode uploadMode) |
Uploads data to a GPU Buffer. More... | |
template<typename MArrayType , typename ElementType = decltype(MArrayType{}[0]), typename _req = decltype(MArrayType{}.length())> | |
static cl_int | uploadToGPU (const MArrayType &array, MOpenCLBuffer &buffer, UploadMode uploadMode=kBlocking) |
Uploads array data to a GPU Buffer. More... | |
template<typename StdArrayType , typename _req = typename StdArrayType::value_type> | |
static cl_int | uploadToGPU (const StdArrayType &array, MOpenCLBuffer &buffer, UploadMode uploadMode) |
Uploads array data to a GPU Buffer. More... | |
static cl_int | uploadToGPU (const MMatrixArray &array, MOpenCLBuffer &buffer, UploadMode uploadMode=kBlocking) |
Uploads an array of matrices to a GPU Buffer. More... | |
static cl_int | uploadToGPU (const MObject &object, MOpenCLBuffer &buffer, UploadMode uploadMode, unsigned int *arrayLength=nullptr) |
Uploads generic array data to a GPU Buffer. More... | |
static cl_int | uploadToGPUAsUnsignedChar (const MObject &object, MOpenCLBuffer &buffer, unsigned int *arrayLength=nullptr) |
Uploads generic array data to a GPU Buffer as an unsigned char array. More... | |
static cl_int | setKernelArgBuffer (cl_kernel kernel, cl_uint argIndex, const MAutoCLMem &buffer, cl_int &errorCode, bool useBuffer=true) |
Used to set the buffer as the argument value for a specific argument of a kernel. More... | |
static cl_int | setKernelArgBuffer (cl_kernel kernel, cl_uint argIndex, const MOpenCLBuffer &buffer, cl_int &errorCode, bool useBuffer=true) |
Used to set the buffer as the argument value for a specific argument of a kernel. More... | |
static cl_int | setKernelArg (cl_kernel kernel, cl_uint argIndex, size_t argSize, const void *argValue, cl_int &errorCode) |
Used to set the argument value for a specific argument of a kernel. More... | |
template<typename T > | |
static cl_int | setKernelArg (cl_kernel kernel, cl_uint argIndex, T value, cl_int &errorCode) |
Used to set the argument value for a specific argument of a kernel. More... | |
static const char * | className () |
Returns the name of this class. More... | |
Introduced in 2023.0
OpenCL functionality.
General utilities for OpenCL, containing functions for uploading buffers and managing kernels.
|
static |
Uploads data to a GPU Buffer.
[in] | host_ptr | data to be copied into the OpenCL buffer. Must be at least size bytes. |
[in] | size | the size in bytes of the data to write to OpenCL. |
[in] | buffer | the GPU buffer to which the data should be uploaded |
[in] | uploadMode | the uploadMode specifies whether the upload should happen in blocking or non-blocking mode |
|
inlinestatic |
Uploads array data to a GPU Buffer.
[in] | array | the CPU array to be uploaded |
[in] | buffer | the GPU buffer to which the data should be uploaded |
[in] | uploadMode | the uploadMode specifies whether the upload should happen in blocking or non-blocking mode |
|
inlinestatic |
Uploads array data to a GPU Buffer.
[in] | array | the std array to be uploaded |
[in] | buffer | the GPU buffer to which the data should be uploaded |
[in] | uploadMode | the uploadMode specifies whether the upload should happen in blocking or non-blocking mode |
|
static |
Uploads an array of matrices to a GPU Buffer.
[in] | array | the CPU matrix array to be uploaded |
[in] | buffer | the GPU buffer to which the data should be uploaded |
|
static |
Uploads generic array data to a GPU Buffer.
[in] | array | the CPU array to be uploaded |
[in] | buffer | the GPU buffer to which the data should be uploaded |
[in] | uploadMode | the uploadMode specifies whether the upload should happen in blocking or non-blocking mode |
[out] | arrayLength | when non-null this will be set to the length of the array that is being uploaded |
|
static |
Uploads generic array data to a GPU Buffer as an unsigned char array.
If the array data contained in the objects is of type kUintArrayData or kIntArrayData the array will be converted to type unsigned char and uploaded to the GPU. This can be used if the integers are going to be used as booleans or enums.
[in] | array | the CPU array to be uploaded |
[in] | buffer | the GPU buffer to which the data should be uploaded |
[out] | arrayLength | when non-null this will be set to the length of the array that is being uploaded |
|
static |
Used to set the buffer as the argument value for a specific argument of a kernel.
If the specified errorCode is not CL_SUCCES this function will do nothing. It will simply return the error code. Otherwise it will set the argument on the kernel and return the new errorCode.
[in] | kernel | A valid kernel object. |
[in] | argIndex | The argument index. Arguments to the kernel are referred by indices that go from 0 for the leftmost argument to n - 1, where n is the total number of arguments declared by a kernel. |
[in] | buffer | The data that should be used as the argument value for the argument specified by argIndex |
[in,out] | errorCode | the previous error code which will be set to the new result if the previous code was CL_SUCCES |
[in] | useBuffer | when true the specified buffer is set as the argument, otherwise a nullptr is set. |
|
static |
Used to set the buffer as the argument value for a specific argument of a kernel.
If the specified errorCode is not CL_SUCCES this function will do nothing. It will simply return the error code. Otherwise it will set the argument on the kernel and return the new errorCode.
[in] | kernel | A valid kernel object. |
[in] | argIndex | The argument index. Arguments to the kernel are referred by indices that go from 0 for the leftmost argument to n - 1, where n is the total number of arguments declared by a kernel. |
[in] | buffer | The data that should be used as the argument value for the argument specified by argIndex |
[in,out] | errorCode | the previous error code which will be set to the new result if the previous code was CL_SUCCES |
[in] | useBuffer | when true the specified buffer is set as the argument, otherwise a nullptr is set. |
|
static |
Used to set the argument value for a specific argument of a kernel.
If the specified errorCode is not CL_SUCCES this function will do nothing. It will simply return the error code. Otherwise it will set the argument on the kernel and return the new errorCode.
This is a relatively low level function that interfaces directly with clSetKernelArg
[in] | kernel | A valid kernel object. |
[in] | argIndex | The argument index. Arguments to the kernel are referred by indices that go from 0 for the leftmost argument to n - 1, where n is the total number of arguments declared by a kernel. |
[in] | argSize | Specifies the size of the argument value |
[in] | argValue | A pointer to data that should be used as the argument value for argument specified by argIndex |
[in,out] | errorCode | the previous error code which will be set to the new result if the previous code was CL_SUCCES |
|
inlinestatic |
Used to set the argument value for a specific argument of a kernel.
If the specified errorCode is not CL_SUCCES this function will do nothing. It will simply return the error code. Otherwise it will set the argument on the kernel and return the new errorCode.
[in] | kernel | A valid kernel object. |
[in] | argIndex | The argument index. Arguments to the kernel are referred by indices that go from 0 for the leftmost argument to n - 1, where n is the total number of arguments declared by a kernel. |
[in] | value | The data that should be used as the argument value for the argument specified by argIndex |
[in,out] | errorCode | the previous error code which will be set to the new result if the previous code was CL_SUCCES |
|
static |
Returns the name of this class.