adding command list to metal backend

This commit is contained in:
2025-09-08 00:04:49 +02:00
parent 9c2f644b0e
commit 287f18402e
9 changed files with 77 additions and 23 deletions

View File

@@ -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);
}
}