Skip to content

Commit

Permalink
Fixes circles not rendering on Mesa 24.1.
Browse files Browse the repository at this point in the history
  • Loading branch information
cutephoton committed Sep 9, 2024
1 parent 3947c66 commit 4d51151
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions src/shaders/circle.fragment.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,9 @@ void main() {
#pragma mapbox: initialize lowp float stroke_opacity

vec2 extrude = v_data.xy;
float antialiased_blur = v_data.z;
float extrude_length = length(extrude);

lowp float antialiasblur = v_data.z;
float antialiased_blur = -max(blur, antialiasblur);

float opacity_t = smoothstep(0.0, antialiased_blur, extrude_length - 1.0);

float color_t = stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur, 0.0, extrude_length - radius / (radius + stroke_width));
Expand Down
2 changes: 1 addition & 1 deletion src/shaders/circle.vertex.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ void main(void) {
// This is a minimum blur distance that serves as a faux-antialiasing for
// the circle. since blur is a ratio of the circle's size and the intent is
// to keep the blur at roughly 1px, the two are inversely related.
lowp float antialiasblur = 1.0 / u_device_pixel_ratio / (radius + stroke_width);
lowp float antialiasblur = -max(1.0 / u_device_pixel_ratio / radius, blur);

v_data = vec3(extrude.x, extrude.y, antialiasblur);
}

0 comments on commit 4d51151

Please sign in to comment.