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

Add a case for shadows when blur_radius = 0 #22441

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

Conversation

iamnbutler
Copy link
Member

@iamnbutler iamnbutler commented Dec 27, 2024

Closes #22433

Before/After (macOS):

CleanShot 2024-12-26 at 22 41 11@2x

For some reason the non-blurred one seems much lower quality, so we may need to tinker with the samples, or something else.

CleanShot 2024-12-26 at 22 42 12@2x

I'm unsure if this is a problem on Linux/in the Blade renderer, but since no changes were made outside of the medal shaders we can probably take this macOS-specific win for now.

Release Notes:

  • gpui: Fixed an issue where shadows with a blur_radius of 0 would not render.

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Dec 27, 2024
@iamnbutler iamnbutler requested a review from as-cii December 27, 2024 03:38
@iamnbutler iamnbutler added macOS Platform-specific feedback for macOS behaviors, features, design, etc gpui GPUI rendering framework support labels Dec 27, 2024
@iamnbutler iamnbutler marked this pull request as ready for review December 27, 2024 03:52
float distance = length(max(float2(0., 0.), rounded_edge_to_point)) +
min(0., max(rounded_edge_to_point.x, rounded_edge_to_point.y)) -
corner_radius;
alpha = distance <= 0. ? 1. : 0.;
Copy link
Contributor

Choose a reason for hiding this comment

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

Does metal have something like the GLSL smoothstep()? With appropriate threshold values using that instead of the hard conditional here should fix the aliased edges nicely.

Copy link
Member Author

Choose a reason for hiding this comment

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

oh, I'll take a look!

Copy link
Contributor

Choose a reason for hiding this comment

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

Alternatively a simple alpha = (1.0 - min(1.0, distance * distance)) should look good too.

@jansol
Copy link
Contributor

jansol commented Dec 27, 2024

Blade shaders are directly transcribed from the metal ones so they'll need the same fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed The user has signed the Contributor License Agreement gpui GPUI rendering framework support macOS Platform-specific feedback for macOS behaviors, features, design, etc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

gpui: Drop shadows with no blur are not rendered
2 participants