mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-04 20:55:58 +01:00
render/vulkan/pipeline_key: Add blending
This will become necessary when we switch away from scissoring. For the time being, this cleans things up a bit and allows for a trivial blending implementation for textures when that comes.
This commit is contained in:
parent
9d31372930
commit
3623005858
2 changed files with 6 additions and 1 deletions
|
@ -150,6 +150,7 @@ enum wlr_vk_shader_source {
|
|||
struct wlr_vk_pipeline_key {
|
||||
enum wlr_vk_shader_source source;
|
||||
struct wlr_vk_pipeline_layout *layout;
|
||||
enum wlr_render_blend_mode blend_mode;
|
||||
|
||||
// only used if source is texture
|
||||
enum wlr_vk_texture_transform texture_transform;
|
||||
|
|
|
@ -2100,6 +2100,10 @@ static bool pipeline_key_equals(const struct wlr_vk_pipeline_key *a,
|
|||
return false;
|
||||
}
|
||||
|
||||
if (a->blend_mode != b->blend_mode) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (a->source != b->source) {
|
||||
return false;
|
||||
}
|
||||
|
@ -2194,7 +2198,7 @@ struct wlr_vk_pipeline *setup_get_or_create_pipeline(
|
|||
};
|
||||
|
||||
VkPipelineColorBlendAttachmentState blend_attachment = {
|
||||
.blendEnable = true,
|
||||
.blendEnable = key->blend_mode == WLR_RENDER_BLEND_MODE_PREMULTIPLIED,
|
||||
// we generally work with pre-multiplied alpha
|
||||
.srcColorBlendFactor = VK_BLEND_FACTOR_ONE,
|
||||
.dstColorBlendFactor = VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA,
|
||||
|
|
Loading…
Reference in a new issue