mirror of
https://github.com/mpv-player/mpv.git
synced 2026-10-25 20:49:49 +08:00
mac/vulkan: add support for visibility check for rendering
This commit is contained in:
@@ -109,6 +109,10 @@ class MacCommon: Common {
|
||||
info.pointee.last_queue_display_time = next?.time ?? -1
|
||||
}
|
||||
|
||||
@objc func isVisible() -> Bool {
|
||||
return window?.occlusionState.contains(.visible) ?? false
|
||||
}
|
||||
|
||||
override func displayLinkCallback(_ displayLink: CVDisplayLink,
|
||||
_ inNow: UnsafePointer<CVTimeStamp>,
|
||||
_ inOutputTime: UnsafePointer<CVTimeStamp>,
|
||||
|
||||
@@ -55,6 +55,12 @@ static int mac_vk_color_depth(struct ra_ctx *ctx)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool mac_vk_check_visible(struct ra_ctx *ctx)
|
||||
{
|
||||
struct priv *p = ctx->priv;
|
||||
return [p->vo_mac isVisible];
|
||||
}
|
||||
|
||||
static bool mac_vk_init(struct ra_ctx *ctx)
|
||||
{
|
||||
struct priv *p = ctx->priv = talloc_zero(ctx, struct priv);
|
||||
@@ -84,6 +90,7 @@ static bool mac_vk_init(struct ra_ctx *ctx)
|
||||
.swap_buffers = mac_vk_swap_buffers,
|
||||
.get_vsync = mac_vk_get_vsync,
|
||||
.color_depth = mac_vk_color_depth,
|
||||
.check_visible = mac_vk_check_visible,
|
||||
};
|
||||
|
||||
VkInstance inst = vk->vkinst->instance;
|
||||
|
||||
Reference in New Issue
Block a user