• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#version 310 es
2
3struct Output
4{
5   vec4 a;
6   vec2 b;
7};
8
9layout(location = 0) out Output vout;
10
11void main()
12{
13   Output s = Output(vec4(0.5), vec2(0.25));
14
15   // Write whole struct.
16   vout = s;
17   // Write whole struct again, checks for scoping.
18   vout = s;
19
20   // Read it back.
21   Output tmp = vout;
22
23   // Write elements individually.
24   vout.a = tmp.a;
25   vout.b = tmp.b;
26
27   // Write individual elements.
28   vout.a.x = 1.0;
29   vout.b.y = 1.0;
30
31   // Read individual elements.
32   float c = vout.a.x;
33}
34