aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorManuel Stoeckl <code@mstoeckl.com>2022-11-11 22:53:06 -0500
committerSimon Ser <contact@emersion.fr>2022-11-25 14:19:27 +0000
commit3ed69b49465f0b542d163da905dbc0864e19d5d8 (patch)
treed4909ffd0b1b8eff89d41dd67557f5422ac3a88d /include
parent060df4c6c0f92e3989ce6fa13e5862bb3bee7dae (diff)
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.
Diffstat (limited to 'include')
-rw-r--r--include/render/vulkan.h11
1 files changed, 10 insertions, 1 deletions
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;
};