• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#version 450
2
3layout(rgba32f, binding = 0)    uniform image1D         i1D;
4layout(rgba32f, binding = 1)    uniform image2D         i2D;
5layout(rgba32f, binding = 2)    uniform image3D         i3D;
6layout(rgba32f, binding = 3)    uniform imageCube       iCube;
7layout(rgba32f, binding = 4)    uniform imageCubeArray  iCubeArray;
8layout(rgba32f, binding = 5)    uniform image2DRect     i2DRect;
9layout(rgba32f, binding = 6)    uniform image1DArray    i1DArray;
10layout(rg16, binding = 7)       uniform image2DArray    i2DArray;
11layout(rgba32f, binding = 8)    uniform imageBuffer     iBuffer;
12layout(rgba32f, binding = 9)    uniform image2DMS       i2DMS;
13layout(rgba32f, binding = 10)   uniform image2DMSArray  i2DMSArray;
14
15layout(r32i,    binding = 11)   uniform iimage1D        ii1D;
16layout(r32ui,   binding = 12)   uniform uimage2D        ui2D;
17layout(r32i,    binding = 13)   uniform iimage2DMS      ii2DMS;
18layout(r32ui,   binding = 14)   uniform uimage2DMSArray ui2DMSArray;
19
20flat in int     ic1D;
21flat in ivec2   ic2D;
22flat in ivec3   ic3D;
23flat in ivec4   ic4D;
24
25writeonly layout(binding = 1)   uniform image2D         wo2D;
26
27flat in uint value;
28
29out vec4 fragData;
30
31void main()
32{
33    ivec3 iv = ivec3(0);
34    iv.x    += imageSize(i1D);
35    iv.xy   += imageSize(i2D);
36    iv.xyz  += imageSize(i3D);
37    iv.xy   += imageSize(iCube);
38    iv.xyz  += imageSize(iCubeArray);
39    iv.xy   += imageSize(i2DRect);
40    iv.xy   += imageSize(i1DArray);
41    iv.xyz  += imageSize(i2DArray);
42    iv.x    += imageSize(iBuffer);
43    iv.xy   += imageSize(i2DMS);
44    iv.xyz  += imageSize(i2DMSArray);
45
46    iv.x    += imageSamples(i2DMS);
47    iv.x    += imageSamples(i2DMSArray);
48
49    vec4 v = vec4(0.0);
50    v += imageLoad(i1D, ic1D);
51    imageStore(i1D, ic1D, v);
52    v += imageLoad(i2D, ic2D);
53    imageStore(i2D, ic2D, v);
54    v += imageLoad(i3D, ic3D);
55    imageStore(i3D, ic3D, v);
56    v += imageLoad(iCube, ic3D);
57    imageStore(iCube, ic3D, v);
58    v += imageLoad(iCubeArray, ic3D);
59    imageStore(iCubeArray, ic3D, v);
60    v += imageLoad(i2DRect, ic2D);
61    imageStore(i2DRect, ic2D, v);
62    v += imageLoad(i1DArray, ic2D);
63    imageStore(i1DArray, ic2D, v);
64    v += imageLoad(i2DArray, ic3D);
65    imageStore(i2DArray, ic3D, v);
66    v += imageLoad(iBuffer, ic1D);
67    imageStore(iBuffer, ic1D, v);
68    v += imageLoad(i2DMS, ic2D, 1);
69    imageStore(i2DMS, ic2D, 2, v);
70    v += imageLoad(i2DMSArray, ic3D, 3);
71    imageStore(i2DMSArray, ic3D, 4, v);
72
73    uint ui = 0;
74    iv.x    += imageAtomicAdd(ii1D, ic1D, 10);
75    ui      += imageAtomicAdd(ui2D, ic2D, value);
76    iv.x    += imageAtomicMin(ii1D, ic1D, 11);
77    ui      += imageAtomicMin(ui2D, ic2D, value);
78    iv.x    += imageAtomicMax(ii1D, ic1D, 12);
79    ui      += imageAtomicMax(ui2D, ic2D, value);
80    iv.x    += imageAtomicAnd(ii1D, ic1D, 13);
81    ui      += imageAtomicAnd(ui2D, ic2D, value);
82    iv.x    += imageAtomicOr(ii1D, ic1D, 14);
83    ui      += imageAtomicOr(ui2D, ic2D, value);
84    iv.x    += imageAtomicXor(ii1D, ic1D, 15);
85    ui      += imageAtomicXor(ui2D, ic2D, value);
86    iv.x    += imageAtomicExchange(ii1D, ic1D, 16);
87    ui      += imageAtomicExchange(ui2D, ic2D, value);
88    iv.x    += imageAtomicCompSwap(ii1D, ic1D, 18, 17);
89    ui      += imageAtomicCompSwap(ui2D, ic2D, 19u, value);
90    iv.x    += imageAtomicCompSwap(ii2DMS, ic2D, 2, 18, 17);
91    ui      += imageAtomicCompSwap(ui2DMSArray, ic3D, 3, 19u, value);
92
93    imageStore(wo2D, ic2D, v);
94
95    fragData = ui != iv.y ? v : vec4(0.0);
96}
97
98