File: spv.memoryScopeSemantics.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 (149 lines) | stat: -rw-r--r-- 13,730 bytes parent folder | download | duplicates (4)
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
#version 450
#extension GL_KHR_memory_scope_semantics : require
#extension GL_ARB_gpu_shader_int64 : require

#pragma use_vulkan_memory_model

shared uint value;
shared int atomi;
shared uint atomu;
layout(binding = 0, r32ui) workgroupcoherent uniform uimage2D imageu;
layout(binding = 1, r32i) volatile coherent uniform iimage2D imagei;
layout(binding = 5, r32i) nonprivate uniform iimage2D imagej[2];
layout (binding = 2) buffer BufferU { workgroupcoherent uint x; } bufferu;
layout (binding = 3) coherent buffer BufferI { uint x; } bufferi;
struct A { uint x[2]; };
layout (binding = 4) volatile buffer BufferJ { subgroupcoherent A a; } bufferj[2];
layout (binding = 6) nonprivate uniform sampler2D samp[2];
layout (binding = 7) nonprivate uniform BufferK { uint x; } bufferk;
shared uint64_t atomu64;
shared int64_t atomi64;
layout (binding = 8) volatile buffer BufferL { uint x; } bufferl;
layout (binding = 9) buffer BufferM { volatile uint x; } bufferm;
layout(binding = 10, r32i) volatile coherent uniform iimage2DMS imageMS;


void main()
{
    int origi = atomicAdd(atomi, 3, gl_ScopeDevice, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsRelease);
    uint origu = atomicAnd(atomu, value);
    origi = atomicLoad(atomi, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquire);
    atomicStore(atomu, value, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelease);
    origi = imageAtomicLoad(imagei, ivec2(0,0), gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquire);
    origu = imageAtomicAdd(imageu, ivec2(0,0), 3u, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquire);
    imageAtomicStore(imageu, ivec2(0,0), 4u, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelease);
    origu = atomicOr(atomu, 7u, gl_ScopeDevice, 0, 0);
    origu = atomicXor(atomu, 7u, gl_ScopeDevice, 0, 0);
    origu = atomicMin(atomu, value, gl_ScopeDevice, 0, 0);
    origi = atomicMax(atomi, 7, gl_ScopeDevice, 0, 0);
    origi = atomicExchange(atomi, origi, gl_ScopeDevice, 0, 0);
    origu = atomicCompSwap(atomu, 10u, value, gl_ScopeDevice, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsAcquire, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsAcquire);
    atomicAdd(bufferu.x, 1, gl_ScopeDevice, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsRelease);

    uint y;
    y = bufferu.x;
    bufferu.x = y;
    y = bufferi.x;
    y = bufferj[0].a.x[1];
    bufferi.x = y;
    bufferj[0].a.x[1] = y;
    bufferj[0].a = bufferj[1].a;
    bufferi.x = bufferk.x;

    imageLoad(imagei, ivec2(0,0));
    imageLoad(imagej[0], ivec2(0,0));
    imageStore(imagej[1], ivec2(0,0), ivec4(0,0,0,0));
    texture(samp[0], vec2(0,0));

    atomu64 = atomicMax(atomu64, uint64_t(7), gl_ScopeDevice, 0, 0);
    atomicCompSwap(atomi64, int64_t(10), int64_t(atomu64), gl_ScopeDevice, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsAcquire, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsAcquire);

    y = bufferl.x;
    atomicAdd(bufferl.x, 1);
    atomicOr(bufferm.x, 2);
    imageAtomicAdd(imagei, ivec2(0,0), 3);
    atomicAdd(bufferu.x, 4u, gl_ScopeDevice, 0, 0);
    atomicAdd(bufferu.x, 5u, gl_ScopeDevice, 0, gl_SemanticsVolatile);

    imageAtomicStore(imageMS, ivec2(0,0), 1, 4, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelease);
    imageAtomicStore(imagei, ivec2(0,0), -7, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelease);

    controlBarrier(gl_ScopeWorkgroup, gl_ScopeWorkgroup, 0, 0);
    controlBarrier(gl_ScopeWorkgroup, gl_ScopeWorkgroup, gl_StorageSemanticsBuffer, gl_SemanticsAcquire);
    controlBarrier(gl_ScopeWorkgroup, gl_ScopeWorkgroup, gl_StorageSemanticsBuffer, gl_SemanticsRelease);
    controlBarrier(gl_ScopeWorkgroup, gl_ScopeWorkgroup, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease);
    controlBarrier(gl_ScopeWorkgroup, gl_ScopeWorkgroup, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsAcquireRelease);
    controlBarrier(gl_ScopeWorkgroup, gl_ScopeWorkgroup, gl_StorageSemanticsBuffer, gl_SemanticsAcquire | gl_SemanticsMakeVisible);
    controlBarrier(gl_ScopeWorkgroup, gl_ScopeWorkgroup, gl_StorageSemanticsBuffer, gl_SemanticsRelease | gl_SemanticsMakeAvailable);
    controlBarrier(gl_ScopeWorkgroup, gl_ScopeWorkgroup, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsAcquireRelease | gl_SemanticsMakeVisible | gl_SemanticsMakeAvailable);

    memoryBarrier(gl_ScopeWorkgroup, gl_StorageSemanticsBuffer, gl_SemanticsAcquire);
    memoryBarrier(gl_ScopeWorkgroup, gl_StorageSemanticsBuffer, gl_SemanticsRelease);
    memoryBarrier(gl_ScopeWorkgroup, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease);
    memoryBarrier(gl_ScopeWorkgroup, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsAcquireRelease);
    memoryBarrier(gl_ScopeWorkgroup, gl_StorageSemanticsBuffer, gl_SemanticsAcquire | gl_SemanticsMakeVisible);
    memoryBarrier(gl_ScopeWorkgroup, gl_StorageSemanticsBuffer, gl_SemanticsRelease | gl_SemanticsMakeAvailable);
    memoryBarrier(gl_ScopeWorkgroup, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsAcquireRelease | gl_SemanticsMakeVisible | gl_SemanticsMakeAvailable);

    origu = atomicLoad(atomu, gl_ScopeDevice, 0, 0);
    origu = atomicLoad(atomu, gl_ScopeDevice, 0, gl_SemanticsVolatile);
    origu = atomicLoad(atomu, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquire);
    origu = atomicLoad(atomu, gl_ScopeDevice, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsAcquire);
    origu = atomicLoad(atomu, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquire | gl_SemanticsVolatile);
    origu = atomicLoad(atomu, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquire | gl_SemanticsMakeVisible);
    origu = atomicLoad(atomu, gl_ScopeDevice, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsAcquire | gl_SemanticsMakeVisible | gl_SemanticsVolatile);

    atomicStore(atomu, 10U, gl_ScopeDevice, 0, 0);
    atomicStore(atomu, 10U, gl_ScopeDevice, 0, gl_SemanticsVolatile);
    atomicStore(atomu, 10U, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelease);
    atomicStore(atomu, 10U, gl_ScopeDevice, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsRelease);
    atomicStore(atomu, 10U, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelease | gl_SemanticsVolatile);
    atomicStore(atomu, 10U, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelease | gl_SemanticsMakeAvailable);
    atomicStore(atomu, 10U, gl_ScopeDevice, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsRelease | gl_SemanticsMakeAvailable | gl_SemanticsVolatile);

    origu = atomicAnd(atomu, 10U, gl_ScopeDevice, 0, 0);
    origu = atomicAnd(atomu, 10U, gl_ScopeDevice, 0, gl_SemanticsVolatile);
    origu = atomicAnd(atomu, 10U, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquire);
    origu = atomicAnd(atomu, 10U, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelease);
    origu = atomicAnd(atomu, 10U, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease);
    origu = atomicAnd(atomu, 10U, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquire | gl_SemanticsVolatile);
    origu = atomicAnd(atomu, 10U, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelease | gl_SemanticsVolatile);
    origu = atomicAnd(atomu, 10U, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease | gl_SemanticsVolatile);
    origu = atomicAnd(atomu, 10U, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquire | gl_SemanticsMakeVisible);
    origu = atomicAnd(atomu, 10U, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelease | gl_SemanticsMakeAvailable);
    origu = atomicAnd(atomu, 10U, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease | gl_SemanticsMakeVisible | gl_SemanticsMakeAvailable);
    origu = atomicAnd(atomu, 10U, gl_ScopeDevice, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsAcquireRelease | gl_SemanticsMakeVisible | gl_SemanticsMakeAvailable);
    origu = atomicAnd(atomu, 10U, gl_ScopeDevice, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsAcquireRelease | gl_SemanticsMakeVisible | gl_SemanticsMakeAvailable | gl_SemanticsVolatile);

    atomicCompSwap(atomu, 10U, 20U, gl_ScopeDevice, 0, 0, 0, 0);
    atomicCompSwap(atomu, 10U, 20U, gl_ScopeDevice, 0, gl_SemanticsVolatile, 0, gl_SemanticsVolatile);
    atomicCompSwap(atomu, 10U, 20U, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquire, 0, 0);
    atomicCompSwap(atomu, 10U, 20U, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelease, 0, 0);
    atomicCompSwap(atomu, 10U, 20U, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease, 0, 0);
    atomicCompSwap(atomu, 10U, 20U, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquire | gl_SemanticsVolatile, 0, gl_SemanticsVolatile);
    atomicCompSwap(atomu, 10U, 20U, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelease | gl_SemanticsVolatile, 0, gl_SemanticsVolatile);
    atomicCompSwap(atomu, 10U, 20U, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease | gl_SemanticsVolatile, 0, gl_SemanticsVolatile);
    atomicCompSwap(atomu, 10U, 20U, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquire | gl_SemanticsMakeVisible, 0, 0);
    atomicCompSwap(atomu, 10U, 20U, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelease | gl_SemanticsMakeAvailable, 0, 0);
    atomicCompSwap(atomu, 10U, 20U, gl_ScopeDevice, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsAcquireRelease | gl_SemanticsMakeVisible | gl_SemanticsMakeAvailable, 0, 0);
    atomicCompSwap(atomu, 10U, 20U, gl_ScopeDevice, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsAcquireRelease | gl_SemanticsMakeVisible | gl_SemanticsMakeAvailable | gl_SemanticsVolatile, 0, gl_SemanticsVolatile);

    atomicCompSwap(atomu, 10U, 20U, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquire, gl_StorageSemanticsBuffer, gl_SemanticsAcquire);
    atomicCompSwap(atomu, 10U, 20U, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquire | gl_SemanticsVolatile, gl_StorageSemanticsBuffer, gl_SemanticsAcquire | gl_SemanticsVolatile);
    atomicCompSwap(atomu, 10U, 20U, gl_ScopeDevice, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsAcquire, gl_StorageSemanticsBuffer, gl_SemanticsAcquire);
    atomicCompSwap(atomu, 10U, 20U, gl_ScopeDevice, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsAcquire, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsAcquire);
    atomicCompSwap(atomu, 10U, 20U, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquire | gl_SemanticsMakeVisible, gl_StorageSemanticsBuffer, gl_SemanticsAcquire);
    atomicCompSwap(atomu, 10U, 20U, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquire | gl_SemanticsMakeVisible, gl_StorageSemanticsBuffer, gl_SemanticsAcquire | gl_SemanticsMakeVisible);
    atomicCompSwap(atomu, 10U, 20U, gl_ScopeDevice, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsAcquire | gl_SemanticsMakeVisible | gl_SemanticsVolatile, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsAcquire | gl_SemanticsMakeVisible | gl_SemanticsVolatile);

    atomicCompSwap(atomu, 10U, 20U, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease, gl_StorageSemanticsBuffer, gl_SemanticsAcquire);
    atomicCompSwap(atomu, 10U, 20U, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease | gl_SemanticsVolatile, gl_StorageSemanticsBuffer, gl_SemanticsAcquire | gl_SemanticsVolatile);
    atomicCompSwap(atomu, 10U, 20U, gl_ScopeDevice, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsAcquireRelease, gl_StorageSemanticsBuffer, gl_SemanticsAcquire);
    atomicCompSwap(atomu, 10U, 20U, gl_ScopeDevice, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsAcquireRelease, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsAcquire);
    atomicCompSwap(atomu, 10U, 20U, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease | gl_SemanticsMakeVisible, gl_StorageSemanticsBuffer, gl_SemanticsAcquire);
    atomicCompSwap(atomu, 10U, 20U, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease | gl_SemanticsMakeAvailable, gl_StorageSemanticsBuffer, gl_SemanticsAcquire);
    atomicCompSwap(atomu, 10U, 20U, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease | gl_SemanticsMakeVisible | gl_SemanticsMakeAvailable, gl_StorageSemanticsBuffer, gl_SemanticsAcquire);
    atomicCompSwap(atomu, 10U, 20U, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease | gl_SemanticsMakeVisible, gl_StorageSemanticsBuffer, gl_SemanticsAcquire | gl_SemanticsMakeVisible);
    atomicCompSwap(atomu, 10U, 20U, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease | gl_SemanticsMakeVisible | gl_SemanticsMakeAvailable, gl_StorageSemanticsBuffer, gl_SemanticsAcquire | gl_SemanticsMakeVisible);
    atomicCompSwap(atomu, 10U, 20U, gl_ScopeDevice, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsAcquireRelease | gl_SemanticsMakeVisible | gl_SemanticsMakeAvailable | gl_SemanticsVolatile, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsAcquire | gl_SemanticsMakeVisible | gl_SemanticsVolatile);
}