From 3ed69b49465f0b542d163da905dbc0864e19d5d8 Mon Sep 17 00:00:00 2001 From: Manuel Stoeckl Date: Fri, 11 Nov 2022 22:53:06 -0500 Subject: render/vulkan: add support for RGB565 texture format Since this does not have a matching _SRGB-type vulkan format, add a new shader variant/pipeline to perform the sRGB->linear texture conversion. --- include/render/vulkan.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/render/vulkan.h b/include/render/vulkan.h index 5dfc3d37..8063291f 100644 --- a/include/render/vulkan.h +++ b/include/render/vulkan.h @@ -78,6 +78,7 @@ int vulkan_find_mem_type(struct wlr_vk_device *device, struct wlr_vk_format { uint32_t drm_format; VkFormat vk_format; + bool is_srgb; }; // Returns all known format mappings. @@ -110,6 +111,13 @@ struct wlr_vk_format_modifier_props *vulkan_format_props_find_modifier( struct wlr_vk_format_props *props, uint64_t mod, bool render); void vulkan_format_props_finish(struct wlr_vk_format_props *props); +// Constants used to pick the color transform for the texture drawing +// fragment shader. Must match those in shaders/texture.frag +enum wlr_vk_texture_transform { + WLR_VK_TEXTURE_TRANSFORM_IDENTITY = 0, + WLR_VK_TEXTURE_TRANSFORM_SRGB = 1, +}; + // For each format we want to render, we need a separate renderpass // and therefore also separate pipelines. struct wlr_vk_render_format_setup { @@ -117,7 +125,8 @@ struct wlr_vk_render_format_setup { VkFormat render_format; // used in renderpass VkRenderPass render_pass; - VkPipeline tex_pipe; + VkPipeline tex_identity_pipe; + VkPipeline tex_srgb_pipe; VkPipeline quad_pipe; }; -- cgit v1.2.3