diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 01:13:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 01:13:14 +0000 |
commit | 60e8a3d404f0640fa5a3f834eae54b4f1fb9127d (patch) | |
tree | 1da89a218d0ecf010c67a87cb2f625c4cb18e7d7 /video/out/vulkan/context_mac.m | |
parent | Adding upstream version 0.37.0. (diff) | |
download | mpv-upstream/0.38.0.tar.xz mpv-upstream/0.38.0.zip |
Adding upstream version 0.38.0.upstream/0.38.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'video/out/vulkan/context_mac.m')
-rw-r--r-- | video/out/vulkan/context_mac.m | 22 |
1 files changed, 19 insertions, 3 deletions
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 <http://www.gnu.org/licenses/>. */ +#import <QuartzCore/QuartzCore.h> + #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) |