From c9a2f3f872565cb52ffdc5afff5a2809647a1147 Mon Sep 17 00:00:00 2001 From: Greg Wells Date: Sat, 31 May 2025 06:20:15 -0400 Subject: [PATCH] present command --- .../metal/src/core/present/metal_present.m | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/rendering_api/metal/src/core/present/metal_present.m b/rendering_api/metal/src/core/present/metal_present.m index cddf53b..dc972e6 100644 --- a/rendering_api/metal/src/core/present/metal_present.m +++ b/rendering_api/metal/src/core/present/metal_present.m @@ -5,6 +5,7 @@ #include "core/sync/semaphore/metal_semaphore.h" #include "core/presentation_queue/metal_presentation_queue.h" #include "core/debugger/gryphn_debugger.h" +#include "core/texture/metal_texture.h" #import gnReturnCode gnPresentFn(struct gnOutputDevice_t* device, struct gnPresentInfo_t info) { @@ -25,6 +26,20 @@ gnReturnCode gnPresentFn(struct gnOutputDevice_t* device, struct gnPresentInfo_t id render = [commandBuffer renderCommandEncoderWithDescriptor:passDesc]; [render endEncoding]; + id blit = [commandBuffer blitCommandEncoder]; + + [blit copyFromTexture:info.presentationQueues[0].images[info.imageIndices[0]].texture->texture + sourceSlice:0 + sourceLevel:0 + sourceOrigin:(MTLOrigin){0, 0, 0} + sourceSize:(MTLSize){info.presentationQueues[0].info.imageSize.x, info.presentationQueues[0].info.imageSize.y, 1} + toTexture:drawable.texture + destinationSlice:0 + destinationLevel:0 + destinationOrigin:(MTLOrigin){0, 0, 0}]; + + [blit endEncoding]; + [commandBuffer presentDrawable:drawable]; [commandBuffer commit];