diff --git a/crates/gpui/src/platform/mac/renderer.rs b/crates/gpui/src/platform/mac/renderer.rs index d291c9219ecf80b816f435f9a2261abe514a0216..2a97f4820ccd3da49104bb67a08f6d62718aacdf 100644 --- a/crates/gpui/src/platform/mac/renderer.rs +++ b/crates/gpui/src/platform/mac/renderer.rs @@ -107,7 +107,7 @@ impl Renderer { "path_atlas", "path_atlas_vertex", "path_atlas_fragment", - MTLPixelFormat::R8Unorm, + MTLPixelFormat::R16Float, ); Self { sprite_cache, @@ -827,7 +827,7 @@ fn build_path_atlas_texture_descriptor() -> metal::TextureDescriptor { let texture_descriptor = metal::TextureDescriptor::new(); texture_descriptor.set_width(2048); texture_descriptor.set_height(2048); - texture_descriptor.set_pixel_format(MTLPixelFormat::R8Unorm); + texture_descriptor.set_pixel_format(MTLPixelFormat::R16Float); texture_descriptor .set_usage(metal::MTLTextureUsage::RenderTarget | metal::MTLTextureUsage::ShaderRead); texture_descriptor.set_storage_mode(metal::MTLStorageMode::Private); diff --git a/crates/gpui/src/platform/mac/shaders/shaders.metal b/crates/gpui/src/platform/mac/shaders/shaders.metal index 13d2720fad7788ff93a58a8143dde44ced25cf41..0cf7d290f2f5bbd4ba6442b5d9bbfde855c1ed58 100644 --- a/crates/gpui/src/platform/mac/shaders/shaders.metal +++ b/crates/gpui/src/platform/mac/shaders/shaders.metal @@ -205,8 +205,6 @@ vertex SpriteFragmentInput sprite_vertex( }; } -#define MAX_WINDINGS 32. - fragment float4 sprite_fragment( SpriteFragmentInput input [[stage_in]], texture2d atlas [[ texture(GPUISpriteFragmentInputIndexAtlas) ]] @@ -216,7 +214,7 @@ fragment float4 sprite_fragment( float4 sample = atlas.sample(atlas_sampler, input.atlas_position); float mask; if (input.compute_winding) { - mask = 1. - abs(1. - fmod(sample.r * MAX_WINDINGS, 2.)); + mask = 1. - abs(1. - fmod(sample.r, 2.)); } else { mask = sample.a; } @@ -303,6 +301,6 @@ fragment float4 path_atlas_fragment( ); float f = (input.st_position.x * input.st_position.x) - input.st_position.y; float distance = f / length(gradient); - float alpha = saturate(0.5 - distance) / MAX_WINDINGS; + float alpha = saturate(0.5 - distance); return float4(alpha, 0., 0., 1.); }