From eab08b81f6f09d9474594e8e7d074dee5e469d45 Mon Sep 17 00:00:00 2001 From: Greg Wells Date: Sat, 31 May 2025 06:22:58 -0400 Subject: [PATCH] wait for device --- rendering_api/metal/src/core/devices/metal_output_device.m | 4 ++++ rendering_api/metal/src/core/devices/metal_output_devices.h | 2 ++ rendering_api/metal/src/core/present/metal_present.m | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/rendering_api/metal/src/core/devices/metal_output_device.m b/rendering_api/metal/src/core/devices/metal_output_device.m index eedfd2d..cd83810 100644 --- a/rendering_api/metal/src/core/devices/metal_output_device.m +++ b/rendering_api/metal/src/core/devices/metal_output_device.m @@ -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]; diff --git a/rendering_api/metal/src/core/devices/metal_output_devices.h b/rendering_api/metal/src/core/devices/metal_output_devices.h index 72872db..967b254 100644 --- a/rendering_api/metal/src/core/devices/metal_output_devices.h +++ b/rendering_api/metal/src/core/devices/metal_output_devices.h @@ -15,5 +15,7 @@ struct gnPlatformOutputDevice_t { int queueCount; id* queues; + id executingCommandBuffer; + id framebuffer; } gnPlatformOutputDevice; diff --git a/rendering_api/metal/src/core/present/metal_present.m b/rendering_api/metal/src/core/present/metal_present.m index dc972e6..19e2214 100644 --- a/rendering_api/metal/src/core/present/metal_present.m +++ b/rendering_api/metal/src/core/present/metal_present.m @@ -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; }