diff --git a/include/gryphn/utils/gryphn_glfw_util.h b/include/gryphn/utils/gryphn_glfw_util.h index ad8b381..fd85701 100644 --- a/include/gryphn/utils/gryphn_glfw_util.h +++ b/include/gryphn/utils/gryphn_glfw_util.h @@ -15,12 +15,8 @@ #endif static gnReturnCode gnCreateGLFWWindowSurface(struct gnWindowSurface_t* windowSurface, struct gnInstance_t* instance, GLFWwindow* window) { - MTKView* view = gnCreateMTKView(glfwGetCocoaWindow(window)); - gnWindowSetMTKView(glfwGetCocoaWindow(window), view); - CAMetalLayer* layer = gnGetCAMetalLayer(glfwGetCocoaWindow(window)); - gnMacOSWindowSurfaceInfo surfaceCreateInfo = { - .layer = layer + .layer = gnCreateCAMetalLayer(glfwGetCocoaWindow(window)) }; return gnCreateMacOSWindowSurface(windowSurface, instance, surfaceCreateInfo); diff --git a/rendering_api/metal/src/core/present/metal_present.m b/rendering_api/metal/src/core/present/metal_present.m index 9f90fa1..76c8653 100644 --- a/rendering_api/metal/src/core/present/metal_present.m +++ b/rendering_api/metal/src/core/present/metal_present.m @@ -31,15 +31,17 @@ gnReturnCode gnPresentFn(struct gnOutputDevice_t* device, struct gnPresentInfo_t 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}]; + for (int i =0 ; i < info.presentationQueueCount; i++) { + [blit copyFromTexture:info.presentationQueues[i].images[info.imageIndices[i]].texture->texture + sourceSlice:0 + sourceLevel:0 + sourceOrigin:(MTLOrigin){0, 0, 0} + sourceSize:(MTLSize){info.presentationQueues[i].info.imageSize.x, info.presentationQueues[i].info.imageSize.y, 1} + toTexture:drawable.texture + destinationSlice:0 + destinationLevel:0 + destinationOrigin:(MTLOrigin){0, 0, 0}]; + } [blit endEncoding]; @@ -48,5 +50,12 @@ gnReturnCode gnPresentFn(struct gnOutputDevice_t* device, struct gnPresentInfo_t [commandBuffer waitUntilScheduled]; device->outputDevice->executingCommandBuffer = commandBuffer; + for (int i = 0; i < info.presentationQueueCount; i++) { + if (info.presentationQueues[i].info.imageSize.x != info.presentationQueues[i].info.surface.windowSurface->layer.drawableSize.width || + info.presentationQueues[i].info.imageSize.y != info.presentationQueues[i].info.surface.windowSurface->layer.drawableSize.height) { + return GN_SUBOPTIMAL_PRESENTATION_QUEUE; + } + } + return GN_SUCCESS; }