From 60e8a3d404f0640fa5a3f834eae54b4f1fb9127d Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 4 May 2024 03:13:14 +0200 Subject: Adding upstream version 0.38.0. Signed-off-by: Daniel Baumann --- video/out/vulkan/context_mac.m | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'video/out/vulkan/context_mac.m') diff --git a/video/out/vulkan/context_mac.m b/video/out/vulkan/context_mac.m index 8ac6e16..bedd0d4 100644 --- a/video/out/vulkan/context_mac.m +++ b/video/out/vulkan/context_mac.m @@ -15,8 +15,10 @@ * License along with mpv. If not, see . */ +#import + #include "video/out/gpu/context.h" -#include "osdep/macOS_swift.h" +#include "osdep/mac/swift.h" #include "common.h" #include "context.h" @@ -42,6 +44,12 @@ static void mac_vk_swap_buffers(struct ra_ctx *ctx) [p->vo_mac swapBuffer]; } +static void mac_vk_get_vsync(struct ra_ctx *ctx, struct vo_vsync_info *info) +{ + struct priv *p = ctx->priv; + [p->vo_mac fillVsyncWithInfo:info]; +} + static bool mac_vk_init(struct ra_ctx *ctx) { struct priv *p = ctx->priv = talloc_zero(ctx, struct priv); @@ -56,7 +64,7 @@ static bool mac_vk_init(struct ra_ctx *ctx) goto error; VkMetalSurfaceCreateInfoEXT mac_info = { - .sType = VK_STRUCTURE_TYPE_MACOS_SURFACE_CREATE_INFO_MVK, + .sType = VK_STRUCTURE_TYPE_METAL_SURFACE_CREATE_INFO_EXT, .pNext = NULL, .flags = 0, .pLayer = p->vo_mac.layer, @@ -64,6 +72,7 @@ static bool mac_vk_init(struct ra_ctx *ctx) struct ra_vk_ctx_params params = { .swap_buffers = mac_vk_swap_buffers, + .get_vsync = mac_vk_get_vsync, }; VkInstance inst = vk->vkinst->instance; @@ -85,7 +94,14 @@ error: static bool resize(struct ra_ctx *ctx) { - return ra_vk_ctx_resize(ctx, ctx->vo->dwidth, ctx->vo->dheight); + struct priv *p = ctx->priv; + + if (!p->vo_mac.window) { + return false; + } + CGSize size = p->vo_mac.window.framePixel.size; + + return ra_vk_ctx_resize(ctx, (int)size.width, (int)size.height); } static bool mac_vk_reconfig(struct ra_ctx *ctx) -- cgit v1.2.3