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

backend: gl: Use effective texture size for rounded corner calculation #1002

Merged

Conversation

tryone144
Copy link
Collaborator

The rounded corner calculation only took the actual texture dimensions into account, effectively turning all pixels outside completely transparent. Furthermore, texelFetch() in the default window shader does not work with any of the GL_TEXTURE_WRAP_x parameters.

As a result, a to-be-tiled root pixmap wasn't properly tiled and only visible in the original top-left corner (see #970).

  • Changed the default window shader to use textureSize() to scale the texture coordinates into the proper range for use with texture2D().
  • Added a new uniform to the default post-processing shader containing the effective texture size for rounded corners calculation instead of relying on textureSize().

Related: #1000 (different fix for xrender)

@codecov
Copy link

codecov bot commented Jan 19, 2023

Codecov Report

Merging #1002 (332501a) into next (364463f) will decrease coverage by 0.16%.
The diff coverage is 25.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             next    #1002      +/-   ##
==========================================
- Coverage   37.82%   37.67%   -0.16%     
==========================================
  Files          48       48              
  Lines       10849    10853       +4     
==========================================
- Hits         4104     4089      -15     
- Misses       6745     6764      +19     
Impacted Files Coverage Δ
src/backend/gl/gl_common.h 30.23% <ø> (ø)
src/backend/gl/gl_common.c 25.57% <25.00%> (-0.01%) ⬇️
src/win.c 67.44% <0.00%> (-0.81%) ⬇️
src/picom.c 65.12% <0.00%> (-0.59%) ⬇️

The rounded corner calculation only took the actual texture dimensions
into account, effectively turning all pixels outside completely
transparent. Furthermore, `texelFetch()` in the default window shader
does not work with any `GL_TEXTURE_WRAP_x` parameter.

As a result, a to-be-tiled root pixmap wasn't properly tiled and only
visible in the original top-left corner.

- Changed the default window shader to use `textureSize()` to scale the
  texture coordinates into the proper range for use with `texture2D()`.
- Added a new uniform to the default post-processing shader containing
  the effective texture size for rounded corners calculation instead of
  relying on `textureSize()`.
@tryone144 tryone144 force-pushed the fix/use-effective-texture-size-for-corner-radius branch from abbff8a to 332501a Compare January 19, 2023 23:09
@absolutelynothelix
Copy link
Collaborator

absolutelynothelix commented Jan 20, 2023

looks good, builds and works for me. merging both #1000 and this completely fixes the #970.

@yshui
Copy link
Owner

yshui commented Jun 16, 2023

Hmm, actually, should we have a different shader for root pixmap?, which by default can just do nothing.

I remember there are someone asking for something like this.

Copy link
Owner

@yshui yshui left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, sorry this took so long

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

Successfully merging this pull request may close these issues.

3 participants