rendervulkan: Do not premultiply color

The surface should already have premultiplied alpha.

Gets us to how we look with planes.
This commit is contained in:
Joshua Ashton 2021-11-13 23:34:48 +00:00 committed by Pierre-Loup A. Griffais
parent 23430084e2
commit 4ee56a1e75

View file

@ -102,8 +102,14 @@ void main() {
for (int i = 1; i < c_layerCount; i++) {
vec4 layerColor = sampleLayer(i, uv);
float layerAlpha = u_opacity[i] * layerColor.a;
outputValue = layerColor * layerAlpha + outputValue * (1.0f - layerAlpha);
// wl_surfaces come with premultiplied alpha, so that's them being
// premultiplied by layerColor.a.
// We need to then multiply that by the layer's opacity to get to our
// final premultiplied state.
// For the other side of things, we need to multiply by (1.0f - (layerColor.a * opacity))
float opacity = u_opacity[i];
float layerAlpha = opacity * layerColor.a;
outputValue = layerColor * opacity + outputValue * (1.0f - layerAlpha);
}
if (c_swapChannels)