xref: /aosp_15_r20/external/skia/resources/sksl/errors/InvalidAtomicOperations.compute (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1workgroup atomicUint wgCounterA;
2workgroup atomicUint wgCounterB;
3
4struct S {
5    atomicUint memberAtomic;
6};
7workgroup S wgStructWithAtomicMember;
8workgroup atomicUint wgAtomicArray[2];
9workgroup atomicUint wgAtomicArray2[2];
10workgroup S wgStructWithAtomicMemberArray[2];
11
12struct NestedS {
13    S nestedStructWithAtomicMember;
14};
15workgroup NestedS wgNestedStructWithAtomicMember;
16
17void main() {
18    wgCounterA = 1;
19    wgCounterA = atomicUint(1);
20
21    +wgCounterA;
22    -wgCounterA;
23    !wgCounterA;
24    ~wgCounterA;
25
26    wgCounterA++;
27    wgCounterA--;
28    ++wgCounterA;
29    --wgCounterA;
30
31    wgCounterA = -wgCounterA;
32    wgCounterA = +wgCounterA;
33    wgCounterA = wgCounterB;
34    wgCounterA += wgCounterB;
35    wgCounterA -= wgCounterB;
36    wgCounterA *= wgCounterB;
37    wgCounterA /= wgCounterB;
38
39    wgCounterA = wgCounterA + 1;
40    wgCounterA = wgCounterA - 1;
41    wgCounterA = wgCounterA * 1;
42    wgCounterA = wgCounterA / 1;
43    wgCounterA = wgCounterA + wgCounterB;
44    wgCounterA = wgCounterA - wgCounterB;
45    wgCounterA = wgCounterA * wgCounterB;
46    wgCounterA = wgCounterA / wgCounterB;
47
48    wgCounterA == wgCounterB;
49    wgCounterA != wgCounterB;
50    wgCounterA < wgCounterB;
51    wgCounterA <= wgCounterB;
52    wgCounterA > wgCounterB;
53    wgCounterA >= wgCounterB;
54    wgCounterA && wgCounterB;
55    wgCounterA || wgCounterB;
56    wgCounterA & wgCounterB;
57    wgCounterA | wgCounterB;
58
59    uint a = wgCounterA;
60    wgStructWithAtomicMember = S(1);
61    wgStructWithAtomicMember = S(atomicUint(1));
62    wgStructWithAtomicMember = S(wgCounterA);
63
64    wgAtomicArray[0] = wgCounterA;
65    wgAtomicArray[1] = wgCounterB;
66    wgAtomicArray = wgAtomicArray2;
67    wgAtomicArray = atomicUint[2](wgCounterA, wgCounterB);
68
69    wgStructWithAtomicMemberArray[0] = wgStructWithAtomicMember;
70    wgStructWithAtomicMemberArray = S[2](wgStructWithAtomicMember,
71                                         wgStructWithAtomicMember);
72    wgNestedStructWithAtomicMember = NestedS(wgStructWithAtomicMember);
73}
74
75/*%%*
76type mismatch: '=' cannot operate on 'atomicUint', 'int'
77cannot construct 'atomicUint'
78'+' cannot operate on 'atomicUint'
79'-' cannot operate on 'atomicUint'
80'!' cannot operate on 'atomicUint'
81'~' cannot operate on 'atomicUint'
82'++' cannot operate on 'atomicUint'
83'--' cannot operate on 'atomicUint'
84'++' cannot operate on 'atomicUint'
85'--' cannot operate on 'atomicUint'
86'-' cannot operate on 'atomicUint'
87'+' cannot operate on 'atomicUint'
88assignments to opaque type 'atomicUint' are not permitted
89type mismatch: '+=' cannot operate on 'atomicUint', 'atomicUint'
90type mismatch: '-=' cannot operate on 'atomicUint', 'atomicUint'
91type mismatch: '*=' cannot operate on 'atomicUint', 'atomicUint'
92type mismatch: '/=' cannot operate on 'atomicUint', 'atomicUint'
93type mismatch: '+' cannot operate on 'atomicUint', 'int'
94type mismatch: '-' cannot operate on 'atomicUint', 'int'
95type mismatch: '*' cannot operate on 'atomicUint', 'int'
96type mismatch: '/' cannot operate on 'atomicUint', 'int'
97type mismatch: '+' cannot operate on 'atomicUint', 'atomicUint'
98type mismatch: '-' cannot operate on 'atomicUint', 'atomicUint'
99type mismatch: '*' cannot operate on 'atomicUint', 'atomicUint'
100type mismatch: '/' cannot operate on 'atomicUint', 'atomicUint'
101type mismatch: '==' cannot operate on 'atomicUint', 'atomicUint'
102type mismatch: '!=' cannot operate on 'atomicUint', 'atomicUint'
103type mismatch: '<' cannot operate on 'atomicUint', 'atomicUint'
104type mismatch: '<=' cannot operate on 'atomicUint', 'atomicUint'
105type mismatch: '>' cannot operate on 'atomicUint', 'atomicUint'
106type mismatch: '>=' cannot operate on 'atomicUint', 'atomicUint'
107type mismatch: '&&' cannot operate on 'atomicUint', 'atomicUint'
108type mismatch: '||' cannot operate on 'atomicUint', 'atomicUint'
109type mismatch: '&' cannot operate on 'atomicUint', 'atomicUint'
110type mismatch: '|' cannot operate on 'atomicUint', 'atomicUint'
111expected 'uint', but found 'atomicUint'
112construction of struct type 'S' with atomic member is not allowed
113cannot construct 'atomicUint'
114construction of struct type 'S' with atomic member is not allowed
115construction of struct type 'S' with atomic member is not allowed
116assignments to opaque type 'atomicUint' are not permitted
117assignments to opaque type 'atomicUint' are not permitted
118assignments to opaque type 'atomicUint[2]' are not permitted
119construction of array type 'atomicUint[2]' with atomic member is not allowed
120assignments to opaque type 'S' are not permitted
121construction of array type 'S[2]' with atomic member is not allowed
122construction of struct type 'NestedS' with atomic member is not allowed
123*%%*/
124