1#version 450 2 3#extension GL_KHR_shader_subgroup_clustered: enable 4#extension GL_EXT_shader_explicit_arithmetic_types_int8: enable 5#extension GL_EXT_shader_explicit_arithmetic_types_int16: enable 6#extension GL_EXT_shader_explicit_arithmetic_types_int64: enable 7#extension GL_EXT_shader_explicit_arithmetic_types_float16: enable 8 9layout (local_size_x = 8) in; 10 11layout(binding = 0) buffer Buffers 12{ 13 i8vec4 i8; 14 u8vec4 u8; 15 i16vec4 i16; 16 u16vec4 u16; 17 i64vec4 i64; 18 u64vec4 u64; 19 f16vec4 f16; 20} data[4]; 21 22void main() 23{ 24 uint invocation = (gl_SubgroupInvocationID + gl_SubgroupSize) % 4; 25 26 data[invocation].i8.x = subgroupClusteredAdd(data[0].i8.x, 1); 27 data[invocation].i8.xy = subgroupClusteredAdd(data[1].i8.xy, 1); 28 data[invocation].i8.xyz = subgroupClusteredAdd(data[2].i8.xyz, 1); 29 data[invocation].i8 = subgroupClusteredAdd(data[3].i8, 1); 30 31 data[invocation].i8.x = subgroupClusteredMul(data[0].i8.x, 1); 32 data[invocation].i8.xy = subgroupClusteredMul(data[1].i8.xy, 1); 33 data[invocation].i8.xyz = subgroupClusteredMul(data[2].i8.xyz, 1); 34 data[invocation].i8 = subgroupClusteredMul(data[3].i8, 1); 35 36 data[invocation].i8.x = subgroupClusteredMin(data[0].i8.x, 1); 37 data[invocation].i8.xy = subgroupClusteredMin(data[1].i8.xy, 1); 38 data[invocation].i8.xyz = subgroupClusteredMin(data[2].i8.xyz, 1); 39 data[invocation].i8 = subgroupClusteredMin(data[3].i8, 1); 40 41 data[invocation].i8.x = subgroupClusteredMax(data[0].i8.x, 1); 42 data[invocation].i8.xy = subgroupClusteredMax(data[1].i8.xy, 1); 43 data[invocation].i8.xyz = subgroupClusteredMax(data[2].i8.xyz, 1); 44 data[invocation].i8 = subgroupClusteredMax(data[3].i8, 1); 45 46 data[invocation].i8.x = subgroupClusteredAnd(data[0].i8.x, 1); 47 data[invocation].i8.xy = subgroupClusteredAnd(data[1].i8.xy, 1); 48 data[invocation].i8.xyz = subgroupClusteredAnd(data[2].i8.xyz, 1); 49 data[invocation].i8 = subgroupClusteredAnd(data[3].i8, 1); 50 51 data[invocation].i8.x = subgroupClusteredOr(data[0].i8.x, 1); 52 data[invocation].i8.xy = subgroupClusteredOr(data[1].i8.xy, 1); 53 data[invocation].i8.xyz = subgroupClusteredOr(data[2].i8.xyz, 1); 54 data[invocation].i8 = subgroupClusteredOr(data[3].i8, 1); 55 56 data[invocation].i8.x = subgroupClusteredXor(data[0].i8.x, 1); 57 data[invocation].i8.xy = subgroupClusteredXor(data[1].i8.xy, 1); 58 data[invocation].i8.xyz = subgroupClusteredXor(data[2].i8.xyz, 1); 59 data[invocation].i8 = subgroupClusteredXor(data[3].i8, 1); 60 61 data[invocation].u8.x = subgroupClusteredAdd(data[0].u8.x, 1); 62 data[invocation].u8.xy = subgroupClusteredAdd(data[1].u8.xy, 1); 63 data[invocation].u8.xyz = subgroupClusteredAdd(data[2].u8.xyz, 1); 64 data[invocation].u8 = subgroupClusteredAdd(data[3].u8, 1); 65 66 data[invocation].u8.x = subgroupClusteredMul(data[0].u8.x, 1); 67 data[invocation].u8.xy = subgroupClusteredMul(data[1].u8.xy, 1); 68 data[invocation].u8.xyz = subgroupClusteredMul(data[2].u8.xyz, 1); 69 data[invocation].u8 = subgroupClusteredMul(data[3].u8, 1); 70 71 data[invocation].u8.x = subgroupClusteredMin(data[0].u8.x, 1); 72 data[invocation].u8.xy = subgroupClusteredMin(data[1].u8.xy, 1); 73 data[invocation].u8.xyz = subgroupClusteredMin(data[2].u8.xyz, 1); 74 data[invocation].u8 = subgroupClusteredMin(data[3].u8, 1); 75 76 data[invocation].u8.x = subgroupClusteredMax(data[0].u8.x, 1); 77 data[invocation].u8.xy = subgroupClusteredMax(data[1].u8.xy, 1); 78 data[invocation].u8.xyz = subgroupClusteredMax(data[2].u8.xyz, 1); 79 data[invocation].u8 = subgroupClusteredMax(data[3].u8, 1); 80 81 data[invocation].u8.x = subgroupClusteredAnd(data[0].u8.x, 1); 82 data[invocation].u8.xy = subgroupClusteredAnd(data[1].u8.xy, 1); 83 data[invocation].u8.xyz = subgroupClusteredAnd(data[2].u8.xyz, 1); 84 data[invocation].u8 = subgroupClusteredAnd(data[3].u8, 1); 85 86 data[invocation].u8.x = subgroupClusteredOr(data[0].u8.x, 1); 87 data[invocation].u8.xy = subgroupClusteredOr(data[1].u8.xy, 1); 88 data[invocation].u8.xyz = subgroupClusteredOr(data[2].u8.xyz, 1); 89 data[invocation].u8 = subgroupClusteredOr(data[3].u8, 1); 90 91 data[invocation].u8.x = subgroupClusteredXor(data[0].u8.x, 1); 92 data[invocation].u8.xy = subgroupClusteredXor(data[1].u8.xy, 1); 93 data[invocation].u8.xyz = subgroupClusteredXor(data[2].u8.xyz, 1); 94 data[invocation].u8 = subgroupClusteredXor(data[3].u8, 1); 95 96 data[invocation].i16.x = subgroupClusteredAdd(data[0].i16.x, 1); 97 data[invocation].i16.xy = subgroupClusteredAdd(data[1].i16.xy, 1); 98 data[invocation].i16.xyz = subgroupClusteredAdd(data[2].i16.xyz, 1); 99 data[invocation].i16 = subgroupClusteredAdd(data[3].i16, 1); 100 101 data[invocation].i16.x = subgroupClusteredMul(data[0].i16.x, 1); 102 data[invocation].i16.xy = subgroupClusteredMul(data[1].i16.xy, 1); 103 data[invocation].i16.xyz = subgroupClusteredMul(data[2].i16.xyz, 1); 104 data[invocation].i16 = subgroupClusteredMul(data[3].i16, 1); 105 106 data[invocation].i16.x = subgroupClusteredMin(data[0].i16.x, 1); 107 data[invocation].i16.xy = subgroupClusteredMin(data[1].i16.xy, 1); 108 data[invocation].i16.xyz = subgroupClusteredMin(data[2].i16.xyz, 1); 109 data[invocation].i16 = subgroupClusteredMin(data[3].i16, 1); 110 111 data[invocation].i16.x = subgroupClusteredMax(data[0].i16.x, 1); 112 data[invocation].i16.xy = subgroupClusteredMax(data[1].i16.xy, 1); 113 data[invocation].i16.xyz = subgroupClusteredMax(data[2].i16.xyz, 1); 114 data[invocation].i16 = subgroupClusteredMax(data[3].i16, 1); 115 116 data[invocation].i16.x = subgroupClusteredAnd(data[0].i16.x, 1); 117 data[invocation].i16.xy = subgroupClusteredAnd(data[1].i16.xy, 1); 118 data[invocation].i16.xyz = subgroupClusteredAnd(data[2].i16.xyz, 1); 119 data[invocation].i16 = subgroupClusteredAnd(data[3].i16, 1); 120 121 data[invocation].i16.x = subgroupClusteredOr(data[0].i16.x, 1); 122 data[invocation].i16.xy = subgroupClusteredOr(data[1].i16.xy, 1); 123 data[invocation].i16.xyz = subgroupClusteredOr(data[2].i16.xyz, 1); 124 data[invocation].i16 = subgroupClusteredOr(data[3].i16, 1); 125 126 data[invocation].i16.x = subgroupClusteredXor(data[0].i16.x, 1); 127 data[invocation].i16.xy = subgroupClusteredXor(data[1].i16.xy, 1); 128 data[invocation].i16.xyz = subgroupClusteredXor(data[2].i16.xyz, 1); 129 data[invocation].i16 = subgroupClusteredXor(data[3].i16, 1); 130 131 data[invocation].u16.x = subgroupClusteredAdd(data[0].u16.x, 1); 132 data[invocation].u16.xy = subgroupClusteredAdd(data[1].u16.xy, 1); 133 data[invocation].u16.xyz = subgroupClusteredAdd(data[2].u16.xyz, 1); 134 data[invocation].u16 = subgroupClusteredAdd(data[3].u16, 1); 135 136 data[invocation].u16.x = subgroupClusteredMul(data[0].u16.x, 1); 137 data[invocation].u16.xy = subgroupClusteredMul(data[1].u16.xy, 1); 138 data[invocation].u16.xyz = subgroupClusteredMul(data[2].u16.xyz, 1); 139 data[invocation].u16 = subgroupClusteredMul(data[3].u16, 1); 140 141 data[invocation].u16.x = subgroupClusteredMin(data[0].u16.x, 1); 142 data[invocation].u16.xy = subgroupClusteredMin(data[1].u16.xy, 1); 143 data[invocation].u16.xyz = subgroupClusteredMin(data[2].u16.xyz, 1); 144 data[invocation].u16 = subgroupClusteredMin(data[3].u16, 1); 145 146 data[invocation].u16.x = subgroupClusteredMax(data[0].u16.x, 1); 147 data[invocation].u16.xy = subgroupClusteredMax(data[1].u16.xy, 1); 148 data[invocation].u16.xyz = subgroupClusteredMax(data[2].u16.xyz, 1); 149 data[invocation].u16 = subgroupClusteredMax(data[3].u16, 1); 150 151 data[invocation].u16.x = subgroupClusteredAnd(data[0].u16.x, 1); 152 data[invocation].u16.xy = subgroupClusteredAnd(data[1].u16.xy, 1); 153 data[invocation].u16.xyz = subgroupClusteredAnd(data[2].u16.xyz, 1); 154 data[invocation].u16 = subgroupClusteredAnd(data[3].u16, 1); 155 156 data[invocation].u16.x = subgroupClusteredOr(data[0].u16.x, 1); 157 data[invocation].u16.xy = subgroupClusteredOr(data[1].u16.xy, 1); 158 data[invocation].u16.xyz = subgroupClusteredOr(data[2].u16.xyz, 1); 159 data[invocation].u16 = subgroupClusteredOr(data[3].u16, 1); 160 161 data[invocation].u16.x = subgroupClusteredXor(data[0].u16.x, 1); 162 data[invocation].u16.xy = subgroupClusteredXor(data[1].u16.xy, 1); 163 data[invocation].u16.xyz = subgroupClusteredXor(data[2].u16.xyz, 1); 164 data[invocation].u16 = subgroupClusteredXor(data[3].u16, 1); 165 166 data[invocation].i64.x = subgroupClusteredAdd(data[0].i64.x, 1); 167 data[invocation].i64.xy = subgroupClusteredAdd(data[1].i64.xy, 1); 168 data[invocation].i64.xyz = subgroupClusteredAdd(data[2].i64.xyz, 1); 169 data[invocation].i64 = subgroupClusteredAdd(data[3].i64, 1); 170 171 data[invocation].i64.x = subgroupClusteredMul(data[0].i64.x, 1); 172 data[invocation].i64.xy = subgroupClusteredMul(data[1].i64.xy, 1); 173 data[invocation].i64.xyz = subgroupClusteredMul(data[2].i64.xyz, 1); 174 data[invocation].i64 = subgroupClusteredMul(data[3].i64, 1); 175 176 data[invocation].i64.x = subgroupClusteredMin(data[0].i64.x, 1); 177 data[invocation].i64.xy = subgroupClusteredMin(data[1].i64.xy, 1); 178 data[invocation].i64.xyz = subgroupClusteredMin(data[2].i64.xyz, 1); 179 data[invocation].i64 = subgroupClusteredMin(data[3].i64, 1); 180 181 data[invocation].i64.x = subgroupClusteredMax(data[0].i64.x, 1); 182 data[invocation].i64.xy = subgroupClusteredMax(data[1].i64.xy, 1); 183 data[invocation].i64.xyz = subgroupClusteredMax(data[2].i64.xyz, 1); 184 data[invocation].i64 = subgroupClusteredMax(data[3].i64, 1); 185 186 data[invocation].i64.x = subgroupClusteredAnd(data[0].i64.x, 1); 187 data[invocation].i64.xy = subgroupClusteredAnd(data[1].i64.xy, 1); 188 data[invocation].i64.xyz = subgroupClusteredAnd(data[2].i64.xyz, 1); 189 data[invocation].i64 = subgroupClusteredAnd(data[3].i64, 1); 190 191 data[invocation].i64.x = subgroupClusteredOr(data[0].i64.x, 1); 192 data[invocation].i64.xy = subgroupClusteredOr(data[1].i64.xy, 1); 193 data[invocation].i64.xyz = subgroupClusteredOr(data[2].i64.xyz, 1); 194 data[invocation].i64 = subgroupClusteredOr(data[3].i64, 1); 195 196 data[invocation].i64.x = subgroupClusteredXor(data[0].i64.x, 1); 197 data[invocation].i64.xy = subgroupClusteredXor(data[1].i64.xy, 1); 198 data[invocation].i64.xyz = subgroupClusteredXor(data[2].i64.xyz, 1); 199 data[invocation].i64 = subgroupClusteredXor(data[3].i64, 1); 200 201 data[invocation].u64.x = subgroupClusteredAdd(data[0].u64.x, 1); 202 data[invocation].u64.xy = subgroupClusteredAdd(data[1].u64.xy, 1); 203 data[invocation].u64.xyz = subgroupClusteredAdd(data[2].u64.xyz, 1); 204 data[invocation].u64 = subgroupClusteredAdd(data[3].u64, 1); 205 206 data[invocation].u64.x = subgroupClusteredMul(data[0].u64.x, 1); 207 data[invocation].u64.xy = subgroupClusteredMul(data[1].u64.xy, 1); 208 data[invocation].u64.xyz = subgroupClusteredMul(data[2].u64.xyz, 1); 209 data[invocation].u64 = subgroupClusteredMul(data[3].u64, 1); 210 211 data[invocation].u64.x = subgroupClusteredMin(data[0].u64.x, 1); 212 data[invocation].u64.xy = subgroupClusteredMin(data[1].u64.xy, 1); 213 data[invocation].u64.xyz = subgroupClusteredMin(data[2].u64.xyz, 1); 214 data[invocation].u64 = subgroupClusteredMin(data[3].u64, 1); 215 216 data[invocation].u64.x = subgroupClusteredMax(data[0].u64.x, 1); 217 data[invocation].u64.xy = subgroupClusteredMax(data[1].u64.xy, 1); 218 data[invocation].u64.xyz = subgroupClusteredMax(data[2].u64.xyz, 1); 219 data[invocation].u64 = subgroupClusteredMax(data[3].u64, 1); 220 221 data[invocation].u64.x = subgroupClusteredAnd(data[0].u64.x, 1); 222 data[invocation].u64.xy = subgroupClusteredAnd(data[1].u64.xy, 1); 223 data[invocation].u64.xyz = subgroupClusteredAnd(data[2].u64.xyz, 1); 224 data[invocation].u64 = subgroupClusteredAnd(data[3].u64, 1); 225 226 data[invocation].u64.x = subgroupClusteredOr(data[0].u64.x, 1); 227 data[invocation].u64.xy = subgroupClusteredOr(data[1].u64.xy, 1); 228 data[invocation].u64.xyz = subgroupClusteredOr(data[2].u64.xyz, 1); 229 data[invocation].u64 = subgroupClusteredOr(data[3].u64, 1); 230 231 data[invocation].u64.x = subgroupClusteredXor(data[0].u64.x, 1); 232 data[invocation].u64.xy = subgroupClusteredXor(data[1].u64.xy, 1); 233 data[invocation].u64.xyz = subgroupClusteredXor(data[2].u64.xyz, 1); 234 data[invocation].u64 = subgroupClusteredXor(data[3].u64, 1); 235 236 data[invocation].f16.x = subgroupClusteredAdd(data[0].f16.x, 1); 237 data[invocation].f16.xy = subgroupClusteredAdd(data[1].f16.xy, 1); 238 data[invocation].f16.xyz = subgroupClusteredAdd(data[2].f16.xyz, 1); 239 data[invocation].f16 = subgroupClusteredAdd(data[3].f16, 1); 240 241 data[invocation].f16.x = subgroupClusteredMul(data[0].f16.x, 1); 242 data[invocation].f16.xy = subgroupClusteredMul(data[1].f16.xy, 1); 243 data[invocation].f16.xyz = subgroupClusteredMul(data[2].f16.xyz, 1); 244 data[invocation].f16 = subgroupClusteredMul(data[3].f16, 1); 245 246 data[invocation].f16.x = subgroupClusteredMin(data[0].f16.x, 1); 247 data[invocation].f16.xy = subgroupClusteredMin(data[1].f16.xy, 1); 248 data[invocation].f16.xyz = subgroupClusteredMin(data[2].f16.xyz, 1); 249 data[invocation].f16 = subgroupClusteredMin(data[3].f16, 1); 250 251 data[invocation].f16.x = subgroupClusteredMax(data[0].f16.x, 1); 252 data[invocation].f16.xy = subgroupClusteredMax(data[1].f16.xy, 1); 253 data[invocation].f16.xyz = subgroupClusteredMax(data[2].f16.xyz, 1); 254 data[invocation].f16 = subgroupClusteredMax(data[3].f16, 1); 255} 256