From 270914d379bd24aed1f5be219fa3469cc57d9d36 Mon Sep 17 00:00:00 2001 From: zccrs Date: Mon, 23 May 2022 21:54:36 +0800 Subject: render/vulkan: add some interfaces to allow compositors to integrate Added wlr_vk_renderer_get_* functions to allow get the VkInstance, VkPhysicalDevice, VkDevice, queue family of a wlr_vk_renderer. Added wlr_vk_renderer_get_current_image_attribs function to allow get the VkImage of current renderer buffer to use on compositors. Added wlr_renderer_is_vk function, it's like the wlr_renderer_is_gles2, returns true if the wlr_renderer is a wlr_vk_renderer. Added wlr_vk_image_get_attribs function to get a VkImage and it's extras information (e.g. a VkImageLayout and VkImageFormat of the VkImage) from a wlr_texture. --- include/wlr/render/vulkan.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'include/wlr/render') diff --git a/include/wlr/render/vulkan.h b/include/wlr/render/vulkan.h index 0302d85b..aec3a3c2 100644 --- a/include/wlr/render/vulkan.h +++ b/include/wlr/render/vulkan.h @@ -9,10 +9,29 @@ #ifndef WLR_RENDER_VULKAN_H #define WLR_RENDER_VULKAN_H +#include #include +struct wlr_vk_image_attribs { + VkImage image; + VkImageLayout layout; + VkFormat format; +}; + struct wlr_renderer *wlr_vk_renderer_create_with_drm_fd(int drm_fd); + +VkInstance wlr_vk_renderer_get_instance(struct wlr_renderer *renderer); +VkPhysicalDevice wlr_vk_renderer_get_physical_device(struct wlr_renderer *renderer); +VkDevice wlr_vk_renderer_get_device(struct wlr_renderer *renderer); +uint32_t wlr_vk_renderer_get_queue_family(struct wlr_renderer *renderer); +void wlr_vk_renderer_get_current_image_attribs(struct wlr_renderer *renderer, + struct wlr_vk_image_attribs *attribs); + +bool wlr_renderer_is_vk(struct wlr_renderer *wlr_renderer); bool wlr_texture_is_vk(struct wlr_texture *texture); +void wlr_vk_texture_get_image_attribs(struct wlr_texture *texture, + struct wlr_vk_image_attribs *attribs); + #endif -- cgit v1.2.3