diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2020-03-03 14:24:11 +0100 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2020-03-05 19:40:41 +0100 |
commit | c3ae30085e4047ee7d5a945c36e2055c2de5197d (patch) | |
tree | 4a4e8c2b3ef2a3a9353965d4c49832765f785593 /tests/auto/gui/rhi/qrhi/data/simpletextured_array.frag | |
parent | e1e0862990dbe00462f7faa02845a640a3d84155 (diff) |
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>
Diffstat (limited to 'tests/auto/gui/rhi/qrhi/data/simpletextured_array.frag')
-rw-r--r-- | tests/auto/gui/rhi/qrhi/data/simpletextured_array.frag | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/auto/gui/rhi/qrhi/data/simpletextured_array.frag b/tests/auto/gui/rhi/qrhi/data/simpletextured_array.frag new file mode 100644 index 0000000000..c5ee2057d8 --- /dev/null +++ b/tests/auto/gui/rhi/qrhi/data/simpletextured_array.frag @@ -0,0 +1,17 @@ +#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; +} |