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