Merge pull request #1592 from KhronosGroup/subgroupBroadcast-const-id
GLSL: Fix #1591: Require the id in subgroupBroadcast to be constant.
diff --git a/Test/baseResults/spv.subgroupBallot.comp.out b/Test/baseResults/spv.subgroupBallot.comp.out
index 23a5913..ea152d9 100644
--- a/Test/baseResults/spv.subgroupBallot.comp.out
+++ b/Test/baseResults/spv.subgroupBallot.comp.out
@@ -1,7 +1,7 @@
spv.subgroupBallot.comp
// Module Version 10300
// Generated by (magic number): 80007
-// Id's are bound by 417
+// Id's are bound by 397
Capability Shader
Capability Float64
@@ -51,7 +51,7 @@
Decorate 46(Buffers) Block
Decorate 49(data) DescriptorSet 0
Decorate 49(data) Binding 0
- Decorate 416 BuiltIn WorkgroupSize
+ Decorate 396 BuiltIn WorkgroupSize
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 0
@@ -91,30 +91,30 @@
83: TypeVector 36(bool) 4
88: TypePointer StorageBuffer 17(ivec4)
96: TypePointer StorageBuffer 40(float)
- 103: TypeVector 40(float) 2
- 104: TypePointer StorageBuffer 41(fvec4)
- 114: TypeVector 40(float) 3
- 124: 42(int) Constant 3
- 131: TypePointer StorageBuffer 42(int)
- 138: TypeVector 42(int) 2
- 139: TypePointer StorageBuffer 43(ivec4)
- 149: TypeVector 42(int) 3
- 171: TypeVector 6(int) 2
- 181: TypeVector 6(int) 3
- 197: TypePointer StorageBuffer 44(float64_t)
- 204: TypeVector 44(float64_t) 2
- 205: TypePointer StorageBuffer 45(f64vec4)
- 215: TypeVector 44(float64_t) 3
- 242: 138(ivec2) ConstantComposite 61 61
- 243: TypeVector 36(bool) 2
- 247: 138(ivec2) ConstantComposite 60 60
- 256: 149(ivec3) ConstantComposite 61 61 61
- 257: TypeVector 36(bool) 3
- 261: 149(ivec3) ConstantComposite 60 60 60
- 269: 43(ivec4) ConstantComposite 61 61 61 61
- 273: 43(ivec4) ConstantComposite 60 60 60 60
- 415: 6(int) Constant 8
- 416: 181(ivec3) ConstantComposite 415 415 64
+ 102: TypeVector 40(float) 2
+ 103: TypePointer StorageBuffer 41(fvec4)
+ 112: TypeVector 40(float) 3
+ 121: 42(int) Constant 3
+ 127: TypePointer StorageBuffer 42(int)
+ 133: TypeVector 42(int) 2
+ 134: TypePointer StorageBuffer 43(ivec4)
+ 143: TypeVector 42(int) 3
+ 162: TypeVector 6(int) 2
+ 171: TypeVector 6(int) 3
+ 185: TypePointer StorageBuffer 44(float64_t)
+ 191: TypeVector 44(float64_t) 2
+ 192: TypePointer StorageBuffer 45(f64vec4)
+ 201: TypeVector 44(float64_t) 3
+ 225: 133(ivec2) ConstantComposite 61 61
+ 226: TypeVector 36(bool) 2
+ 229: 133(ivec2) ConstantComposite 60 60
+ 238: 143(ivec3) ConstantComposite 61 61 61
+ 239: TypeVector 36(bool) 3
+ 242: 143(ivec3) ConstantComposite 60 60 60
+ 250: 43(ivec4) ConstantComposite 61 61 61 61
+ 253: 43(ivec4) ConstantComposite 60 60 60 60
+ 395: 6(int) Constant 8
+ 396: 171(ivec3) ConstantComposite 395 395 64
4(main): 2 Function None 3
5: Label
8(invocation): 7(ptr) Variable Function
@@ -179,346 +179,326 @@
87: Label
92: 36(bool) Phi 85 5 91 86
SelectionMerge 94 None
- BranchConditional 92 93 276
+ BranchConditional 92 93 256
93: Label
95: 6(int) Load 8(invocation)
97: 96(ptr) AccessChain 49(data) 61 61 54
98: 40(float) Load 97
- 99: 6(int) Load 8(invocation)
- 100: 40(float) GroupNonUniformBroadcast 38 98 99
- 101: 96(ptr) AccessChain 49(data) 95 61 54
- Store 101 100
- 102: 6(int) Load 8(invocation)
- 105: 104(ptr) AccessChain 49(data) 60 61
- 106: 41(fvec4) Load 105
- 107: 103(fvec2) VectorShuffle 106 106 0 1
- 108: 6(int) Load 8(invocation)
- 109: 103(fvec2) GroupNonUniformBroadcast 38 107 108
- 110: 104(ptr) AccessChain 49(data) 102 61
- 111: 41(fvec4) Load 110
- 112: 41(fvec4) VectorShuffle 111 109 4 5 2 3
- Store 110 112
- 113: 6(int) Load 8(invocation)
- 115: 104(ptr) AccessChain 49(data) 51 61
- 116: 41(fvec4) Load 115
- 117: 114(fvec3) VectorShuffle 116 116 0 1 2
- 118: 6(int) Load 8(invocation)
- 119: 114(fvec3) GroupNonUniformBroadcast 38 117 118
- 120: 104(ptr) AccessChain 49(data) 113 61
- 121: 41(fvec4) Load 120
- 122: 41(fvec4) VectorShuffle 121 119 4 5 6 3
- Store 120 122
- 123: 6(int) Load 8(invocation)
- 125: 104(ptr) AccessChain 49(data) 124 61
- 126: 41(fvec4) Load 125
- 127: 6(int) Load 8(invocation)
- 128: 41(fvec4) GroupNonUniformBroadcast 38 126 127
- 129: 104(ptr) AccessChain 49(data) 123 61
- Store 129 128
- 130: 6(int) Load 8(invocation)
- 132: 131(ptr) AccessChain 49(data) 61 60 54
- 133: 42(int) Load 132
- 134: 6(int) Load 8(invocation)
- 135: 42(int) GroupNonUniformBroadcast 38 133 134
- 136: 131(ptr) AccessChain 49(data) 130 60 54
- Store 136 135
- 137: 6(int) Load 8(invocation)
- 140: 139(ptr) AccessChain 49(data) 60 60
- 141: 43(ivec4) Load 140
- 142: 138(ivec2) VectorShuffle 141 141 0 1
- 143: 6(int) Load 8(invocation)
- 144: 138(ivec2) GroupNonUniformBroadcast 38 142 143
- 145: 139(ptr) AccessChain 49(data) 137 60
- 146: 43(ivec4) Load 145
- 147: 43(ivec4) VectorShuffle 146 144 4 5 2 3
- Store 145 147
- 148: 6(int) Load 8(invocation)
- 150: 139(ptr) AccessChain 49(data) 51 60
- 151: 43(ivec4) Load 150
- 152: 149(ivec3) VectorShuffle 151 151 0 1 2
- 153: 6(int) Load 8(invocation)
- 154: 149(ivec3) GroupNonUniformBroadcast 38 152 153
- 155: 139(ptr) AccessChain 49(data) 148 60
- 156: 43(ivec4) Load 155
- 157: 43(ivec4) VectorShuffle 156 154 4 5 6 3
- Store 155 157
- 158: 6(int) Load 8(invocation)
- 159: 139(ptr) AccessChain 49(data) 124 60
- 160: 43(ivec4) Load 159
+ 99: 40(float) GroupNonUniformBroadcast 38 98 38
+ 100: 96(ptr) AccessChain 49(data) 95 61 54
+ Store 100 99
+ 101: 6(int) Load 8(invocation)
+ 104: 103(ptr) AccessChain 49(data) 60 61
+ 105: 41(fvec4) Load 104
+ 106: 102(fvec2) VectorShuffle 105 105 0 1
+ 107: 102(fvec2) GroupNonUniformBroadcast 38 106 38
+ 108: 103(ptr) AccessChain 49(data) 101 61
+ 109: 41(fvec4) Load 108
+ 110: 41(fvec4) VectorShuffle 109 107 4 5 2 3
+ Store 108 110
+ 111: 6(int) Load 8(invocation)
+ 113: 103(ptr) AccessChain 49(data) 51 61
+ 114: 41(fvec4) Load 113
+ 115: 112(fvec3) VectorShuffle 114 114 0 1 2
+ 116: 112(fvec3) GroupNonUniformBroadcast 38 115 38
+ 117: 103(ptr) AccessChain 49(data) 111 61
+ 118: 41(fvec4) Load 117
+ 119: 41(fvec4) VectorShuffle 118 116 4 5 6 3
+ Store 117 119
+ 120: 6(int) Load 8(invocation)
+ 122: 103(ptr) AccessChain 49(data) 121 61
+ 123: 41(fvec4) Load 122
+ 124: 41(fvec4) GroupNonUniformBroadcast 38 123 38
+ 125: 103(ptr) AccessChain 49(data) 120 61
+ Store 125 124
+ 126: 6(int) Load 8(invocation)
+ 128: 127(ptr) AccessChain 49(data) 61 60 54
+ 129: 42(int) Load 128
+ 130: 42(int) GroupNonUniformBroadcast 38 129 72
+ 131: 127(ptr) AccessChain 49(data) 126 60 54
+ Store 131 130
+ 132: 6(int) Load 8(invocation)
+ 135: 134(ptr) AccessChain 49(data) 60 60
+ 136: 43(ivec4) Load 135
+ 137: 133(ivec2) VectorShuffle 136 136 0 1
+ 138: 133(ivec2) GroupNonUniformBroadcast 38 137 72
+ 139: 134(ptr) AccessChain 49(data) 132 60
+ 140: 43(ivec4) Load 139
+ 141: 43(ivec4) VectorShuffle 140 138 4 5 2 3
+ Store 139 141
+ 142: 6(int) Load 8(invocation)
+ 144: 134(ptr) AccessChain 49(data) 51 60
+ 145: 43(ivec4) Load 144
+ 146: 143(ivec3) VectorShuffle 145 145 0 1 2
+ 147: 143(ivec3) GroupNonUniformBroadcast 38 146 72
+ 148: 134(ptr) AccessChain 49(data) 142 60
+ 149: 43(ivec4) Load 148
+ 150: 43(ivec4) VectorShuffle 149 147 4 5 6 3
+ Store 148 150
+ 151: 6(int) Load 8(invocation)
+ 152: 134(ptr) AccessChain 49(data) 121 60
+ 153: 43(ivec4) Load 152
+ 154: 43(ivec4) GroupNonUniformBroadcast 38 153 72
+ 155: 134(ptr) AccessChain 49(data) 151 60
+ Store 155 154
+ 156: 6(int) Load 8(invocation)
+ 157: 55(ptr) AccessChain 49(data) 61 51 54
+ 158: 6(int) Load 157
+ 159: 6(int) GroupNonUniformBroadcast 38 158 64
+ 160: 55(ptr) AccessChain 49(data) 156 51 54
+ Store 160 159
161: 6(int) Load 8(invocation)
- 162: 43(ivec4) GroupNonUniformBroadcast 38 160 161
- 163: 139(ptr) AccessChain 49(data) 158 60
- Store 163 162
- 164: 6(int) Load 8(invocation)
- 165: 55(ptr) AccessChain 49(data) 61 51 54
- 166: 6(int) Load 165
- 167: 6(int) Load 8(invocation)
- 168: 6(int) GroupNonUniformBroadcast 38 166 167
- 169: 55(ptr) AccessChain 49(data) 164 51 54
- Store 169 168
+ 163: 88(ptr) AccessChain 49(data) 60 51
+ 164: 17(ivec4) Load 163
+ 165: 162(ivec2) VectorShuffle 164 164 0 1
+ 166: 162(ivec2) GroupNonUniformBroadcast 38 165 64
+ 167: 88(ptr) AccessChain 49(data) 161 51
+ 168: 17(ivec4) Load 167
+ 169: 17(ivec4) VectorShuffle 168 166 4 5 2 3
+ Store 167 169
170: 6(int) Load 8(invocation)
- 172: 88(ptr) AccessChain 49(data) 60 51
+ 172: 88(ptr) AccessChain 49(data) 51 51
173: 17(ivec4) Load 172
- 174: 171(ivec2) VectorShuffle 173 173 0 1
- 175: 6(int) Load 8(invocation)
- 176: 171(ivec2) GroupNonUniformBroadcast 38 174 175
- 177: 88(ptr) AccessChain 49(data) 170 51
- 178: 17(ivec4) Load 177
- 179: 17(ivec4) VectorShuffle 178 176 4 5 2 3
- Store 177 179
- 180: 6(int) Load 8(invocation)
- 182: 88(ptr) AccessChain 49(data) 51 51
- 183: 17(ivec4) Load 182
- 184: 181(ivec3) VectorShuffle 183 183 0 1 2
- 185: 6(int) Load 8(invocation)
- 186: 181(ivec3) GroupNonUniformBroadcast 38 184 185
- 187: 88(ptr) AccessChain 49(data) 180 51
- 188: 17(ivec4) Load 187
- 189: 17(ivec4) VectorShuffle 188 186 4 5 6 3
- Store 187 189
+ 174: 171(ivec3) VectorShuffle 173 173 0 1 2
+ 175: 171(ivec3) GroupNonUniformBroadcast 38 174 64
+ 176: 88(ptr) AccessChain 49(data) 170 51
+ 177: 17(ivec4) Load 176
+ 178: 17(ivec4) VectorShuffle 177 175 4 5 6 3
+ Store 176 178
+ 179: 6(int) Load 8(invocation)
+ 180: 88(ptr) AccessChain 49(data) 121 51
+ 181: 17(ivec4) Load 180
+ 182: 17(ivec4) GroupNonUniformBroadcast 38 181 64
+ 183: 88(ptr) AccessChain 49(data) 179 51
+ Store 183 182
+ 184: 6(int) Load 8(invocation)
+ 186: 185(ptr) AccessChain 49(data) 61 121 54
+ 187:44(float64_t) Load 186
+ 188:44(float64_t) GroupNonUniformBroadcast 38 187 54
+ 189: 185(ptr) AccessChain 49(data) 184 121 54
+ Store 189 188
190: 6(int) Load 8(invocation)
- 191: 88(ptr) AccessChain 49(data) 124 51
- 192: 17(ivec4) Load 191
- 193: 6(int) Load 8(invocation)
- 194: 17(ivec4) GroupNonUniformBroadcast 38 192 193
- 195: 88(ptr) AccessChain 49(data) 190 51
- Store 195 194
- 196: 6(int) Load 8(invocation)
- 198: 197(ptr) AccessChain 49(data) 61 124 54
- 199:44(float64_t) Load 198
+ 193: 192(ptr) AccessChain 49(data) 60 121
+ 194: 45(f64vec4) Load 193
+ 195:191(f64vec2) VectorShuffle 194 194 0 1
+ 196:191(f64vec2) GroupNonUniformBroadcast 38 195 54
+ 197: 192(ptr) AccessChain 49(data) 190 121
+ 198: 45(f64vec4) Load 197
+ 199: 45(f64vec4) VectorShuffle 198 196 4 5 2 3
+ Store 197 199
200: 6(int) Load 8(invocation)
- 201:44(float64_t) GroupNonUniformBroadcast 38 199 200
- 202: 197(ptr) AccessChain 49(data) 196 124 54
- Store 202 201
- 203: 6(int) Load 8(invocation)
- 206: 205(ptr) AccessChain 49(data) 60 124
+ 202: 192(ptr) AccessChain 49(data) 51 121
+ 203: 45(f64vec4) Load 202
+ 204:201(f64vec3) VectorShuffle 203 203 0 1 2
+ 205:201(f64vec3) GroupNonUniformBroadcast 38 204 54
+ 206: 192(ptr) AccessChain 49(data) 200 121
207: 45(f64vec4) Load 206
- 208:204(f64vec2) VectorShuffle 207 207 0 1
+ 208: 45(f64vec4) VectorShuffle 207 205 4 5 6 3
+ Store 206 208
209: 6(int) Load 8(invocation)
- 210:204(f64vec2) GroupNonUniformBroadcast 38 208 209
- 211: 205(ptr) AccessChain 49(data) 203 124
- 212: 45(f64vec4) Load 211
- 213: 45(f64vec4) VectorShuffle 212 210 4 5 2 3
- Store 211 213
+ 210: 192(ptr) AccessChain 49(data) 121 121
+ 211: 45(f64vec4) Load 210
+ 212: 45(f64vec4) GroupNonUniformBroadcast 38 211 54
+ 213: 192(ptr) AccessChain 49(data) 209 121
+ Store 213 212
214: 6(int) Load 8(invocation)
- 216: 205(ptr) AccessChain 49(data) 51 124
- 217: 45(f64vec4) Load 216
- 218:215(f64vec3) VectorShuffle 217 217 0 1 2
- 219: 6(int) Load 8(invocation)
- 220:215(f64vec3) GroupNonUniformBroadcast 38 218 219
- 221: 205(ptr) AccessChain 49(data) 214 124
- 222: 45(f64vec4) Load 221
- 223: 45(f64vec4) VectorShuffle 222 220 4 5 6 3
- Store 221 223
- 224: 6(int) Load 8(invocation)
- 225: 205(ptr) AccessChain 49(data) 124 124
- 226: 45(f64vec4) Load 225
- 227: 6(int) Load 8(invocation)
- 228: 45(f64vec4) GroupNonUniformBroadcast 38 226 227
- 229: 205(ptr) AccessChain 49(data) 224 124
- Store 229 228
- 230: 6(int) Load 8(invocation)
- 231: 131(ptr) AccessChain 49(data) 61 60 54
- 232: 42(int) Load 231
- 233: 36(bool) SLessThan 232 61
+ 215: 127(ptr) AccessChain 49(data) 61 60 54
+ 216: 42(int) Load 215
+ 217: 36(bool) SLessThan 216 61
+ 218: 36(bool) GroupNonUniformBroadcast 38 217 64
+ 219: 42(int) Select 218 60 61
+ 220: 127(ptr) AccessChain 49(data) 214 60 54
+ Store 220 219
+ 221: 6(int) Load 8(invocation)
+ 222: 134(ptr) AccessChain 49(data) 60 60
+ 223: 43(ivec4) Load 222
+ 224: 133(ivec2) VectorShuffle 223 223 0 1
+ 227: 226(bvec2) SLessThan 224 225
+ 228: 226(bvec2) GroupNonUniformBroadcast 38 227 64
+ 230: 133(ivec2) Select 228 229 225
+ 231: 134(ptr) AccessChain 49(data) 221 60
+ 232: 43(ivec4) Load 231
+ 233: 43(ivec4) VectorShuffle 232 230 4 5 2 3
+ Store 231 233
234: 6(int) Load 8(invocation)
- 235: 36(bool) GroupNonUniformBroadcast 38 233 234
- 236: 42(int) Select 235 60 61
- 237: 131(ptr) AccessChain 49(data) 230 60 54
- Store 237 236
- 238: 6(int) Load 8(invocation)
- 239: 139(ptr) AccessChain 49(data) 60 60
- 240: 43(ivec4) Load 239
- 241: 138(ivec2) VectorShuffle 240 240 0 1
- 244: 243(bvec2) SLessThan 241 242
- 245: 6(int) Load 8(invocation)
- 246: 243(bvec2) GroupNonUniformBroadcast 38 244 245
- 248: 138(ivec2) Select 246 247 242
- 249: 139(ptr) AccessChain 49(data) 238 60
- 250: 43(ivec4) Load 249
- 251: 43(ivec4) VectorShuffle 250 248 4 5 2 3
- Store 249 251
- 252: 6(int) Load 8(invocation)
- 253: 139(ptr) AccessChain 49(data) 60 60
- 254: 43(ivec4) Load 253
- 255: 149(ivec3) VectorShuffle 254 254 0 1 2
- 258: 257(bvec3) SLessThan 255 256
- 259: 6(int) Load 8(invocation)
- 260: 257(bvec3) GroupNonUniformBroadcast 38 258 259
- 262: 149(ivec3) Select 260 261 256
- 263: 139(ptr) AccessChain 49(data) 252 60
- 264: 43(ivec4) Load 263
- 265: 43(ivec4) VectorShuffle 264 262 4 5 6 3
- Store 263 265
- 266: 6(int) Load 8(invocation)
- 267: 139(ptr) AccessChain 49(data) 60 60
- 268: 43(ivec4) Load 267
- 270: 83(bvec4) SLessThan 268 269
- 271: 6(int) Load 8(invocation)
- 272: 83(bvec4) GroupNonUniformBroadcast 38 270 271
- 274: 43(ivec4) Select 272 273 269
- 275: 139(ptr) AccessChain 49(data) 266 60
- Store 275 274
+ 235: 134(ptr) AccessChain 49(data) 60 60
+ 236: 43(ivec4) Load 235
+ 237: 143(ivec3) VectorShuffle 236 236 0 1 2
+ 240: 239(bvec3) SLessThan 237 238
+ 241: 239(bvec3) GroupNonUniformBroadcast 38 240 64
+ 243: 143(ivec3) Select 241 242 238
+ 244: 134(ptr) AccessChain 49(data) 234 60
+ 245: 43(ivec4) Load 244
+ 246: 43(ivec4) VectorShuffle 245 243 4 5 6 3
+ Store 244 246
+ 247: 6(int) Load 8(invocation)
+ 248: 134(ptr) AccessChain 49(data) 60 60
+ 249: 43(ivec4) Load 248
+ 251: 83(bvec4) SLessThan 249 250
+ 252: 83(bvec4) GroupNonUniformBroadcast 38 251 64
+ 254: 43(ivec4) Select 252 253 250
+ 255: 134(ptr) AccessChain 49(data) 247 60
+ Store 255 254
Branch 94
- 276: Label
- 277: 6(int) Load 8(invocation)
- 278: 96(ptr) AccessChain 49(data) 61 61 54
- 279: 40(float) Load 278
- 280: 40(float) GroupNonUniformBroadcastFirst 38 279
- 281: 96(ptr) AccessChain 49(data) 277 61 54
- Store 281 280
- 282: 6(int) Load 8(invocation)
- 283: 104(ptr) AccessChain 49(data) 60 61
- 284: 41(fvec4) Load 283
- 285: 103(fvec2) VectorShuffle 284 284 0 1
- 286: 103(fvec2) GroupNonUniformBroadcastFirst 38 285
- 287: 104(ptr) AccessChain 49(data) 282 61
- 288: 41(fvec4) Load 287
- 289: 41(fvec4) VectorShuffle 288 286 4 5 2 3
- Store 287 289
- 290: 6(int) Load 8(invocation)
- 291: 104(ptr) AccessChain 49(data) 51 61
- 292: 41(fvec4) Load 291
- 293: 114(fvec3) VectorShuffle 292 292 0 1 2
- 294: 114(fvec3) GroupNonUniformBroadcastFirst 38 293
- 295: 104(ptr) AccessChain 49(data) 290 61
- 296: 41(fvec4) Load 295
- 297: 41(fvec4) VectorShuffle 296 294 4 5 6 3
- Store 295 297
- 298: 6(int) Load 8(invocation)
- 299: 104(ptr) AccessChain 49(data) 124 61
- 300: 41(fvec4) Load 299
- 301: 41(fvec4) GroupNonUniformBroadcastFirst 38 300
- 302: 104(ptr) AccessChain 49(data) 298 61
- Store 302 301
- 303: 6(int) Load 8(invocation)
- 304: 131(ptr) AccessChain 49(data) 61 60 54
- 305: 42(int) Load 304
- 306: 42(int) GroupNonUniformBroadcastFirst 38 305
- 307: 131(ptr) AccessChain 49(data) 303 60 54
- Store 307 306
- 308: 6(int) Load 8(invocation)
- 309: 139(ptr) AccessChain 49(data) 60 60
- 310: 43(ivec4) Load 309
- 311: 138(ivec2) VectorShuffle 310 310 0 1
- 312: 138(ivec2) GroupNonUniformBroadcastFirst 38 311
- 313: 139(ptr) AccessChain 49(data) 308 60
- 314: 43(ivec4) Load 313
- 315: 43(ivec4) VectorShuffle 314 312 4 5 2 3
- Store 313 315
- 316: 6(int) Load 8(invocation)
- 317: 139(ptr) AccessChain 49(data) 51 60
- 318: 43(ivec4) Load 317
- 319: 149(ivec3) VectorShuffle 318 318 0 1 2
- 320: 149(ivec3) GroupNonUniformBroadcastFirst 38 319
- 321: 139(ptr) AccessChain 49(data) 316 60
- 322: 43(ivec4) Load 321
- 323: 43(ivec4) VectorShuffle 322 320 4 5 6 3
- Store 321 323
- 324: 6(int) Load 8(invocation)
- 325: 139(ptr) AccessChain 49(data) 124 60
- 326: 43(ivec4) Load 325
- 327: 43(ivec4) GroupNonUniformBroadcastFirst 38 326
- 328: 139(ptr) AccessChain 49(data) 324 60
- Store 328 327
- 329: 6(int) Load 8(invocation)
- 330: 55(ptr) AccessChain 49(data) 61 51 54
- 331: 6(int) Load 330
- 332: 6(int) GroupNonUniformBroadcastFirst 38 331
- 333: 55(ptr) AccessChain 49(data) 329 51 54
- Store 333 332
- 334: 6(int) Load 8(invocation)
- 335: 88(ptr) AccessChain 49(data) 60 51
- 336: 17(ivec4) Load 335
- 337: 171(ivec2) VectorShuffle 336 336 0 1
- 338: 171(ivec2) GroupNonUniformBroadcastFirst 38 337
- 339: 88(ptr) AccessChain 49(data) 334 51
- 340: 17(ivec4) Load 339
- 341: 17(ivec4) VectorShuffle 340 338 4 5 2 3
- Store 339 341
- 342: 6(int) Load 8(invocation)
- 343: 88(ptr) AccessChain 49(data) 51 51
- 344: 17(ivec4) Load 343
- 345: 181(ivec3) VectorShuffle 344 344 0 1 2
- 346: 181(ivec3) GroupNonUniformBroadcastFirst 38 345
- 347: 88(ptr) AccessChain 49(data) 342 51
- 348: 17(ivec4) Load 347
- 349: 17(ivec4) VectorShuffle 348 346 4 5 6 3
- Store 347 349
- 350: 6(int) Load 8(invocation)
- 351: 88(ptr) AccessChain 49(data) 124 51
- 352: 17(ivec4) Load 351
- 353: 17(ivec4) GroupNonUniformBroadcastFirst 38 352
- 354: 88(ptr) AccessChain 49(data) 350 51
- Store 354 353
- 355: 6(int) Load 8(invocation)
- 356: 197(ptr) AccessChain 49(data) 61 124 54
- 357:44(float64_t) Load 356
- 358:44(float64_t) GroupNonUniformBroadcastFirst 38 357
- 359: 197(ptr) AccessChain 49(data) 355 124 54
- Store 359 358
- 360: 6(int) Load 8(invocation)
- 361: 205(ptr) AccessChain 49(data) 60 124
- 362: 45(f64vec4) Load 361
- 363:204(f64vec2) VectorShuffle 362 362 0 1
- 364:204(f64vec2) GroupNonUniformBroadcastFirst 38 363
- 365: 205(ptr) AccessChain 49(data) 360 124
- 366: 45(f64vec4) Load 365
- 367: 45(f64vec4) VectorShuffle 366 364 4 5 2 3
- Store 365 367
+ 256: Label
+ 257: 6(int) Load 8(invocation)
+ 258: 96(ptr) AccessChain 49(data) 61 61 54
+ 259: 40(float) Load 258
+ 260: 40(float) GroupNonUniformBroadcastFirst 38 259
+ 261: 96(ptr) AccessChain 49(data) 257 61 54
+ Store 261 260
+ 262: 6(int) Load 8(invocation)
+ 263: 103(ptr) AccessChain 49(data) 60 61
+ 264: 41(fvec4) Load 263
+ 265: 102(fvec2) VectorShuffle 264 264 0 1
+ 266: 102(fvec2) GroupNonUniformBroadcastFirst 38 265
+ 267: 103(ptr) AccessChain 49(data) 262 61
+ 268: 41(fvec4) Load 267
+ 269: 41(fvec4) VectorShuffle 268 266 4 5 2 3
+ Store 267 269
+ 270: 6(int) Load 8(invocation)
+ 271: 103(ptr) AccessChain 49(data) 51 61
+ 272: 41(fvec4) Load 271
+ 273: 112(fvec3) VectorShuffle 272 272 0 1 2
+ 274: 112(fvec3) GroupNonUniformBroadcastFirst 38 273
+ 275: 103(ptr) AccessChain 49(data) 270 61
+ 276: 41(fvec4) Load 275
+ 277: 41(fvec4) VectorShuffle 276 274 4 5 6 3
+ Store 275 277
+ 278: 6(int) Load 8(invocation)
+ 279: 103(ptr) AccessChain 49(data) 121 61
+ 280: 41(fvec4) Load 279
+ 281: 41(fvec4) GroupNonUniformBroadcastFirst 38 280
+ 282: 103(ptr) AccessChain 49(data) 278 61
+ Store 282 281
+ 283: 6(int) Load 8(invocation)
+ 284: 127(ptr) AccessChain 49(data) 61 60 54
+ 285: 42(int) Load 284
+ 286: 42(int) GroupNonUniformBroadcastFirst 38 285
+ 287: 127(ptr) AccessChain 49(data) 283 60 54
+ Store 287 286
+ 288: 6(int) Load 8(invocation)
+ 289: 134(ptr) AccessChain 49(data) 60 60
+ 290: 43(ivec4) Load 289
+ 291: 133(ivec2) VectorShuffle 290 290 0 1
+ 292: 133(ivec2) GroupNonUniformBroadcastFirst 38 291
+ 293: 134(ptr) AccessChain 49(data) 288 60
+ 294: 43(ivec4) Load 293
+ 295: 43(ivec4) VectorShuffle 294 292 4 5 2 3
+ Store 293 295
+ 296: 6(int) Load 8(invocation)
+ 297: 134(ptr) AccessChain 49(data) 51 60
+ 298: 43(ivec4) Load 297
+ 299: 143(ivec3) VectorShuffle 298 298 0 1 2
+ 300: 143(ivec3) GroupNonUniformBroadcastFirst 38 299
+ 301: 134(ptr) AccessChain 49(data) 296 60
+ 302: 43(ivec4) Load 301
+ 303: 43(ivec4) VectorShuffle 302 300 4 5 6 3
+ Store 301 303
+ 304: 6(int) Load 8(invocation)
+ 305: 134(ptr) AccessChain 49(data) 121 60
+ 306: 43(ivec4) Load 305
+ 307: 43(ivec4) GroupNonUniformBroadcastFirst 38 306
+ 308: 134(ptr) AccessChain 49(data) 304 60
+ Store 308 307
+ 309: 6(int) Load 8(invocation)
+ 310: 55(ptr) AccessChain 49(data) 61 51 54
+ 311: 6(int) Load 310
+ 312: 6(int) GroupNonUniformBroadcastFirst 38 311
+ 313: 55(ptr) AccessChain 49(data) 309 51 54
+ Store 313 312
+ 314: 6(int) Load 8(invocation)
+ 315: 88(ptr) AccessChain 49(data) 60 51
+ 316: 17(ivec4) Load 315
+ 317: 162(ivec2) VectorShuffle 316 316 0 1
+ 318: 162(ivec2) GroupNonUniformBroadcastFirst 38 317
+ 319: 88(ptr) AccessChain 49(data) 314 51
+ 320: 17(ivec4) Load 319
+ 321: 17(ivec4) VectorShuffle 320 318 4 5 2 3
+ Store 319 321
+ 322: 6(int) Load 8(invocation)
+ 323: 88(ptr) AccessChain 49(data) 51 51
+ 324: 17(ivec4) Load 323
+ 325: 171(ivec3) VectorShuffle 324 324 0 1 2
+ 326: 171(ivec3) GroupNonUniformBroadcastFirst 38 325
+ 327: 88(ptr) AccessChain 49(data) 322 51
+ 328: 17(ivec4) Load 327
+ 329: 17(ivec4) VectorShuffle 328 326 4 5 6 3
+ Store 327 329
+ 330: 6(int) Load 8(invocation)
+ 331: 88(ptr) AccessChain 49(data) 121 51
+ 332: 17(ivec4) Load 331
+ 333: 17(ivec4) GroupNonUniformBroadcastFirst 38 332
+ 334: 88(ptr) AccessChain 49(data) 330 51
+ Store 334 333
+ 335: 6(int) Load 8(invocation)
+ 336: 185(ptr) AccessChain 49(data) 61 121 54
+ 337:44(float64_t) Load 336
+ 338:44(float64_t) GroupNonUniformBroadcastFirst 38 337
+ 339: 185(ptr) AccessChain 49(data) 335 121 54
+ Store 339 338
+ 340: 6(int) Load 8(invocation)
+ 341: 192(ptr) AccessChain 49(data) 60 121
+ 342: 45(f64vec4) Load 341
+ 343:191(f64vec2) VectorShuffle 342 342 0 1
+ 344:191(f64vec2) GroupNonUniformBroadcastFirst 38 343
+ 345: 192(ptr) AccessChain 49(data) 340 121
+ 346: 45(f64vec4) Load 345
+ 347: 45(f64vec4) VectorShuffle 346 344 4 5 2 3
+ Store 345 347
+ 348: 6(int) Load 8(invocation)
+ 349: 192(ptr) AccessChain 49(data) 51 121
+ 350: 45(f64vec4) Load 349
+ 351:201(f64vec3) VectorShuffle 350 350 0 1 2
+ 352:201(f64vec3) GroupNonUniformBroadcastFirst 38 351
+ 353: 192(ptr) AccessChain 49(data) 348 121
+ 354: 45(f64vec4) Load 353
+ 355: 45(f64vec4) VectorShuffle 354 352 4 5 6 3
+ Store 353 355
+ 356: 6(int) Load 8(invocation)
+ 357: 192(ptr) AccessChain 49(data) 121 121
+ 358: 45(f64vec4) Load 357
+ 359: 45(f64vec4) GroupNonUniformBroadcastFirst 38 358
+ 360: 192(ptr) AccessChain 49(data) 356 121
+ Store 360 359
+ 361: 6(int) Load 8(invocation)
+ 362: 127(ptr) AccessChain 49(data) 61 60 54
+ 363: 42(int) Load 362
+ 364: 36(bool) SLessThan 363 61
+ 365: 36(bool) GroupNonUniformBroadcastFirst 38 364
+ 366: 42(int) Select 365 60 61
+ 367: 127(ptr) AccessChain 49(data) 361 60 54
+ Store 367 366
368: 6(int) Load 8(invocation)
- 369: 205(ptr) AccessChain 49(data) 51 124
- 370: 45(f64vec4) Load 369
- 371:215(f64vec3) VectorShuffle 370 370 0 1 2
- 372:215(f64vec3) GroupNonUniformBroadcastFirst 38 371
- 373: 205(ptr) AccessChain 49(data) 368 124
- 374: 45(f64vec4) Load 373
- 375: 45(f64vec4) VectorShuffle 374 372 4 5 6 3
- Store 373 375
- 376: 6(int) Load 8(invocation)
- 377: 205(ptr) AccessChain 49(data) 124 124
- 378: 45(f64vec4) Load 377
- 379: 45(f64vec4) GroupNonUniformBroadcastFirst 38 378
- 380: 205(ptr) AccessChain 49(data) 376 124
- Store 380 379
- 381: 6(int) Load 8(invocation)
- 382: 131(ptr) AccessChain 49(data) 61 60 54
- 383: 42(int) Load 382
- 384: 36(bool) SLessThan 383 61
- 385: 36(bool) GroupNonUniformBroadcastFirst 38 384
- 386: 42(int) Select 385 60 61
- 387: 131(ptr) AccessChain 49(data) 381 60 54
- Store 387 386
+ 369: 134(ptr) AccessChain 49(data) 60 60
+ 370: 43(ivec4) Load 369
+ 371: 133(ivec2) VectorShuffle 370 370 0 1
+ 372: 226(bvec2) SLessThan 371 225
+ 373: 226(bvec2) GroupNonUniformBroadcastFirst 38 372
+ 374: 133(ivec2) Select 373 229 225
+ 375: 134(ptr) AccessChain 49(data) 368 60
+ 376: 43(ivec4) Load 375
+ 377: 43(ivec4) VectorShuffle 376 374 4 5 2 3
+ Store 375 377
+ 378: 6(int) Load 8(invocation)
+ 379: 134(ptr) AccessChain 49(data) 60 60
+ 380: 43(ivec4) Load 379
+ 381: 143(ivec3) VectorShuffle 380 380 0 1 2
+ 382: 239(bvec3) SLessThan 381 238
+ 383: 239(bvec3) GroupNonUniformBroadcastFirst 38 382
+ 384: 143(ivec3) Select 383 242 238
+ 385: 134(ptr) AccessChain 49(data) 378 60
+ 386: 43(ivec4) Load 385
+ 387: 43(ivec4) VectorShuffle 386 384 4 5 6 3
+ Store 385 387
388: 6(int) Load 8(invocation)
- 389: 139(ptr) AccessChain 49(data) 60 60
+ 389: 134(ptr) AccessChain 49(data) 60 60
390: 43(ivec4) Load 389
- 391: 138(ivec2) VectorShuffle 390 390 0 1
- 392: 243(bvec2) SLessThan 391 242
- 393: 243(bvec2) GroupNonUniformBroadcastFirst 38 392
- 394: 138(ivec2) Select 393 247 242
- 395: 139(ptr) AccessChain 49(data) 388 60
- 396: 43(ivec4) Load 395
- 397: 43(ivec4) VectorShuffle 396 394 4 5 2 3
- Store 395 397
- 398: 6(int) Load 8(invocation)
- 399: 139(ptr) AccessChain 49(data) 60 60
- 400: 43(ivec4) Load 399
- 401: 149(ivec3) VectorShuffle 400 400 0 1 2
- 402: 257(bvec3) SLessThan 401 256
- 403: 257(bvec3) GroupNonUniformBroadcastFirst 38 402
- 404: 149(ivec3) Select 403 261 256
- 405: 139(ptr) AccessChain 49(data) 398 60
- 406: 43(ivec4) Load 405
- 407: 43(ivec4) VectorShuffle 406 404 4 5 6 3
- Store 405 407
- 408: 6(int) Load 8(invocation)
- 409: 139(ptr) AccessChain 49(data) 60 60
- 410: 43(ivec4) Load 409
- 411: 83(bvec4) SLessThan 410 269
- 412: 83(bvec4) GroupNonUniformBroadcastFirst 38 411
- 413: 43(ivec4) Select 412 273 269
- 414: 139(ptr) AccessChain 49(data) 408 60
- Store 414 413
+ 391: 83(bvec4) SLessThan 390 250
+ 392: 83(bvec4) GroupNonUniformBroadcastFirst 38 391
+ 393: 43(ivec4) Select 392 253 250
+ 394: 134(ptr) AccessChain 49(data) 388 60
+ Store 394 393
Branch 94
94: Label
Return
diff --git a/Test/baseResults/spv.subgroupBallotNeg.comp.out b/Test/baseResults/spv.subgroupBallotNeg.comp.out
new file mode 100755
index 0000000..49b6b54
--- /dev/null
+++ b/Test/baseResults/spv.subgroupBallotNeg.comp.out
@@ -0,0 +1,6 @@
+spv.subgroupBallotNeg.comp
+ERROR: 0:32: 'id' : argument must be compile-time constant
+ERROR: 1 compilation errors. No code generated.
+
+
+SPIR-V is not generated for failed compile or link
diff --git a/Test/spv.subgroupBallot.comp b/Test/spv.subgroupBallot.comp
old mode 100644
new mode 100755
index 2875468..bb9dc3e
--- a/Test/spv.subgroupBallot.comp
+++ b/Test/spv.subgroupBallot.comp
@@ -31,30 +31,30 @@
if ((relMask == result) && subgroupInverseBallot(data[0].u4))
{
- data[invocation].f4.x = subgroupBroadcast(data[0].f4.x, invocation);
- data[invocation].f4.xy = subgroupBroadcast(data[1].f4.xy, invocation);
- data[invocation].f4.xyz = subgroupBroadcast(data[2].f4.xyz, invocation);
- data[invocation].f4 = subgroupBroadcast(data[3].f4, invocation);
+ data[invocation].f4.x = subgroupBroadcast(data[0].f4.x, 3);
+ data[invocation].f4.xy = subgroupBroadcast(data[1].f4.xy, 3);
+ data[invocation].f4.xyz = subgroupBroadcast(data[2].f4.xyz, 3);
+ data[invocation].f4 = subgroupBroadcast(data[3].f4, 3);
- data[invocation].i4.x = subgroupBroadcast(data[0].i4.x, invocation);
- data[invocation].i4.xy = subgroupBroadcast(data[1].i4.xy, invocation);
- data[invocation].i4.xyz = subgroupBroadcast(data[2].i4.xyz, invocation);
- data[invocation].i4 = subgroupBroadcast(data[3].i4, invocation);
+ data[invocation].i4.x = subgroupBroadcast(data[0].i4.x, 2);
+ data[invocation].i4.xy = subgroupBroadcast(data[1].i4.xy, 2);
+ data[invocation].i4.xyz = subgroupBroadcast(data[2].i4.xyz, 2);
+ data[invocation].i4 = subgroupBroadcast(data[3].i4, 2);
- data[invocation].u4.x = subgroupBroadcast(data[0].u4.x, invocation);
- data[invocation].u4.xy = subgroupBroadcast(data[1].u4.xy, invocation);
- data[invocation].u4.xyz = subgroupBroadcast(data[2].u4.xyz, invocation);
- data[invocation].u4 = subgroupBroadcast(data[3].u4, invocation);
+ data[invocation].u4.x = subgroupBroadcast(data[0].u4.x, 1);
+ data[invocation].u4.xy = subgroupBroadcast(data[1].u4.xy, 1);
+ data[invocation].u4.xyz = subgroupBroadcast(data[2].u4.xyz, 1);
+ data[invocation].u4 = subgroupBroadcast(data[3].u4, 1);
- data[invocation].d4.x = subgroupBroadcast(data[0].d4.x, invocation);
- data[invocation].d4.xy = subgroupBroadcast(data[1].d4.xy, invocation);
- data[invocation].d4.xyz = subgroupBroadcast(data[2].d4.xyz, invocation);
- data[invocation].d4 = subgroupBroadcast(data[3].d4, invocation);
+ data[invocation].d4.x = subgroupBroadcast(data[0].d4.x, 0);
+ data[invocation].d4.xy = subgroupBroadcast(data[1].d4.xy, 0);
+ data[invocation].d4.xyz = subgroupBroadcast(data[2].d4.xyz, 0);
+ data[invocation].d4 = subgroupBroadcast(data[3].d4, 0);
- data[invocation].i4.x = int(subgroupBroadcast(data[0].i4.x < 0, invocation));
- data[invocation].i4.xy = ivec2(subgroupBroadcast(lessThan(data[1].i4.xy, ivec2(0)), invocation));
- data[invocation].i4.xyz = ivec3(subgroupBroadcast(lessThan(data[1].i4.xyz, ivec3(0)), invocation));
- data[invocation].i4 = ivec4(subgroupBroadcast(lessThan(data[1].i4, ivec4(0)), invocation));
+ data[invocation].i4.x = int(subgroupBroadcast(data[0].i4.x < 0, 1));
+ data[invocation].i4.xy = ivec2(subgroupBroadcast(lessThan(data[1].i4.xy, ivec2(0)), 1));
+ data[invocation].i4.xyz = ivec3(subgroupBroadcast(lessThan(data[1].i4.xyz, ivec3(0)), 1));
+ data[invocation].i4 = ivec4(subgroupBroadcast(lessThan(data[1].i4, ivec4(0)), 1));
}
else
{
diff --git a/Test/spv.subgroupBallotNeg.comp b/Test/spv.subgroupBallotNeg.comp
new file mode 100755
index 0000000..4020adf
--- /dev/null
+++ b/Test/spv.subgroupBallotNeg.comp
@@ -0,0 +1,33 @@
+#version 450
+
+#extension GL_KHR_shader_subgroup_ballot: enable
+
+layout (local_size_x = 8, local_size_y = 8, local_size_z = 1) in;
+
+layout(binding = 0) buffer Buffers
+{
+ vec4 f4;
+ ivec4 i4;
+ uvec4 u4;
+ dvec4 d4;
+} data[4];
+
+void main()
+{
+ uint invocation = (gl_SubgroupInvocationID + gl_SubgroupSize) % 4;
+
+ uvec4 relMask = gl_SubgroupEqMask +
+ gl_SubgroupGeMask +
+ gl_SubgroupGtMask +
+ gl_SubgroupLeMask +
+ gl_SubgroupLtMask;
+
+ uvec4 result = subgroupBallot(true);
+
+ data[invocation].u4.x = subgroupBallotBitCount(result);
+ data[invocation].u4.y = subgroupBallotBitExtract(result, 0) ? 1 : 0;
+ data[invocation].u4.z = subgroupBallotInclusiveBitCount(result) + subgroupBallotExclusiveBitCount(result);
+ data[invocation].u4.w = subgroupBallotFindLSB(result) + subgroupBallotFindMSB(result);
+
+ data[invocation].f4.x = subgroupBroadcast(data[0].f4.x, invocation); // ERROR: not constant
+}
diff --git a/glslang/MachineIndependent/ParseHelper.cpp b/glslang/MachineIndependent/ParseHelper.cpp
index c894f5c..5d1ff9e 100755
--- a/glslang/MachineIndependent/ParseHelper.cpp
+++ b/glslang/MachineIndependent/ParseHelper.cpp
@@ -1998,6 +1998,10 @@
case EOpSubgroupClusteredAnd:
case EOpSubgroupClusteredOr:
case EOpSubgroupClusteredXor:
+ // The <clusterSize> as used in the subgroupClustered<op>() operations must be:
+ // - An integral constant expression.
+ // - At least 1.
+ // - A power of 2.
if ((*argp)[1]->getAsConstantUnion() == nullptr)
error(loc, "argument must be compile-time constant", "cluster size", "");
else {
@@ -2009,6 +2013,12 @@
}
break;
+ case EOpSubgroupBroadcast:
+ // <id> must be an integral constant expression.
+ if ((*argp)[1]->getAsConstantUnion() == nullptr)
+ error(loc, "argument must be compile-time constant", "id", "");
+ break;
+
case EOpBarrier:
case EOpMemoryBarrier:
if (argp->size() > 0) {
diff --git a/gtests/Spv.FromFile.cpp b/gtests/Spv.FromFile.cpp
old mode 100644
new mode 100755
index 410f8ed..f686afd
--- a/gtests/Spv.FromFile.cpp
+++ b/gtests/Spv.FromFile.cpp
@@ -388,6 +388,7 @@
"spv.subgroupArithmetic.comp",
"spv.subgroupBasic.comp",
"spv.subgroupBallot.comp",
+ "spv.subgroupBallotNeg.comp",
"spv.subgroupClustered.comp",
"spv.subgroupClusteredNeg.comp",
"spv.subgroupPartitioned.comp",