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:
parent
23430084e2
commit
4ee56a1e75
1 changed files with 8 additions and 2 deletions
|
@ -102,8 +102,14 @@ void main() {
|
||||||
|
|
||||||
for (int i = 1; i < c_layerCount; i++) {
|
for (int i = 1; i < c_layerCount; i++) {
|
||||||
vec4 layerColor = sampleLayer(i, uv);
|
vec4 layerColor = sampleLayer(i, uv);
|
||||||
float layerAlpha = u_opacity[i] * layerColor.a;
|
// wl_surfaces come with premultiplied alpha, so that's them being
|
||||||
outputValue = layerColor * layerAlpha + outputValue * (1.0f - layerAlpha);
|
// 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)
|
if (c_swapChannels)
|
||||||
|
|
Loading…
Reference in a new issue