aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Orzechowski <alex@ozal.ski>2023-06-05 16:01:21 -0400
committerAlexander Orzechowski <alex@ozal.ski>2023-06-16 19:20:04 -0400
commit3623005858348594e6e32d95024cccc3f4270d85 (patch)
tree5421035321ff2c63bb10dce6a633a50782d74fb7
parent9d31372930eb061e1a5f43fa7e0cb27e2ffa197a (diff)
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.
-rw-r--r--include/render/vulkan.h1
-rw-r--r--render/vulkan/renderer.c6
2 files changed, 6 insertions, 1 deletions
diff --git a/include/render/vulkan.h b/include/render/vulkan.h
index 76397aae..25111fb6 100644
--- a/include/render/vulkan.h
+++ b/include/render/vulkan.h
@@ -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;
diff --git a/render/vulkan/renderer.c b/render/vulkan/renderer.c
index 064f5055..039f6ef7 100644
--- a/render/vulkan/renderer.c
+++ b/render/vulkan/renderer.c
@@ -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,