File: spv.atomicFloat2.comp

package info (click to toggle)
glslang 16.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 51,084 kB
  • sloc: cpp: 90,714; yacc: 4,243; sh: 603; python: 305; ansic: 94; javascript: 74; makefile: 17
file content (179 lines) | stat: -rw-r--r-- 8,441 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
#version 450 core

#extension GL_KHR_memory_scope_semantics : enable
#extension GL_EXT_shader_explicit_arithmetic_types_float16 : enable
#extension GL_EXT_shader_atomic_float2: enable
#pragma use_vulkan_memory_model

layout(local_size_x = 16, local_size_y = 16) in;

layout(binding = 0) buffer Buffer
{
    float16_t datah;
    float dataf;
    double datad;
} buf;

shared float16_t    atomh;
shared float        atomf;
shared double       atomd;

layout(binding = 0, r32f) volatile coherent uniform image1D        fimage1D;
layout(binding = 1, r32f) volatile coherent uniform image1DArray   fimage1DArray;
layout(binding = 2, r32f) volatile coherent uniform image2D        fimage2D;
layout(binding = 3, r32f) volatile coherent uniform image2DArray   fimage2DArray;
layout(binding = 4, r32f) volatile coherent uniform image2DRect    fimage2DRect;
layout(binding = 5, r32f) volatile coherent uniform imageCube      fimageCube;
layout(binding = 6, r32f) volatile coherent uniform imageCubeArray fimageCubeArray;
layout(binding = 9, r32f) volatile coherent uniform image3D        fimage3D;

void main()
{
    //atomicAdd
    float16_t resulth = float16_t(0.0);
    resulth = atomicAdd(atomh, float16_t(3.0));
    resulth = atomicAdd(atomh, float16_t(4.5), gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease);
    resulth = atomicAdd(buf.datah, float16_t(3.0));
    resulth = atomicAdd(buf.datah, float16_t(4.5), gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease);

    //atomicMin
    resulth = atomicMin(atomh, float16_t(3.0));
    resulth = atomicMin(atomh, float16_t(4.5), gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease);
    resulth = atomicMin(buf.datah, float16_t(3.0));
    resulth = atomicMin(buf.datah, float16_t(4.5), gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease);

    float resultf = 0.0;
    resultf = atomicMin(atomf, 3.0);
    resultf = atomicMin(atomf, 4.5, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease);
    resultf = atomicMin(buf.dataf, 3.0);
    resultf = atomicMin(buf.dataf, 4.5, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease);

    double resultd = 0.0;
    resultd = atomicMin(atomd, 3.0);
    resultd = atomicMin(atomd, 4.5, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease);
    resultd = atomicMin(buf.datad, 3.0);
    resultd = atomicMin(buf.datad, 4.5, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease);

    //atomicMax
    resulth = atomicMax(atomh, float16_t(3.0));
    resulth = atomicMax(atomh, float16_t(4.5), gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease);
    resulth = atomicMax(buf.datah, float16_t(3.0));
    resulth = atomicMax(buf.datah, float16_t(4.5), gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease);

    resultf = atomicMax(atomf, 3.0);
    resultf = atomicMax(atomf, 4.5, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease);
    resultf = atomicMax(buf.dataf, 3.0);
    resultf = atomicMax(buf.dataf, 4.5, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease);

    resultd = atomicMax(atomd, 3.0);
    resultd = atomicMax(atomd, 4.5, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease);
    resultd = atomicMax(buf.datad, 3.0);
    resultd = atomicMax(buf.datad, 4.5, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease);

    //atomicExchange
    resulth = atomicExchange(buf.datah, resulth);
    buf.datah += resulth;
    resulth = atomicExchange(buf.datah, resulth, gl_ScopeDevice, gl_StorageSemanticsShared, gl_SemanticsAcquireRelease);
    buf.datah += resulth;
    resulth = atomicExchange(atomh, resulth);
    buf.datah += resulth;
    resulth = atomicExchange(atomh, resulth, gl_ScopeDevice, gl_StorageSemanticsShared, gl_SemanticsAcquireRelease);
    buf.datah += resulth;

    //atomic load/store
    resulth = atomicLoad(buf.datah, gl_ScopeDevice, gl_StorageSemanticsShared, gl_SemanticsAcquire);
    atomicStore(buf.datah, resulth, gl_ScopeDevice, gl_StorageSemanticsShared, gl_SemanticsRelease);
    buf.datah += resulth;

    resulth = atomicLoad(atomh, gl_ScopeDevice, gl_StorageSemanticsShared, gl_SemanticsAcquire);
    atomicStore(atomh, resulth, gl_ScopeDevice, gl_StorageSemanticsShared, gl_SemanticsRelease);
    buf.datah += resulth;

    // image atomics on 1D:
    atomf = imageAtomicMin(fimage1D, int(0), 2.0);
    buf.dataf += atomf;
    atomf = imageAtomicMin(fimage1D, int(1), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsAcquireRelease);
    buf.dataf += atomf;

    atomf = imageAtomicMax(fimage1D, int(0), 2.0);
    buf.dataf += atomf;
    atomf = imageAtomicMax(fimage1D, int(1), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsAcquireRelease);
    buf.dataf += atomf;

    // image atomics on 1D Array:
    atomf = imageAtomicMin(fimage1DArray, ivec2(0,0), 2.0);
    buf.dataf += atomf;
    atomf = imageAtomicMin(fimage1DArray, ivec2(1,1), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsAcquireRelease);
    buf.dataf += atomf;

    atomf = imageAtomicMax(fimage1DArray, ivec2(0,0), 2.0);
    buf.dataf += atomf;
    atomf = imageAtomicMax(fimage1DArray, ivec2(1,1), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsAcquireRelease);
    buf.dataf += atomf;

    // image atomics on 2D:
    atomf = imageAtomicMin(fimage2D, ivec2(0,0), 2.0);
    buf.dataf += atomf;
    atomf = imageAtomicMin(fimage2D, ivec2(1,1), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsAcquireRelease);
    buf.dataf += atomf;

    atomf = imageAtomicMax(fimage2D, ivec2(0,0), 2.0);
    buf.dataf += atomf;
    atomf = imageAtomicMax(fimage2D, ivec2(1,1), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsAcquireRelease);
    buf.dataf += atomf;

    // image atomics on 2D Rect:
    atomf = imageAtomicMin(fimage2DRect, ivec2(0,0), 2.0);
    buf.dataf += atomf;
    atomf = imageAtomicMin(fimage2DRect, ivec2(1,1), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsAcquireRelease);
    buf.dataf += atomf;

    atomf = imageAtomicMax(fimage2DRect, ivec2(0,0), 2.0);
    buf.dataf += atomf;
    atomf = imageAtomicMax(fimage2DRect, ivec2(1,1), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsAcquireRelease);
    buf.dataf += atomf;

    // image atomics on 2D Array:
    atomf = imageAtomicMin(fimage2DArray, ivec3(0,0,0), 2.0);
    buf.dataf += atomf;
    atomf = imageAtomicMin(fimage2DArray, ivec3(1,1,0), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsAcquireRelease);
    buf.dataf += atomf;

    atomf = imageAtomicMax(fimage2DArray, ivec3(0,0,0), 2.0);
    buf.dataf += atomf;
    atomf = imageAtomicMax(fimage2DArray, ivec3(1,1,0), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsAcquireRelease);
    buf.dataf += atomf;

    // image atomics on Cube:
    atomf = imageAtomicMin(fimageCube, ivec3(0,0,0), 2.0);
    buf.dataf += atomf;
    atomf = imageAtomicMin(fimageCube, ivec3(1,1,0), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsAcquireRelease);
    buf.dataf += atomf;

    atomf = imageAtomicMax(fimageCube, ivec3(0,0,0), 2.0);
    buf.dataf += atomf;
    atomf = imageAtomicMax(fimageCube, ivec3(1,1,0), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsAcquireRelease);
    buf.dataf += atomf;

    // image atomics on Cube Array:
    atomf = imageAtomicMin(fimageCubeArray, ivec3(0,0,0), 2.0);
    buf.dataf += atomf;
    atomf = imageAtomicMin(fimageCubeArray, ivec3(1,1,0), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsAcquireRelease);
    buf.dataf += atomf;

    atomf = imageAtomicMax(fimageCubeArray, ivec3(0,0,0), 2.0);
    buf.dataf += atomf;
    atomf = imageAtomicMax(fimageCubeArray, ivec3(1,1,0), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsAcquireRelease);
    buf.dataf += atomf;

    // image atomics on 3D:
    atomf = imageAtomicMin(fimage3D, ivec3(0,0,0), 2.0);
    buf.dataf += atomf;
    atomf = imageAtomicMin(fimage3D, ivec3(1,1,0), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsAcquireRelease);
    buf.dataf += atomf;

    atomf = imageAtomicMax(fimage3D, ivec3(0,0,0), 2.0);
    buf.dataf += atomf;
    atomf = imageAtomicMax(fimage3D, ivec3(1,1,0), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsAcquireRelease);
    buf.dataf += atomf;
}