Skip to content
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

Transparency shader not working in v12 #1354

Closed
CyberShadow opened this issue Oct 11, 2024 · 7 comments
Closed

Transparency shader not working in v12 #1354

CyberShadow opened this issue Oct 11, 2024 · 7 comments

Comments

@CyberShadow
Copy link

Platform

NixOS

GPU, drivers, and screen setup

Intel Graphics on Linux v6.11.2, single monitor (laptop - Thinkpad X1 Extreme Gen3)

name of display: :0
display: :0  screen: 0
direct rendering: Yes
Extended renderer info (GLX_MESA_query_renderer):
    Vendor: Intel (0x8086)
    Device: Mesa Intel(R) UHD Graphics (CML GT2) (0x9bc4)
    Version: 24.2.2
    Accelerated: yes
    Video memory: 15942MB
    Unified memory: yes
    Preferred profile: core (0x1)
    Max core profile version: 4.6
    Max compat profile version: 4.6
    Max GLES1 profile version: 1.1
    Max GLES[23] profile version: 3.2
OpenGL vendor string: Intel
OpenGL renderer string: Mesa Intel(R) UHD Graphics (CML GT2)
OpenGL core profile version string: 4.6 (Core Profile) Mesa 24.2.2
OpenGL core profile shading language version string: 4.60
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile

OpenGL version string: 4.6 (Compatibility Profile) Mesa 24.2.2
OpenGL shading language version string: 4.60
OpenGL context flags: (none)
OpenGL profile mask: compatibility profile

OpenGL ES profile version string: OpenGL ES 3.2 Mesa 24.2.2
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20

Environment

i3 version 4.23

picom version

v12.2

Diagnostics
[ 2024-10-11 14:21:33.370 open_config_file_at WARN ] This compositor has been renamed to "picom", the old config file paths is deprecated. Please replace the "compton"s in the path with "picom"
**Version:** v12.2

### Extensions:

* Shape: Yes
* RandR: Yes
* Present: Present

### Misc:

* Use Overlay: No
  (Another compositor is already running)
* Config file specified: None
* Config file used: /home/vladimir/.config/compton.conf

### Drivers (inaccurate):

modesetting
[ 2024-10-11 14:21:33.416 egl_init WARN ] The egl backend is still experimental, use with care.

### Backend: egl

* Driver vendors:
 * EGL: Mesa Project
 * EGL driver: iris
 * GL: Intel
* GL renderer: Mesa Intel(R) UHD Graphics (CML GT2)

### Backend: glx

* Driver vendors:
 * GLX: Mesa Project and SGI
 * GL: Intel
* GL renderer: Mesa Intel(R) UHD Graphics (CML GT2)
* Accelerated: 1

Configuration:

Configuration file
backend = "glx";

rules: ({
  match = "class_g = 'Emacs'";
  shader = "compton/color-key-transparency-171925.glsl";
})

Steps of reproduction

  1. Create and set up a color-key transparency shader, e.g.:
    #version 330
    
    in vec2 texcoord;
    uniform sampler2D tex;
    
    vec4 window_shader() {
            vec4 c = texelFetch(tex, ivec2(texcoord), 0);
            {
                    if (c == vec4(23.0/255.0, 25.0/255.0, 37.0/255.0, 1.0)) // #171925
                            c = vec4(0, 0, 0, 0.7);
            }
            return c;
    }
  2. Set Emacs to use the same background color that the shader looks for (#171925), e.g. by activating the deeper-blue color theme
  3. Move the cursor around a bit

Expected behavior

Window background should be transparent, e.g.:

image

(screenshot taken with picom 11.2 with the equivalent config window-shader-fg-rule = [ "compton/color-key-transparency-171925.glsl:class_g = 'Emacs'" ];)

Current Behavior

Looks like the window contents is drawn on top of the previous copy repeatedly, instead of on the background, causing the window to be opaque and a ghosting effect, e.g.:

image

Stack trace

N/A

OpenGL trace

Let me know if you need this.

Other details

Hopefully the screenshots should be OK.

@yshui
Copy link
Owner

yshui commented Oct 11, 2024

i think you need --force-win-blend for shader that adds transparency (to windows that are opaque) to work

@CyberShadow
Copy link
Author

Thanks. I see the exact same problem with

backend = "glx";

force-win-blend = true;

rules: ({
  match = "class_g = 'Emacs'";
  shader = "compton/color-key-transparency-171925.glsl";
})

@yshui
Copy link
Owner

yshui commented Oct 11, 2024

thanks for testing! there is probably a bug in how force_win_blend is handled in v12.

yshui added a commit that referenced this issue Oct 11, 2024
@yshui
Copy link
Owner

yshui commented Oct 11, 2024

can you test the commit above?

@CyberShadow
Copy link
Author

Works great, thank you!

Would it make sense to have force-win-blend as a rules setting, instead of just a global?

@yshui
Copy link
Owner

yshui commented Oct 11, 2024

Would it make sense to have force-win-blend as a rules setting, instead of just a global?

Yes.

yshui added a commit that referenced this issue Oct 11, 2024
@yshui
Copy link
Owner

yshui commented Oct 11, 2024

but it's going to be in v13 though, too late for v12.

@yshui yshui closed this as completed in 8370ebf Oct 11, 2024
yshui added a commit that referenced this issue Oct 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants