Skip to content

Make per_pixel_transparency always enabled in the editor #106324

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

YeldhamDev
Copy link
Member

@YeldhamDev YeldhamDev commented May 12, 2025

A (fashionably late) follow-up to #91333. This makes so that window transparency is always enabled in the editor itself, which is necessary for popups to have shadows.

Requires #106344 (see below).

@YeldhamDev YeldhamDev added this to the 4.x milestone May 12, 2025
@YeldhamDev YeldhamDev requested a review from a team as a code owner May 12, 2025 21:50
@akien-mga
Copy link
Member

akien-mga commented May 12, 2025

Didn't we conclude that this wasn't a good option because per-pixel transparency isn't properly supported on Windows + Nvidia + Vulkan, which is by far our most frequent user setup?

I still think it would be preferable to remove popup shadows from the editor theme so this isn't necessary. At least until we can ensure that per-pixel transparency works everywhere and has no significant performance impact.

See:

@KoBeWi
Copy link
Member

KoBeWi commented May 12, 2025

The way you implemented it, the transparency will be always enabled in editor builds, not only in the editor.
You could just use editor_hint feature override for that.

@YeldhamDev
Copy link
Member Author

YeldhamDev commented May 12, 2025

Didn't we conclude that this wasn't a good option because per-pixel transparency isn't properly supported on Windows + Nvidia + Vulkan, which is by far our most frequent user setup?

I can add a small check to see if it's on Window with Vulkan, and then not enable it.

I still think it would be preferable to remove popup shadows from the editor theme so this isn't necessary. At least until we can ensure that per-pixel transparency works everywhere and has no significant performance impact.

Is the performance impact really that severe, considering this version is only for the editor? I feel like having the popups be shadowless makes them look really flat and unpolished.

@YeldhamDev YeldhamDev force-pushed the shouldve_done_this_a_while_ago branch from 1392f5f to d1adabb Compare May 12, 2025 22:30
@YeldhamDev
Copy link
Member Author

@KoBeWi Thanks, fixed.

@YeldhamDev YeldhamDev force-pushed the shouldve_done_this_a_while_ago branch from d1adabb to 5373544 Compare May 12, 2025 23:38
@YeldhamDev
Copy link
Member Author

I'm not sure why this is causing a memory leak.

@bruvzg
Copy link
Member

bruvzg commented May 13, 2025

Didn't we conclude that this wasn't a good option because per-pixel transparency isn't properly supported on Windows + Nvidia + Vulkan, which is by far our most frequent user setup?

We can probably force it to work, using NVAPI (which is already used for OpenGL), I'll check it. Setting "Vulkan/Opengl present method" to "native" should make transparency work with Vulkan. If it's overridable via API it can be used.

I'm not sure why this is causing a memory leak.

Seems like it's existing one, not introduced by this PR, probably fixable by something like:

diff --git a/platform/linuxbsd/x11/gl_manager_x11.cpp b/platform/linuxbsd/x11/gl_manager_x11.cpp
index 41c8cd704b..151730b9a2 100644
--- a/platform/linuxbsd/x11/gl_manager_x11.cpp
+++ b/platform/linuxbsd/x11/gl_manager_x11.cpp
@@ -137,6 +137,10 @@ Error GLManager_X11::_create_context(GLDisplay &gl_display) {
                ERR_FAIL_NULL_V(fbc, ERR_UNCONFIGURED);

                for (int i = 0; i < fbcount; i++) {
+                       if (vi) {
+                               XFree(vi);
+                               vi = nullptr;
+                       }
                        vi = (XVisualInfo *)glXGetVisualFromFBConfig(x11_display, fbc[i]);
                        if (!vi) {
                                continue;

@bruvzg
Copy link
Member

bruvzg commented May 13, 2025

#106344 should fix the transparency issue on NV + Vulkan.
#106345 should fix the leak.

@YeldhamDev YeldhamDev force-pushed the shouldve_done_this_a_while_ago branch from 5373544 to 447dd58 Compare May 13, 2025 12:51
@YeldhamDev
Copy link
Member Author

@bruvzg You're the best!

@lawnjelly
Copy link
Member

This may not be cheap AFAIK and should be benchmarked on different hardware / platforms imo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants