Merge pull request #2913 from greg-lunarg/i2905
[platform/upstream/glslang.git] / Test / hlsl.array.flatten.frag
1
2 // uniform Texture1D g_tex3[3][2];  // TODO: legal in HLSL, but we don't handle it yet.
3
4 uniform Texture1D g_tex[3];
5 uniform Texture1D g_tex_explicit[3] : register(t1);
6
7 SamplerState g_samp[3];
8 SamplerState g_samp_explicit[3] : register(s5);
9
10 uniform float3x3 g_mats[4];
11 uniform float3x3 g_mats_explicit[4] : register(b10);
12 uniform float g_floats[4];
13
14 // uniform float g_floats[4] = { 10, 11, 12, 13 };  // TODO: ... add when initializer lists can be flattened.
15
16 float4 TestFn1()
17 {
18     return g_tex[1].Sample(g_samp[1], 0.2);
19 }
20
21 float4 TestFn2(Texture1D l_tex[3], SamplerState l_samp[3])
22 {
23     return l_tex[2].Sample(l_samp[2], 0.2);
24 }
25
26 static int not_flattened_a[5] = { 1, 2, 3, 4, 5 };
27
28 struct PS_OUTPUT { float4 color : SV_Target0; };
29
30 void main(out PS_OUTPUT ps_output)
31 {
32     // test flattening for local assignment initialization
33     SamplerState local_sampler_array[3] = g_samp;
34     Texture1D local_texture_array[3]    = g_tex;
35     float local_float_array[4]          = g_floats;
36
37     ps_output.color = TestFn1() + TestFn2(g_tex, g_samp);
38 }