Use premultiplied colors in triangle pipelines

This commit is contained in:
Héctor Ramón Jiménez 2025-05-12 18:35:27 +02:00
parent df37d6f9bc
commit 098bd1b8a4
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
9 changed files with 37 additions and 33 deletions

View file

@ -595,7 +595,7 @@ fn fragment_target(
) -> wgpu::ColorTargetState {
wgpu::ColorTargetState {
format: texture_format,
blend: Some(wgpu::BlendState::ALPHA_BLENDING),
blend: Some(wgpu::BlendState::PREMULTIPLIED_ALPHA_BLENDING),
write_mask: wgpu::ColorWrites::ALL,
}
}
@ -754,6 +754,8 @@ mod solid {
include_str!("shader/triangle.wgsl"),
"\n",
include_str!("shader/triangle/solid.wgsl"),
"\n",
include_str!("shader/color.wgsl"),
)),
),
});
@ -913,6 +915,8 @@ mod gradient {
"shader/triangle/gradient.wgsl"
),
"\n",
include_str!("shader/color.wgsl"),
"\n",
include_str!("shader/color/oklab.wgsl")
)
} else {
@ -923,6 +927,8 @@ mod gradient {
"shader/triangle/gradient.wgsl"
),
"\n",
include_str!("shader/color.wgsl"),
"\n",
include_str!(
"shader/color/linear_rgb.wgsl"
)