Debian Codegraph @

third_party/spirv-cross/shaders/comp/defer-parens.comp

raw
1 #version 310 es
2 layout(local_size_x = 1) in;
3
4 layout(binding = 0, std430) buffer SSBO
5 {
6 vec4 data;
7 int index;
8 };
9
10 void main()
11 {
12 // Tests defer-parens behavior where a binary expression is OpCompositeExtracted chained together
13 // with an OpCompositeConstruct optimization.
14 vec4 d = data;
15 data = vec4(d.x, d.yz + 10.0, d.w);
16
17 // Verify binary ops.
18 data = d + d + d;
19
20 // Verify swizzles.
21 data = (d.yz + 10.0).xxyy;
22
23 // OpCompositeExtract
24 float t = (d.yz + 10.0).y;
25 data = vec4(t);
26
27 // OpVectorExtractDynamic
28 t = (d.zw + 10.0)[index];
29 data = vec4(t);
30 }