mirror of
https://github.com/Kbz-8/Pulse.git
synced 2026-01-11 15:33:34 +00:00
adding command list to metal backend
This commit is contained in:
@@ -14,10 +14,23 @@
|
||||
|
||||
PulseCommandList MetalRequestCommandList(PulseDevice device, PulseCommandListUsage usage)
|
||||
{
|
||||
PULSE_CHECK_HANDLE_RETVAL(device, PULSE_NULL_HANDLE);
|
||||
PulseCommandList cmd = (PulseCommandList)calloc(1, sizeof(PulseCommandListHandler));
|
||||
PULSE_CHECK_ALLOCATION_RETVAL(cmd, PULSE_NULL_HANDLE);
|
||||
return cmd;
|
||||
@autoreleasepool
|
||||
{
|
||||
PULSE_UNUSED(usage);
|
||||
|
||||
MetalDevice* metal_device = (MetalDevice*)METAL_RETRIEVE_DRIVER_DATA_AS(device, MetalDevice*);
|
||||
|
||||
PulseCommandList cmd = (PulseCommandList)calloc(1, sizeof(PulseCommandListHandler));
|
||||
PULSE_CHECK_ALLOCATION_RETVAL(cmd, PULSE_NULL_HANDLE);
|
||||
|
||||
MetalCommandList* metal_cmd = (MetalCommandList*)calloc(1, sizeof(MetalCommandList));
|
||||
PULSE_CHECK_ALLOCATION_RETVAL(metal_cmd, PULSE_NULL_HANDLE);
|
||||
|
||||
metal_cmd->cmd = [metal_device->queue commandBuffer];
|
||||
|
||||
cmd->driver_data = metal_cmd;
|
||||
return cmd;
|
||||
}
|
||||
}
|
||||
|
||||
bool MetalSubmitCommandList(PulseDevice device, PulseCommandList cmd, PulseFence fence)
|
||||
@@ -26,4 +39,12 @@ bool MetalSubmitCommandList(PulseDevice device, PulseCommandList cmd, PulseFence
|
||||
|
||||
void MetalReleaseCommandList(PulseDevice device, PulseCommandList cmd)
|
||||
{
|
||||
@autoreleasepool
|
||||
{
|
||||
PULSE_UNUSED(device);
|
||||
MetalCommandList* metal_cmd = METAL_RETRIEVE_DRIVER_DATA_AS(cmd, MetalCommandList*);
|
||||
metal_cmd->cmd = nil;
|
||||
free(metal_cmd);
|
||||
free(cmd);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user