diff options
author | Simon Ser <contact@emersion.fr> | 2023-04-14 11:40:44 +0200 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2023-05-30 09:42:19 +0000 |
commit | e07c77f846f585cece77099ff3a71dd8f92e0eca (patch) | |
tree | 6a85476befb54e9d0148d49702beda989321b345 /include/render/vulkan.h | |
parent | 8af00d5534998dbb53a60c2b0a1ab59a51d5cdf5 (diff) |
render/vulkan: implement render pass API
Diffstat (limited to 'include/render/vulkan.h')
-rw-r--r-- | include/render/vulkan.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/include/render/vulkan.h b/include/render/vulkan.h index 087a9284..819ebbf3 100644 --- a/include/render/vulkan.h +++ b/include/render/vulkan.h @@ -12,6 +12,7 @@ #include <wlr/util/addon.h> struct wlr_vk_descriptor_pool; +struct wlr_vk_texture; struct wlr_vk_instance { VkInstance instance; @@ -260,6 +261,13 @@ struct wlr_vk_renderer { } read_pixels_cache; }; +// vertex shader push constant range data +struct wlr_vk_vert_pcr_data { + float mat4[4][4]; + float uv_off[2]; + float uv_size[2]; +}; + // Creates a vulkan renderer for the given device. struct wlr_renderer *vulkan_renderer_create_for_device(struct wlr_vk_device *dev); @@ -272,6 +280,18 @@ VkCommandBuffer vulkan_record_stage_cb(struct wlr_vk_renderer *renderer); // finished execution. bool vulkan_submit_stage_wait(struct wlr_vk_renderer *renderer); +struct wlr_vk_render_pass { + struct wlr_render_pass base; + struct wlr_vk_renderer *renderer; + struct wlr_vk_render_buffer *render_buffer; + struct wlr_vk_command_buffer *command_buffer; + VkPipeline bound_pipeline; + float projection[9]; +}; + +struct wlr_vk_render_pass *vulkan_begin_render_pass(struct wlr_vk_renderer *renderer, + struct wlr_vk_render_buffer *buffer); + // Suballocates a buffer span with the given size that can be mapped // and used as staging buffer. The allocation is implicitly released when the // stage cb has finished execution. The start of the span will be a multiple @@ -301,6 +321,19 @@ struct wlr_vk_renderer *vulkan_get_renderer(struct wlr_renderer *r); struct wlr_vk_pipeline_layout *vulkan_get_pipeline_layout(struct wlr_vk_renderer *renderer, const struct wlr_vk_format *format); +VkPipeline vulkan_get_texture_pipeline(struct wlr_vk_texture *texture, + struct wlr_vk_render_format_setup *render_setup); + +struct wlr_vk_command_buffer *vulkan_acquire_command_buffer( + struct wlr_vk_renderer *renderer); +uint64_t vulkan_end_command_buffer(struct wlr_vk_command_buffer *cb, + struct wlr_vk_renderer *renderer); +bool vulkan_wait_command_buffer(struct wlr_vk_command_buffer *cb, + struct wlr_vk_renderer *renderer); + +bool vulkan_sync_render_buffer(struct wlr_vk_renderer *renderer, + struct wlr_vk_render_buffer *render_buffer, struct wlr_vk_command_buffer *cb); +bool vulkan_sync_foreign_texture(struct wlr_vk_texture *texture); // State (e.g. image texture) associated with a surface. struct wlr_vk_texture { |