aboutsummaryrefslogtreecommitdiff
path: root/render/vulkan/pass.c
diff options
context:
space:
mode:
authorAlexander Orzechowski <alex@ozal.ski>2023-06-17 21:21:31 -0400
committerAlexander Orzechowski <alex@ozal.ski>2023-06-17 21:21:31 -0400
commit8a387b5558d7760c047b5f5990e86e85a8abe893 (patch)
tree93d0faa8cfbc8210455906e1ca5f7a8072922737 /render/vulkan/pass.c
parent3623005858348594e6e32d95024cccc3f4270d85 (diff)
render/vulkan: Dynamically create pipeline layouts
These will happen lazily when pipelines get created.
Diffstat (limited to 'render/vulkan/pass.c')
-rw-r--r--render/vulkan/pass.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/render/vulkan/pass.c b/render/vulkan/pass.c
index 9b060239..419f92e0 100644
--- a/render/vulkan/pass.c
+++ b/render/vulkan/pass.c
@@ -404,7 +404,6 @@ error:
static void render_pass_add_rect(struct wlr_render_pass *wlr_pass,
const struct wlr_render_rect_options *options) {
struct wlr_vk_render_pass *pass = get_render_pass(wlr_pass);
- struct wlr_vk_renderer *renderer = pass->renderer;
VkCommandBuffer cb = pass->command_buffer->vk;
// Input color values are given in sRGB space, shader expects
@@ -436,7 +435,7 @@ static void render_pass_add_rect(struct wlr_render_pass *wlr_pass,
pass->render_buffer->render_setup,
&(struct wlr_vk_pipeline_key) {
.source = WLR_VK_SHADER_SOURCE_SINGLE_COLOR,
- .layout = &renderer->default_pipeline_layout,
+ .layout = { .ycbcr_format = NULL },
});
if (!pipe) {
pass->failed = true;
@@ -450,9 +449,9 @@ static void render_pass_add_rect(struct wlr_render_pass *wlr_pass,
mat3_to_mat4(matrix, vert_pcr_data.mat4);
bind_pipeline(pass, pipe->vk);
- vkCmdPushConstants(cb, renderer->default_pipeline_layout.vk,
+ vkCmdPushConstants(cb, pipe->layout->vk,
VK_SHADER_STAGE_VERTEX_BIT, 0, sizeof(vert_pcr_data), &vert_pcr_data);
- vkCmdPushConstants(cb, renderer->default_pipeline_layout.vk,
+ vkCmdPushConstants(cb, pipe->layout->vk,
VK_SHADER_STAGE_FRAGMENT_BIT, sizeof(vert_pcr_data), sizeof(float) * 4,
linear_color);
@@ -546,21 +545,24 @@ static void render_pass_add_texture(struct wlr_render_pass *wlr_pass,
render_buffer->render_setup,
&(struct wlr_vk_pipeline_key) {
.source = WLR_VK_SHADER_SOURCE_TEXTURE,
- .layout = texture->pipeline_layout,
+ .layout = {
+ .ycbcr_format = texture->format->is_ycbcr ? texture->format : NULL,
+ },
.texture_transform = texture->transform,
});
if (!pipe) {
pass->failed = true;
+ return;
}
bind_pipeline(pass, pipe->vk);
vkCmdBindDescriptorSets(cb, VK_PIPELINE_BIND_POINT_GRAPHICS,
- pipe->key.layout->vk, 0, 1, &texture->ds, 0, NULL);
+ pipe->layout->vk, 0, 1, &texture->ds, 0, NULL);
- vkCmdPushConstants(cb, pipe->key.layout->vk,
+ vkCmdPushConstants(cb, pipe->layout->vk,
VK_SHADER_STAGE_VERTEX_BIT, 0, sizeof(vert_pcr_data), &vert_pcr_data);
- vkCmdPushConstants(cb, pipe->key.layout->vk,
+ vkCmdPushConstants(cb, pipe->layout->vk,
VK_SHADER_STAGE_FRAGMENT_BIT, sizeof(vert_pcr_data), sizeof(float),
&alpha);