summaryrefslogtreecommitdiffstats
path: root/src/gui/painting/shaders/backingstorecompose.frag
diff options
context:
space:
mode:
authorMarcus Comstedt <marcus@mc.pp.se>2022-07-24 23:15:42 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-08-04 22:38:00 +0000
commit5d6bc9140ed53eb59e28410e0900f8e07f46d4bd (patch)
tree92ba2838bc78c26e01b201e00d561a0ca5ac1aeb /src/gui/painting/shaders/backingstorecompose.frag
parent9258a78b223255b3f778ec356bce88cd1615818c (diff)
Fix composition of render-to-texture widgets on big endian
Converting from QImage::Format_ARGB32 to QRhiTexture::RGBA8 requires texture swizzling also on big endian. But unlike on little endian it is not a red/blue swap that is needed, but a rather rotation of the alpha channel from the first component to the last. Add a new swizzling mode to the backingstorecompose fragment shader, and rename the uniform to reflect that it no longer covers only red/blue swapping. Change-Id: I001d275abdc88faaadea16e396ebe032b34e83f0 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> (cherry picked from commit d2fcccd3f1c5e3729c280a6f0a3e12dc9835477b) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/gui/painting/shaders/backingstorecompose.frag')
-rw-r--r--src/gui/painting/shaders/backingstorecompose.frag8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/gui/painting/shaders/backingstorecompose.frag b/src/gui/painting/shaders/backingstorecompose.frag
index e0c419840e..3b08ade035 100644
--- a/src/gui/painting/shaders/backingstorecompose.frag
+++ b/src/gui/painting/shaders/backingstorecompose.frag
@@ -7,7 +7,7 @@ layout(std140, binding = 0) uniform buf {
mat4 vertexTransform;
mat3 textureTransform;
float opacity;
- int swapRedBlue;
+ int textureSwizzle;
};
layout(binding = 1) uniform sampler2D textureSampler;
@@ -16,8 +16,10 @@ void main()
{
vec4 tmpFragColor = texture(textureSampler, v_texcoord);
tmpFragColor.a *= opacity;
- if (swapRedBlue == 0)
+ if (textureSwizzle == 0)
fragColor = tmpFragColor;
+ else if(textureSwizzle == 2)
+ fragColor.argb = tmpFragColor;
else
- fragColor = tmpFragColor.bgra;
+ fragColor.bgra = tmpFragColor;
}