#include <MOpenCLInfo.h>
Global OpenCL information used by Maya.
This class provides access to all the global information Maya has about OpenCL. This information includes the chosen device ID, context, and command queue. MOpenCLInfo also includes helper methods to handle basic kernel compilation and error status checking.
You can only access MOpenCLInfo after VP2 is initialized. If you access it before VP2 initialization, the behavior of MOpenCLInfo is undefined.
Static Public Member Functions | |
static cl_context | getOpenCLContext () |
The method returns the Maya OpenCL context. More... | |
static cl_command_queue | getMayaDefaultOpenCLCommandQueue () |
The method returns the Maya default OpenCL command queue. More... | |
static cl_command_queue | createOpenCLCommandQueue () |
This method creates a new OpenCL command queue. More... | |
static cl_device_id | getOpenCLDeviceId () |
The method returns the Maya OpenCL device ID. More... | |
static MAutoCLKernel | getOpenCLKernel (const MString &sourceFilePath, const MString &kernelName) |
This method compiles a dot cl (.cl) file into a cl_program, and then creates a cl_kernel that uses that program. More... | |
static MAutoCLKernel | getOpenCLKernelFromString (const MString &programSource, const MString &programName, const MString &kernelName) |
This method compiles a string into a cl_program, and then creates a cl_kernel from one of the kernels in that program. More... | |
static bool | releaseOpenCLKernel (const MAutoCLKernel &kernel) |
This method releases a kernel that was obtained from getOpenCLKernel(). More... | |
static void | checkCLErrorStatus (cl_int err) |
This method prints an error message to stderr that corresponds with the error received. More... | |
static void | appendMessage (MStringArray *messages, const char *format,...) |
This method appends a message to messages. More... | |
static void | appendMessage (MStringArray *messages, const MStringResourceId *formatResourceId,...) |
This method appends a message to messages. More... | |
|
static |
The method returns the Maya OpenCL context.
This is the same context used by the deformerEvaluator plug-in. This may be the same context used by external libraries integrated with Maya, such as Bullet or OpenSubDiv.
|
static |
The method returns the Maya default OpenCL command queue.
This is the same command queue that the deformerEvaluator plug-in uses. This may be the same command queue used by external libraries integrated with Maya, such as Bullet or OpenSubDiv.
|
static |
This method creates a new OpenCL command queue.
The returned command queue is created using exactly the same parameters and logic as the Maya default OpenCL command queue (returned by getMayaDefaultOpenCLCommandQueue()).
The user must call clReleaseCommandQueue on the returned command queue when the queue is no longer in use.
|
static |
The method returns the Maya OpenCL device ID.
This is the same device ID used by the deformerEvaluator plug-in. This may be the same device ID used by external libraries integrated with Maya such as Bullet or OpenSubDiv.
|
static |
This method compiles a dot cl (.cl) file into a cl_program, and then creates a cl_kernel that uses that program.
The sourceFilePath that passes into this method should be the absolute path of the cl file on disk and the kernel name must be an exact match of a kernel in the given file. The cl_program only generates once, even if multiple kernels are generated from the same source file.
If this method returns a non-null kernel, the kernel should be released with releaseOpenCLKernel().
[in] | sourceFilePath | The absolute path of the cl file on disk. |
[in] | kernelName | The name of a kernel inside the cl file. |
|
static |
This method compiles a string into a cl_program, and then creates a cl_kernel from one of the kernels in that program.
programSource should hold the cl source of the program and the kernelName must be an exact match for a kernel in the program string. programName should uniquely identify a programString. The cl_program is only generated once, even if multiple kernels are generated from the same program source.
If this method returns a non-null kernel, the kernel should be released with releaseOpenCLKernel().
[in] | programSource | The openCL source to be compiled |
[in] | programName | A name which uniquely identifies programSouce |
[in] | kernelName | The name of a kernel in the compiled program |
|
static |
This method releases a kernel that was obtained from getOpenCLKernel().
If the kernel is the last one associated with the cl_program program, the program will be released as well.
[in] | kernel | The kernel to release. |
|
static |
This method prints an error message to stderr that corresponds with the error received.
If the error is CL_SUCCESS, no message is printed. If the error is any other value, a message is printed to stderr that includes the error type.
[in] | err | The error to be checked. |
|
static |
This method appends a message to messages.
The message is created using format and the additional arguments . If messages is NULL, this method does nothing.
[in] | messages | The list of messages to be added to. |
[in] | format | C string that contains a format string and follows the same specifications as format in printf. |
[in] | ... | Additional arguments to be used to replace a format specifier in the format string. |
|
static |
This method appends a message to messages.
The message is created using formatResourceId and the additional arguments . If messages is NULL, this method does nothing.
[in] | messages | The list of messages to be added to. |
[in] | formatResourceId | MStringResourceId that contains a format string and follows the same specifications as format in printf. |
[in] | ... | Additional arguments to be used to replace a format specifier in the format string. |