Merge pull request #2891 from dneto0/hlsl-namespace
[platform/upstream/glslang.git] / Test / glsl.es320.subgroupQuad.comp
1 #version 320 es\r
2 \r
3 #extension GL_KHR_shader_subgroup_quad: enable\r
4 \r
5 layout (local_size_x = 8) in;\r
6 \r
7 layout(binding = 0) buffer Buffers\r
8 {\r
9     vec4  f4;\r
10     ivec4 i4;\r
11     uvec4 u4;\r
12 } data[4];\r
13 \r
14 void main()\r
15 {\r
16     uint invocation = (gl_SubgroupInvocationID + gl_SubgroupSize) % 4u;\r
17 \r
18     data[0].f4.x   = subgroupQuadBroadcast(data[0].f4.x, 1u);\r
19     data[0].f4.xy  = subgroupQuadBroadcast(data[1].f4.xy, 1u);\r
20     data[0].f4.xyz = subgroupQuadBroadcast(data[2].f4.xyz, 1u);\r
21     data[0].f4     = subgroupQuadBroadcast(data[3].f4, 1u);\r
22 \r
23     data[0].i4.x   = subgroupQuadBroadcast(data[0].i4.x, 1u);\r
24     data[0].i4.xy  = subgroupQuadBroadcast(data[1].i4.xy, 1u);\r
25     data[0].i4.xyz = subgroupQuadBroadcast(data[2].i4.xyz, 1u);\r
26     data[0].i4     = subgroupQuadBroadcast(data[3].i4, 1u);\r
27 \r
28     data[0].u4.x   = subgroupQuadBroadcast(data[0].u4.x, 1u);\r
29     data[0].u4.xy  = subgroupQuadBroadcast(data[1].u4.xy, 1u);\r
30     data[0].u4.xyz = subgroupQuadBroadcast(data[2].u4.xyz, 1u);\r
31     data[0].u4     = subgroupQuadBroadcast(data[3].u4, 1u);\r
32 \r
33     data[1].i4.x   =   int(subgroupQuadBroadcast(data[0].i4.x < 0, 1u));\r
34     data[1].i4.xy  = ivec2(subgroupQuadBroadcast(lessThan(data[1].i4.xy, ivec2(0)), 1u));\r
35     data[1].i4.xyz = ivec3(subgroupQuadBroadcast(lessThan(data[1].i4.xyz, ivec3(0)), 1u));\r
36     data[1].i4     = ivec4(subgroupQuadBroadcast(lessThan(data[1].i4, ivec4(0)), 1u));\r
37 \r
38     data[1].f4.x   = subgroupQuadSwapHorizontal(data[0].f4.x);\r
39     data[1].f4.xy  = subgroupQuadSwapHorizontal(data[1].f4.xy);\r
40     data[1].f4.xyz = subgroupQuadSwapHorizontal(data[2].f4.xyz);\r
41     data[1].f4     = subgroupQuadSwapHorizontal(data[3].f4);\r
42 \r
43     data[1].i4.x   = subgroupQuadSwapHorizontal(data[0].i4.x);\r
44     data[1].i4.xy  = subgroupQuadSwapHorizontal(data[1].i4.xy);\r
45     data[1].i4.xyz = subgroupQuadSwapHorizontal(data[2].i4.xyz);\r
46     data[1].i4     = subgroupQuadSwapHorizontal(data[3].i4);\r
47 \r
48     data[1].u4.x   = subgroupQuadSwapHorizontal(data[0].u4.x);\r
49     data[1].u4.xy  = subgroupQuadSwapHorizontal(data[1].u4.xy);\r
50     data[1].u4.xyz = subgroupQuadSwapHorizontal(data[2].u4.xyz);\r
51     data[1].u4     = subgroupQuadSwapHorizontal(data[3].u4);\r
52 \r
53     data[2].i4.x   =   int(subgroupQuadSwapHorizontal(data[0].i4.x < 0));\r
54     data[2].i4.xy  = ivec2(subgroupQuadSwapHorizontal(lessThan(data[1].i4.xy, ivec2(0))));\r
55     data[2].i4.xyz = ivec3(subgroupQuadSwapHorizontal(lessThan(data[1].i4.xyz, ivec3(0))));\r
56     data[2].i4     = ivec4(subgroupQuadSwapHorizontal(lessThan(data[1].i4, ivec4(0))));\r
57 \r
58     data[2].f4.x   = subgroupQuadSwapVertical(data[0].f4.x);\r
59     data[2].f4.xy  = subgroupQuadSwapVertical(data[1].f4.xy);\r
60     data[2].f4.xyz = subgroupQuadSwapVertical(data[2].f4.xyz);\r
61     data[2].f4     = subgroupQuadSwapVertical(data[3].f4);\r
62 \r
63     data[2].i4.x   = subgroupQuadSwapVertical(data[0].i4.x);\r
64     data[2].i4.xy  = subgroupQuadSwapVertical(data[1].i4.xy);\r
65     data[2].i4.xyz = subgroupQuadSwapVertical(data[2].i4.xyz);\r
66     data[2].i4     = subgroupQuadSwapVertical(data[3].i4);\r
67 \r
68     data[2].u4.x   = subgroupQuadSwapVertical(data[0].u4.x);\r
69     data[2].u4.xy  = subgroupQuadSwapVertical(data[1].u4.xy);\r
70     data[2].u4.xyz = subgroupQuadSwapVertical(data[2].u4.xyz);\r
71     data[2].u4     = subgroupQuadSwapVertical(data[3].u4);\r
72 \r
73     data[3].i4.x   =   int(subgroupQuadSwapVertical(data[0].i4.x < 0));\r
74     data[3].i4.xy  = ivec2(subgroupQuadSwapVertical(lessThan(data[1].i4.xy, ivec2(0))));\r
75     data[3].i4.xyz = ivec3(subgroupQuadSwapVertical(lessThan(data[1].i4.xyz, ivec3(0))));\r
76     data[3].i4     = ivec4(subgroupQuadSwapVertical(lessThan(data[1].i4, ivec4(0))));\r
77 \r
78     data[3].f4.x   = subgroupQuadSwapDiagonal(data[0].f4.x);\r
79     data[3].f4.xy  = subgroupQuadSwapDiagonal(data[1].f4.xy);\r
80     data[3].f4.xyz = subgroupQuadSwapDiagonal(data[2].f4.xyz);\r
81     data[3].f4     = subgroupQuadSwapDiagonal(data[3].f4);\r
82 \r
83     data[3].i4.x   = subgroupQuadSwapDiagonal(data[0].i4.x);\r
84     data[3].i4.xy  = subgroupQuadSwapDiagonal(data[1].i4.xy);\r
85     data[3].i4.xyz = subgroupQuadSwapDiagonal(data[2].i4.xyz);\r
86     data[3].i4     = subgroupQuadSwapDiagonal(data[3].i4);\r
87 \r
88     data[3].u4.x   = subgroupQuadSwapDiagonal(data[0].u4.x);\r
89     data[3].u4.xy  = subgroupQuadSwapDiagonal(data[1].u4.xy);\r
90     data[3].u4.xyz = subgroupQuadSwapDiagonal(data[2].u4.xyz);\r
91     data[3].u4     = subgroupQuadSwapDiagonal(data[3].u4);\r
92 \r
93     data[3].i4.x   =   int(subgroupQuadSwapDiagonal(data[0].i4.x < 0));\r
94     data[3].i4.xy  = ivec2(subgroupQuadSwapDiagonal(lessThan(data[1].i4.xy, ivec2(0))));\r
95     data[3].i4.xyz = ivec3(subgroupQuadSwapDiagonal(lessThan(data[1].i4.xyz, ivec3(0))));\r
96     data[3].i4     = ivec4(subgroupQuadSwapDiagonal(lessThan(data[1].i4, ivec4(0))));\r
97 }\r