Use pre-multiplied alpha for path rasterization

This commit is contained in:
Max Brunsfeld 2025-07-28 17:52:55 -07:00
parent e9697e4639
commit 8eea9aad40
2 changed files with 3 additions and 2 deletions

View file

@ -1377,7 +1377,7 @@ fn create_blend_state(device: &ID3D11Device) -> Result<ID3D11BlendState> {
desc.RenderTarget[0].BlendEnable = true.into();
desc.RenderTarget[0].BlendOp = D3D11_BLEND_OP_ADD;
desc.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD;
desc.RenderTarget[0].SrcBlend = D3D11_BLEND_SRC_ALPHA;
desc.RenderTarget[0].SrcBlend = D3D11_BLEND_ONE;
desc.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_ONE;
desc.RenderTarget[0].DestBlend = D3D11_BLEND_INV_SRC_ALPHA;
desc.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_ONE;

View file

@ -957,7 +957,8 @@ float4 paths_fragment(PathFragmentInput input): SV_Target {
float4 color = gradient_color(background, input.position.xy, input.bounds,
input.solid_color, input.color0, input.color1);
return color;
// Return premultiplied alpha for correct blending
return float4(color.rgb * color.a, color.a);
}
// --- path sprite --- //