Skip to content

Commit

Permalink
Correctly handle alpha in wgpu text shader
Browse files Browse the repository at this point in the history
  • Loading branch information
LPGhatguy committed Oct 23, 2023
1 parent afc561b commit 2274a21
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions crates/yakui-wgpu/shaders/text.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ fn vs_main(

@fragment
fn fs_main(in: VertexOutput) -> @location(0) vec4<f32> {
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);
}

0 comments on commit 2274a21

Please sign in to comment.