mac/vulkan: add support for visibility check for rendering

This commit is contained in:
der richter committed 2025-03-05 19:04:04 +01:00
1 parent 49b8f39b25
commit 5010c24edc
2 files changed
+11

No files matched your search

+4
View File
@@ -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>,
+7
View File
@@ -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;