rendervulkan: Don't calculate a garbage alpha value.
This commit is contained in:
parent
35b381ce51
commit
2d537df252
2 changed files with 6 additions and 7 deletions
|
@ -35,10 +35,10 @@ void main() {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
vec2 uv = vec2(coord);
|
vec2 uv = vec2(coord);
|
||||||
vec4 outputValue = vec4(0.0f);
|
vec3 outputValue = vec3(0.0f);
|
||||||
|
|
||||||
if (c_layerCount > 0)
|
if (c_layerCount > 0)
|
||||||
outputValue = sampleLayer(0, uv) * u_opacity[0];
|
outputValue = sampleLayer(0, uv).rgb * u_opacity[0];
|
||||||
|
|
||||||
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);
|
||||||
|
@ -49,10 +49,11 @@ void main() {
|
||||||
// For the other side of things, we need to multiply by (1.0f - (layerColor.a * opacity))
|
// For the other side of things, we need to multiply by (1.0f - (layerColor.a * opacity))
|
||||||
float opacity = u_opacity[i];
|
float opacity = u_opacity[i];
|
||||||
float layerAlpha = opacity * layerColor.a;
|
float layerAlpha = opacity * layerColor.a;
|
||||||
outputValue = layerColor * opacity + outputValue * (1.0f - layerAlpha);
|
outputValue = layerColor.rgb * opacity + outputValue * (1.0f - layerAlpha);
|
||||||
}
|
}
|
||||||
|
|
||||||
imageStore(dst, ivec2(coord), linearToSrgb(outputValue));
|
outputValue = linearToSrgb(outputValue);
|
||||||
|
imageStore(dst, ivec2(coord), vec4(outputValue, 0));
|
||||||
|
|
||||||
// Indicator to quickly tell if we're in the compositing path or not.
|
// Indicator to quickly tell if we're in the compositing path or not.
|
||||||
if (c_compositing_debug)
|
if (c_compositing_debug)
|
||||||
|
|
|
@ -71,9 +71,7 @@ void rcasComposite(uvec2 pos)
|
||||||
outputValue = linearToSrgb(outputValue);
|
outputValue = linearToSrgb(outputValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
imageStore(dst, ivec2(pos), vec4(outputValue, 0));
|
||||||
float undef;
|
|
||||||
imageStore(dst, ivec2(pos), vec4(outputValue, undef));
|
|
||||||
|
|
||||||
if (c_compositing_debug)
|
if (c_compositing_debug)
|
||||||
compositing_debug(pos);
|
compositing_debug(pos);
|
||||||
|
|
Loading…
Reference in a new issue