Skip to content

Commit

Permalink
mac/vulkan: add support for visibility check for rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
Akemi committed Feb 19, 2025
1 parent 8df9ba7 commit 61ac173
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions video/out/mac_common.swift
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ class MacCommon: Common {
info.pointee.last_queue_display_time = next?.time ?? -1
}

@objc func isVisbile() -> Bool {
return window?.occlusionState.contains(.visible) ?? false
}

override func displayLinkCallback(_ displayLink: CVDisplayLink,
_ inNow: UnsafePointer<CVTimeStamp>,
_ inOutputTime: UnsafePointer<CVTimeStamp>,
Expand Down
7 changes: 7 additions & 0 deletions video/out/vulkan/context_mac.m
Original file line number Diff line number Diff line change
Expand Up @@ -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 isVisbile];
}

static bool mac_vk_init(struct ra_ctx *ctx)
{
struct priv *p = ctx->priv = talloc_zero(ctx, struct priv);
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 61ac173

Please sign in to comment.