render/vulkan: introduce wlr_vk_frag_texture_pcr_data

Contains UBOs for texture.frag.
This commit is contained in:
Simon Ser 2025-02-27 16:48:32 +01:00
parent ec422ac389
commit 56d95c2ecb
3 changed files with 11 additions and 2 deletions

View file

@ -339,6 +339,10 @@ struct wlr_vk_vert_pcr_data {
float uv_size[2];
};
struct wlr_vk_frag_texture_pcr_data {
float alpha;
};
struct wlr_vk_frag_output_pcr_data {
float matrix[4][4]; // only a 3x3 subset is used
float luminance_multiplier;

View file

@ -816,6 +816,10 @@ static void render_pass_add_texture(struct wlr_render_pass *wlr_pass,
return;
}
struct wlr_vk_frag_texture_pcr_data frag_pcr_data = {
.alpha = alpha,
};
bind_pipeline(pass, pipe->vk);
vkCmdBindDescriptorSets(cb, VK_PIPELINE_BIND_POINT_GRAPHICS,
@ -824,8 +828,8 @@ static void render_pass_add_texture(struct wlr_render_pass *wlr_pass,
vkCmdPushConstants(cb, pipe->layout->vk,
VK_SHADER_STAGE_VERTEX_BIT, 0, sizeof(vert_pcr_data), &vert_pcr_data);
vkCmdPushConstants(cb, pipe->layout->vk,
VK_SHADER_STAGE_FRAGMENT_BIT, sizeof(vert_pcr_data), sizeof(float),
&alpha);
VK_SHADER_STAGE_FRAGMENT_BIT, sizeof(vert_pcr_data),
sizeof(frag_pcr_data), &frag_pcr_data);
pixman_region32_t clip;
get_clip_region(pass, options->clip, &clip);

View file

@ -5,6 +5,7 @@ layout(set = 0, binding = 0) uniform sampler2D tex;
layout(location = 0) in vec2 uv;
layout(location = 0) out vec4 out_color;
// struct wlr_vk_frag_texture_pcr_data
layout(push_constant) uniform UBO {
layout(offset = 80) float alpha;
} data;