From 2274a218daa05b4ec76bcfa8ce677a170082efd7 Mon Sep 17 00:00:00 2001 From: Lucien Greathouse Date: Mon, 23 Oct 2023 19:08:51 -0400 Subject: [PATCH] Correctly handle alpha in wgpu text shader --- crates/yakui-wgpu/shaders/text.wgsl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/yakui-wgpu/shaders/text.wgsl b/crates/yakui-wgpu/shaders/text.wgsl index 05d96004..e4e1db40 100644 --- a/crates/yakui-wgpu/shaders/text.wgsl +++ b/crates/yakui-wgpu/shaders/text.wgsl @@ -31,6 +31,8 @@ fn vs_main( @fragment fn fs_main(in: VertexOutput) -> @location(0) vec4 { - var coverage = textureSample(coverage_texture, coverage_sampler, in.texcoord).r; - return in.color * coverage; + let coverage = textureSample(coverage_texture, coverage_sampler, in.texcoord).r; + let alpha = coverage * in.color.a; + + return vec4(in.color.rgb * alpha, alpha); } \ No newline at end of file