From ada1c7f89d7d7ccdc4be2e60c1fe99861a51c3ce Mon Sep 17 00:00:00 2001 From: Georg Lehmann Date: Sat, 12 Feb 2022 17:31:02 +0100 Subject: [PATCH] rendervulkan: Do rcas opacity in the correct colorspace if we calculate it anyway. --- src/shaders/cs_composite_rcas.comp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/shaders/cs_composite_rcas.comp b/src/shaders/cs_composite_rcas.comp index 44afabc..1ad2927 100644 --- a/src/shaders/cs_composite_rcas.comp +++ b/src/shaders/cs_composite_rcas.comp @@ -51,14 +51,18 @@ void rcasComposite(uvec2 pos) if (all(lessThan(rcasPos, layer0Extent))) { FsrRcasF(outputValue.r, outputValue.g, outputValue.b, rcasPos, u_c1.xxxx); - // Technically the wrong color space but doing srgb -> linear -> srgb just for - // scaling is silly. This is good enough. - outputValue *= u_opacity[0]; + if (c_layerCount == 1) { + // Technically the wrong color space if you just have one layer. + // but doing srgb -> linear -> srgb just for scaling is silly. This is good enough. + outputValue *= u_opacity[0]; + } } } + if (c_layerCount > 1) { outputValue = srgbToLinear(outputValue); + outputValue *= u_opacity[0]; vec2 uv = vec2(pos); for (int i = 1; i < c_layerCount; i++) {