qt5base-lts/tests/auto/gui/rhi/qrhi/data/simpletextured_array.frag
Laszlo Agocs c3ae30085e rhi: Add support for arrays of combined image samplers
Introduces a new QRhiShaderResourceBinding function that takes an array
of texture-sampler pairs. The existing function is also available and is
equivalent to calling the array-based version with array size 1.

It is important to note that for Metal one needs MSL 2.0 for array of
textures, so qsb needs --msl 20 instead of --msl 12 for such shaders.

Comes with an autotest, and also updates all .qsb files for said test
with the latest shadertools.

Task-number: QTBUG-82624
Change-Id: Ibc1973aae826836f16d842c41d6c8403fd7ff876
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2020-03-05 19:40:41 +01:00

18 lines
433 B
GLSL

#version 440
layout(location = 0) in vec2 uv;
layout(location = 0) out vec4 fragColor;
layout(binding = 0) uniform sampler2D tex[3];
void main()
{
vec4 c0 = texture(tex[0], uv);
vec4 c1 = texture(tex[1], uv);
vec4 c2 = texture(tex[2], uv);
vec4 cc = c0 + c1 + c2;
vec4 c = vec4(clamp(cc.r, 0.0, 1.0), clamp(cc.g, 0.0, 1.0), clamp(cc.b, 0.0, 1.0), clamp(cc.a, 0.0, 1.0));
c.rgb *= c.a;
fragColor = c;
}