MetalCompute 1.0
An API to make GPU compute calls easier
|
#include <MTLComputeCommandManager.hpp>
Public Member Functions | |
CommandManager (MTL::Device *gpu, MTLCompute::Kernel *kernel) | |
Constructor for the CommandManager class. | |
CommandManager ()=default | |
Default constructor for the CommandManager class. | |
~CommandManager () | |
Destructor for the CommandManager class. | |
void | loadBuffer (Buffer< T > buffer, int index) |
Load a buffer into the CommandManager. | |
void | loadTexture (Texture< T > texture, int index) |
Load a texture into the CommandManager. | |
void | dispatch () |
Dispatch the kernel. | |
void | resetBuffers () |
reset the buffers and cached length | |
void | resetTextures () |
reset the textures and cached width and height | |
void | reset () |
reset the buffers and textures | |
MTL::Device * | getGPU () |
Get the GPU device. | |
Kernel * | getKernel () |
Get the kernel object. | |
std::vector< Buffer< T > > & | getBuffers () |
Get the loaded buffers. | |
std::vector< Texture< T > > & | getTextures () |
Get the loaded textures. | |
Private Attributes | |
MTL::Device * | gpu |
The Metal device object. | |
Kernel * | kernel |
The kernel object. | |
MTL::ComputePipelineState * | pipeline |
The Metal compute pipeline state object. | |
MTL::CommandQueue * | commandQueue |
The Metal command queue object. | |
MTL::CommandBuffer * | commandBuffer |
The Metal command buffer object. | |
MTL::ComputeCommandEncoder * | commandEncoder |
The Metal compute command encoder object. | |
std::vector< Buffer< T > > | buffers = std::vector<Buffer<T>>(MAX_BUFFERS) |
The buffers. | |
std::vector< Texture< T > > | textures = std::vector<Texture<T>>(MAX_TEXTURES) |
The textures. | |
int | bufferlength = -1 |
The length of the buffers. | |
int | texwidth = -1 |
The width of the textures. | |
int | texheight = -1 |
The height of the textures. | |
|
inline |
Constructor for the CommandManager class.
Takes in the GPU device and the kernel object and creates a new CommandManager. Also takes in the target buffer type with a template parameter.
gpu | The GPU device |
kernel | The kernel object |
|
default |
Default constructor for the CommandManager class.
|
inline |
Destructor for the CommandManager class.
Releases the command queue
|
inline |
Dispatch the kernel.
Creates new command buffer and command encoder objects, adds the specified buffers at the correct positons, and dispatches the kernel
|
inline |
Get the loaded buffers.
|
inline |
|
inline |
Get the kernel object.
|
inline |
Get the loaded textures.
|
inline |
Load a buffer into the CommandManager.
Takes in a buffer and an index and adds the buffer to an internal array
buffer | The buffer to load |
index | The index to load the buffer into |
|
inline |
Load a texture into the CommandManager.
Takes in a texture and an index and adds the texture to an internal array
texture | The texture to load |
index | The index to load the texture into |
|
inline |
reset the buffers and textures
Calls CommandManager::resetBuffers and CommandManager::resetTextures
|
inline |
reset the buffers and cached length
|
inline |
reset the textures and cached width and height
|
private |
The length of the buffers.
|
private |
The buffers.
|
private |
The Metal command buffer object.
|
private |
The Metal compute command encoder object.
|
private |
The Metal command queue object.
|
private |
The Metal device object.
|
private |
The kernel object.
|
private |
The Metal compute pipeline state object.
|
private |
The height of the textures.
|
private |
The textures.
|
private |
The width of the textures.