wait for device

This commit is contained in:
Greg Wells
2025-05-31 06:22:58 -04:00
parent c9a2f3f872
commit eab08b81f6
3 changed files with 7 additions and 1 deletions

View File

@@ -17,6 +17,10 @@ gnReturnCode gnCreateOutputDeviceFn(gnOutputDevice* outputDevice, gnInstance* in
return GN_SUCCESS;
}
void gnWaitForDeviceFn(gnOutputDevice *device) {
[device->outputDevice->executingCommandBuffer waitUntilCompleted];
}
void gnDestroyOutputDeviceFn(gnOutputDevice* device) {
for (int i = 0; i < device->outputDevice->queueCount; i++) {
[device->outputDevice->queues[i] release];

View File

@@ -15,5 +15,7 @@ struct gnPlatformOutputDevice_t {
int queueCount;
id<MTLCommandQueue>* queues;
id<MTLCommandBuffer> executingCommandBuffer;
id<MTLRenderPipelineState> framebuffer;
} gnPlatformOutputDevice;

View File

@@ -42,7 +42,7 @@ gnReturnCode gnPresentFn(struct gnOutputDevice_t* device, struct gnPresentInfo_t
[commandBuffer presentDrawable:drawable];
[commandBuffer commit];
device->outputDevice->executingCommandBuffer = commandBuffer;
return GN_SUCCESS;
}