From 78936d2b4ef0ec7b71d66d8ee100b656271d18ee Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Thu, 4 Nov 2021 20:54:11 +0000 Subject: [PATCH] c/main: Use get_vk more --- src/xrt/compositor/main/comp_window_direct_nvidia.c | 8 +++++++- src/xrt/compositor/main/comp_window_direct_randr.c | 3 ++- src/xrt/compositor/main/comp_window_vk_display.c | 8 +++++++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/xrt/compositor/main/comp_window_direct_nvidia.c b/src/xrt/compositor/main/comp_window_direct_nvidia.c index b142c65f6..380cee6e3 100644 --- a/src/xrt/compositor/main/comp_window_direct_nvidia.c +++ b/src/xrt/compositor/main/comp_window_direct_nvidia.c @@ -68,6 +68,12 @@ comp_window_direct_nvidia_init_swapchain(struct comp_target *ct, uint32_t width, * */ +static inline struct vk_bundle * +get_vk(struct comp_target *ct) +{ + return &ct->c->vk; +} + static void _flush(struct comp_target *ct) { @@ -163,7 +169,7 @@ static bool comp_window_direct_nvidia_init(struct comp_target *ct) { struct comp_window_direct_nvidia *w_direct = (struct comp_window_direct_nvidia *)ct; - struct vk_bundle *vk = &ct->c->vk; + struct vk_bundle *vk = get_vk(ct); // Sanity check. if (vk->instance == VK_NULL_HANDLE) { diff --git a/src/xrt/compositor/main/comp_window_direct_randr.c b/src/xrt/compositor/main/comp_window_direct_randr.c index ece8f05cc..a744f3759 100644 --- a/src/xrt/compositor/main/comp_window_direct_randr.c +++ b/src/xrt/compositor/main/comp_window_direct_randr.c @@ -174,9 +174,10 @@ static bool comp_window_direct_randr_init(struct comp_target *ct) { struct comp_window_direct_randr *w_direct = (struct comp_window_direct_randr *)ct; + struct vk_bundle *vk = get_vk(w_direct); // Sanity check. - if (ct->c->vk.instance != VK_NULL_HANDLE) { + if (vk->instance != VK_NULL_HANDLE) { COMP_ERROR(ct->c, "Vulkan initialized before RANDR init!"); return false; } diff --git a/src/xrt/compositor/main/comp_window_vk_display.c b/src/xrt/compositor/main/comp_window_vk_display.c index 6ac900372..5d02a40fa 100644 --- a/src/xrt/compositor/main/comp_window_vk_display.c +++ b/src/xrt/compositor/main/comp_window_vk_display.c @@ -66,6 +66,12 @@ comp_window_vk_display_init_swapchain(struct comp_target *ct, uint32_t width, ui * */ +static inline struct vk_bundle * +get_vk(struct comp_target *ct) +{ + return &ct->c->vk; +} + static void _flush(struct comp_target *ct) { @@ -152,7 +158,7 @@ static bool comp_window_vk_display_init(struct comp_target *ct) { struct comp_window_vk_display *w_direct = (struct comp_window_vk_display *)ct; - struct vk_bundle *vk = &ct->c->vk; + struct vk_bundle *vk = get_vk(ct); // Sanity check. if (vk->instance == VK_NULL_HANDLE) {