Files
WiVRn/patches/monado/0005-change-environment-blend-mode-selection-logic.patch
T
2025-07-04 23:43:06 +02:00

58 lines
2.0 KiB
Diff

From 6e97c25c737f0eb2fda9683caf9d38be66ea5aa9 Mon Sep 17 00:00:00 2001
From: galister <85970-galister@users.noreply.gitlab.freedesktop.org>
Date: Sat, 23 Nov 2024 02:42:12 +0900
Subject: [PATCH 05/11] change environment blend mode selection logic
---
src/xrt/compositor/multi/comp_multi_system.c | 26 +++++++++++++-------
1 file changed, 17 insertions(+), 9 deletions(-)
diff --git a/src/xrt/compositor/multi/comp_multi_system.c b/src/xrt/compositor/multi/comp_multi_system.c
index 9d7610d02..f3131e810 100644
--- a/src/xrt/compositor/multi/comp_multi_system.c
+++ b/src/xrt/compositor/multi/comp_multi_system.c
@@ -232,23 +232,31 @@ find_active_blend_mode(struct multi_compositor **overlay_sorted_clients, size_t
if (overlay_sorted_clients == NULL)
return XRT_BLEND_MODE_OPAQUE;
- const struct multi_compositor *first_visible = NULL;
+ enum xrt_blend_mode chosen_mode = 0;
for (size_t k = 0; k < size; ++k) {
const struct multi_compositor *mc = overlay_sorted_clients[k];
assert(mc != NULL);
- // if a focused client is found just return, "first_visible" has lower priority and can be ignored.
- if (mc->state.focused) {
- assert(mc->state.visible);
- return mc->delivered.data.env_blend_mode;
+ if (!mc->state.visible) {
+ continue;
+ }
+
+ // if any uses opaque, use opaque
+ if (mc->delivered.data.env_blend_mode == XRT_BLEND_MODE_OPAQUE) {
+ return XRT_BLEND_MODE_OPAQUE;
}
- if (first_visible == NULL && mc->state.visible) {
- first_visible = mc;
+ // if all use the same mode, use that mode
+ if (chosen_mode == 0) {
+ chosen_mode = mc->delivered.data.env_blend_mode;
+ } else if (chosen_mode != mc->delivered.data.env_blend_mode) {
+ // TODO: account for the case of mixed ALPHA_BLEND and ADDITIVE
+ return XRT_BLEND_MODE_OPAQUE;
}
}
- if (first_visible != NULL)
- return first_visible->delivered.data.env_blend_mode;
+ if (chosen_mode != 0)
+ return chosen_mode;
+ // no visible clients
return XRT_BLEND_MODE_OPAQUE;
}
--
2.50.0