c/main: Use get_vk more

This commit is contained in:
Jakob Bornecrantz 2021-11-04 20:54:11 +00:00
parent c6031a26e8
commit 78936d2b4e
3 changed files with 16 additions and 3 deletions

View file

@ -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) {

View file

@ -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;
}

View file

@ -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) {