mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-01 12:46:12 +00:00
c/main: Add comp_target::check_ready, and implement in comp_target_swapchain.
This commit is contained in:
parent
780ec4fac9
commit
90192118d0
|
@ -105,9 +105,18 @@ struct comp_target
|
|||
*/
|
||||
bool (*init_post_vulkan)(struct comp_target *ct, uint32_t preferred_width, uint32_t preferred_height);
|
||||
|
||||
/*!
|
||||
* Is this target ready for image creation?
|
||||
*
|
||||
* Call before calling @ref create_images
|
||||
*/
|
||||
bool (*check_ready)(struct comp_target *ct);
|
||||
|
||||
/*!
|
||||
* Create or recreate the image(s) of the target, for swapchain based
|
||||
* targets this will (re)create the swapchain.
|
||||
*
|
||||
* @pre @ref check_ready returns true
|
||||
*/
|
||||
void (*create_images)(struct comp_target *ct,
|
||||
uint32_t preferred_width,
|
||||
|
@ -218,6 +227,20 @@ comp_target_init_post_vulkan(struct comp_target *ct, uint32_t preferred_width, u
|
|||
return ct->init_post_vulkan(ct, preferred_width, preferred_height);
|
||||
}
|
||||
|
||||
/*!
|
||||
* @copydoc comp_target::check_ready
|
||||
*
|
||||
* @public @memberof comp_target
|
||||
* @ingroup comp_main
|
||||
*/
|
||||
static inline bool
|
||||
comp_target_check_ready(struct comp_target *ct)
|
||||
{
|
||||
COMP_TRACE_MARKER();
|
||||
|
||||
return ct->check_ready(ct);
|
||||
}
|
||||
|
||||
/*!
|
||||
* @copydoc comp_target::create_images
|
||||
*
|
||||
|
|
|
@ -299,6 +299,13 @@ comp_target_swapchain_present(struct comp_target *ct,
|
|||
return vk->vkQueuePresentKHR(queue, &presentInfo);
|
||||
}
|
||||
|
||||
static bool
|
||||
comp_target_swapchain_check_ready(struct comp_target *ct)
|
||||
{
|
||||
struct comp_target_swapchain *cts = (struct comp_target_swapchain *)ct;
|
||||
return cts->surface.handle != VK_NULL_HANDLE;
|
||||
}
|
||||
|
||||
static bool
|
||||
_find_surface_format(struct comp_target_swapchain *cts, VkSurfaceKHR surface, VkSurfaceFormatKHR *format)
|
||||
{
|
||||
|
@ -646,6 +653,7 @@ comp_target_swapchain_init_and_set_fnptrs(struct comp_target_swapchain *cts,
|
|||
enum comp_target_display_timing_usage timing_usage)
|
||||
{
|
||||
cts->timing_usage = timing_usage;
|
||||
cts->base.check_ready = comp_target_swapchain_check_ready;
|
||||
cts->base.create_images = comp_target_swapchain_create_images;
|
||||
cts->base.acquire = comp_target_swapchain_acquire_next_image;
|
||||
cts->base.present = comp_target_swapchain_present;
|
||||
|
|
|
@ -83,6 +83,7 @@ struct comp_target_swapchain
|
|||
* Initializes these function pointers, all other methods of @ref comp_target are the responsibility of the caller (the
|
||||
* "subclass"):
|
||||
*
|
||||
* - comp_target::check_ready
|
||||
* - comp_target::create_images
|
||||
* - comp_target::acquire
|
||||
* - comp_target::present
|
||||
|
|
Loading…
Reference in a new issue