aboutsummaryrefslogtreecommitdiff
path: root/include/render
diff options
context:
space:
mode:
authorManuel Stoeckl <code@mstoeckl.com>2022-11-19 21:47:27 -0500
committerSimon Ser <contact@emersion.fr>2023-05-12 15:09:02 +0000
commit10dd41669492f7582c26bd3989536a66278df75d (patch)
treed8daa7c184d11481e5f8d4bbbe28581f62805f7a /include/render
parent8cdc4b7a31d8a3eba4e2ae7cf32bdc808e46538d (diff)
render/vulkan: allow rendering to non-8-bit buffers
This is implemented by a two-subpass rendering scheme; the first subpass draws (and blends) onto a linear R16G16B16A16_SFLOAT buffer, while the second subpass performs linear->srgb conversion, writing onto the actual output buffer.
Diffstat (limited to 'include/render')
-rw-r--r--include/render/vulkan.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/include/render/vulkan.h b/include/render/vulkan.h
index 5d00fec1..202b4200 100644
--- a/include/render/vulkan.h
+++ b/include/render/vulkan.h
@@ -140,6 +140,7 @@ struct wlr_vk_render_format_setup {
VkPipeline tex_srgb_pipe;
VkPipeline tex_nv12_pipe;
VkPipeline quad_pipe;
+ VkPipeline output_pipe;
};
// Renderer-internal represenation of an wlr_buffer imported for rendering.
@@ -156,6 +157,13 @@ struct wlr_vk_render_buffer {
uint32_t mem_count;
VkDeviceMemory memories[WLR_DMABUF_MAX_PLANES];
bool transitioned;
+
+ VkImage blend_image;
+ VkImageView blend_image_view;
+ VkDeviceMemory blend_memory;
+ VkDescriptorSet blend_descriptor_set;
+ struct wlr_vk_descriptor_pool *blend_attachment_pool;
+ bool blend_transitioned;
};
struct wlr_vk_command_buffer {
@@ -184,11 +192,17 @@ struct wlr_vk_renderer {
VkShaderModule vert_module;
VkShaderModule tex_frag_module;
VkShaderModule quad_frag_module;
+ VkShaderModule output_module;
VkDescriptorSetLayout ds_layout, nv12_ds_layout;
VkPipelineLayout pipe_layout, nv12_pipe_layout;
VkSampler sampler, nv12_sampler;
VkSamplerYcbcrConversion nv12_conversion;
+ // for blend->output subpass
+ VkPipelineLayout output_pipe_layout;
+ VkDescriptorSetLayout output_ds_layout;
+ size_t last_output_pool_size;
+ struct wl_list output_descriptor_pools; // wlr_vk_descriptor_pool.link
VkSemaphore timeline_semaphore;
uint64_t timeline_point;
@@ -208,6 +222,7 @@ struct wlr_vk_renderer {
struct wl_list descriptor_pools; // wlr_vk_descriptor_pool.link
struct wl_list render_format_setups; // wlr_vk_render_format_setup.link
+
struct wl_list textures; // wlr_vk_texture.link
// Textures to return to foreign queue
struct wl_list foreign_textures; // wlr_vk_texture.foreign_link
@@ -258,6 +273,12 @@ struct wlr_vk_descriptor_pool *vulkan_alloc_texture_ds(
struct wlr_vk_renderer *renderer, VkDescriptorSetLayout ds_layout,
VkDescriptorSet *ds);
+// Tries to allocate a descriptor set for the blending image. Will
+// additionally return the pool it was allocated from when successful
+// (for freeing it later).
+struct wlr_vk_descriptor_pool *vulkan_alloc_blend_ds(
+ struct wlr_vk_renderer *renderer, VkDescriptorSet *ds);
+
// Frees the given descriptor set from the pool its pool.
void vulkan_free_ds(struct wlr_vk_renderer *renderer,
struct wlr_vk_descriptor_pool *pool, VkDescriptorSet ds);