John Kessenich | 66011cb | 2018-03-06 16:12:04 -0700 | [diff] [blame] | 1 | #version 450
|
| 2 |
|
| 3 | #extension GL_KHR_shader_subgroup_clustered: enable
|
| 4 |
|
| 5 | layout (local_size_x = 8) in;
|
| 6 |
|
| 7 | layout(binding = 0) buffer Buffers
|
| 8 | {
|
| 9 | vec4 f4;
|
| 10 | ivec4 i4;
|
| 11 | uvec4 u4;
|
| 12 | dvec4 d4;
|
| 13 | } data[4];
|
| 14 |
|
| 15 | void main()
|
| 16 | {
|
| 17 | uint invocation = (gl_SubgroupInvocationID + gl_SubgroupSize) % 4;
|
| 18 |
|
| 19 | data[invocation].f4.x = subgroupClusteredAdd(data[0].f4.x, 1);
|
| 20 | data[invocation].f4.xy = subgroupClusteredAdd(data[1].f4.xy, 1);
|
| 21 | data[invocation].f4.xyz = subgroupClusteredAdd(data[2].f4.xyz, 1);
|
| 22 | data[invocation].f4 = subgroupClusteredAdd(data[3].f4, 1);
|
| 23 |
|
| 24 | data[invocation].i4.x = subgroupClusteredAdd(data[0].i4.x, 1);
|
| 25 | data[invocation].i4.xy = subgroupClusteredAdd(data[1].i4.xy, 1);
|
| 26 | data[invocation].i4.xyz = subgroupClusteredAdd(data[2].i4.xyz, 1);
|
| 27 | data[invocation].i4 = subgroupClusteredAdd(data[3].i4, 1);
|
| 28 |
|
| 29 | data[invocation].u4.x = subgroupClusteredAdd(data[0].u4.x, 1);
|
| 30 | data[invocation].u4.xy = subgroupClusteredAdd(data[1].u4.xy, 1);
|
| 31 | data[invocation].u4.xyz = subgroupClusteredAdd(data[2].u4.xyz, 1);
|
| 32 | data[invocation].u4 = subgroupClusteredAdd(data[3].u4, 1);
|
| 33 |
|
| 34 | data[invocation].d4.x = subgroupClusteredAdd(data[0].d4.x, 1);
|
| 35 | data[invocation].d4.xy = subgroupClusteredAdd(data[1].d4.xy, 1);
|
| 36 | data[invocation].d4.xyz = subgroupClusteredAdd(data[2].d4.xyz, 1);
|
| 37 | data[invocation].d4 = subgroupClusteredAdd(data[3].d4, 1);
|
| 38 |
|
| 39 | data[invocation].f4.x = subgroupClusteredMul(data[0].f4.x, 1);
|
| 40 | data[invocation].f4.xy = subgroupClusteredMul(data[1].f4.xy, 1);
|
| 41 | data[invocation].f4.xyz = subgroupClusteredMul(data[2].f4.xyz, 1);
|
| 42 | data[invocation].f4 = subgroupClusteredMul(data[3].f4, 1);
|
| 43 |
|
| 44 | data[invocation].i4.x = subgroupClusteredMul(data[0].i4.x, 1);
|
| 45 | data[invocation].i4.xy = subgroupClusteredMul(data[1].i4.xy, 1);
|
| 46 | data[invocation].i4.xyz = subgroupClusteredMul(data[2].i4.xyz, 1);
|
| 47 | data[invocation].i4 = subgroupClusteredMul(data[3].i4, 1);
|
| 48 |
|
| 49 | data[invocation].u4.x = subgroupClusteredMul(data[0].u4.x, 1);
|
| 50 | data[invocation].u4.xy = subgroupClusteredMul(data[1].u4.xy, 1);
|
| 51 | data[invocation].u4.xyz = subgroupClusteredMul(data[2].u4.xyz, 1);
|
| 52 | data[invocation].u4 = subgroupClusteredMul(data[3].u4, 1);
|
| 53 |
|
| 54 | data[invocation].d4.x = subgroupClusteredMul(data[0].d4.x, 1);
|
| 55 | data[invocation].d4.xy = subgroupClusteredMul(data[1].d4.xy, 1);
|
| 56 | data[invocation].d4.xyz = subgroupClusteredMul(data[2].d4.xyz, 1);
|
| 57 | data[invocation].d4 = subgroupClusteredMul(data[3].d4, 1);
|
| 58 |
|
| 59 | data[invocation].f4.x = subgroupClusteredMin(data[0].f4.x, 1);
|
| 60 | data[invocation].f4.xy = subgroupClusteredMin(data[1].f4.xy, 1);
|
| 61 | data[invocation].f4.xyz = subgroupClusteredMin(data[2].f4.xyz, 1);
|
| 62 | data[invocation].f4 = subgroupClusteredMin(data[3].f4, 1);
|
| 63 |
|
| 64 | data[invocation].i4.x = subgroupClusteredMin(data[0].i4.x, 1);
|
| 65 | data[invocation].i4.xy = subgroupClusteredMin(data[1].i4.xy, 1);
|
| 66 | data[invocation].i4.xyz = subgroupClusteredMin(data[2].i4.xyz, 1);
|
| 67 | data[invocation].i4 = subgroupClusteredMin(data[3].i4, 1);
|
| 68 |
|
| 69 | data[invocation].u4.x = subgroupClusteredMin(data[0].u4.x, 1);
|
| 70 | data[invocation].u4.xy = subgroupClusteredMin(data[1].u4.xy, 1);
|
| 71 | data[invocation].u4.xyz = subgroupClusteredMin(data[2].u4.xyz, 1);
|
| 72 | data[invocation].u4 = subgroupClusteredMin(data[3].u4, 1);
|
| 73 |
|
| 74 | data[invocation].d4.x = subgroupClusteredMin(data[0].d4.x, 1);
|
| 75 | data[invocation].d4.xy = subgroupClusteredMin(data[1].d4.xy, 1);
|
| 76 | data[invocation].d4.xyz = subgroupClusteredMin(data[2].d4.xyz, 1);
|
| 77 | data[invocation].d4 = subgroupClusteredMin(data[3].d4, 1);
|
| 78 |
|
| 79 | data[invocation].f4.x = subgroupClusteredMax(data[0].f4.x, 1);
|
| 80 | data[invocation].f4.xy = subgroupClusteredMax(data[1].f4.xy, 1);
|
| 81 | data[invocation].f4.xyz = subgroupClusteredMax(data[2].f4.xyz, 1);
|
| 82 | data[invocation].f4 = subgroupClusteredMax(data[3].f4, 1);
|
| 83 |
|
| 84 | data[invocation].i4.x = subgroupClusteredMax(data[0].i4.x, 1);
|
| 85 | data[invocation].i4.xy = subgroupClusteredMax(data[1].i4.xy, 1);
|
| 86 | data[invocation].i4.xyz = subgroupClusteredMax(data[2].i4.xyz, 1);
|
| 87 | data[invocation].i4 = subgroupClusteredMax(data[3].i4, 1);
|
| 88 |
|
| 89 | data[invocation].u4.x = subgroupClusteredMax(data[0].u4.x, 1);
|
| 90 | data[invocation].u4.xy = subgroupClusteredMax(data[1].u4.xy, 1);
|
| 91 | data[invocation].u4.xyz = subgroupClusteredMax(data[2].u4.xyz, 1);
|
| 92 | data[invocation].u4 = subgroupClusteredMax(data[3].u4, 1);
|
| 93 |
|
| 94 | data[invocation].d4.x = subgroupClusteredMax(data[0].d4.x, 1);
|
| 95 | data[invocation].d4.xy = subgroupClusteredMax(data[1].d4.xy, 1);
|
| 96 | data[invocation].d4.xyz = subgroupClusteredMax(data[2].d4.xyz, 1);
|
| 97 | data[invocation].d4 = subgroupClusteredMax(data[3].d4, 1);
|
| 98 |
|
| 99 | data[invocation].i4.x = subgroupClusteredAnd(data[0].i4.x, 1);
|
| 100 | data[invocation].i4.xy = subgroupClusteredAnd(data[1].i4.xy, 1);
|
| 101 | data[invocation].i4.xyz = subgroupClusteredAnd(data[2].i4.xyz, 1);
|
| 102 | data[invocation].i4 = subgroupClusteredAnd(data[3].i4, 1);
|
| 103 |
|
| 104 | data[invocation].u4.x = subgroupClusteredAnd(data[0].u4.x, 1);
|
| 105 | data[invocation].u4.xy = subgroupClusteredAnd(data[1].u4.xy, 1);
|
| 106 | data[invocation].u4.xyz = subgroupClusteredAnd(data[2].u4.xyz, 1);
|
| 107 | data[invocation].u4 = subgroupClusteredAnd(data[3].u4, 1);
|
| 108 |
|
| 109 | data[invocation].i4.x = int(subgroupClusteredAnd(data[0].i4.x < 0, 1));
|
| 110 | data[invocation].i4.xy = ivec2(subgroupClusteredAnd(lessThan(data[1].i4.xy, ivec2(0)), 1));
|
| 111 | data[invocation].i4.xyz = ivec3(subgroupClusteredAnd(lessThan(data[1].i4.xyz, ivec3(0)), 1));
|
| 112 | data[invocation].i4 = ivec4(subgroupClusteredAnd(lessThan(data[1].i4, ivec4(0)), 1));
|
| 113 |
|
| 114 | data[invocation].i4.x = subgroupClusteredOr(data[0].i4.x, 1);
|
| 115 | data[invocation].i4.xy = subgroupClusteredOr(data[1].i4.xy, 1);
|
| 116 | data[invocation].i4.xyz = subgroupClusteredOr(data[2].i4.xyz, 1);
|
| 117 | data[invocation].i4 = subgroupClusteredOr(data[3].i4, 1);
|
| 118 |
|
| 119 | data[invocation].u4.x = subgroupClusteredOr(data[0].u4.x, 1);
|
| 120 | data[invocation].u4.xy = subgroupClusteredOr(data[1].u4.xy, 1);
|
| 121 | data[invocation].u4.xyz = subgroupClusteredOr(data[2].u4.xyz, 1);
|
| 122 | data[invocation].u4 = subgroupClusteredOr(data[3].u4, 1);
|
| 123 |
|
| 124 | data[invocation].i4.x = int(subgroupClusteredOr(data[0].i4.x < 0, 1));
|
| 125 | data[invocation].i4.xy = ivec2(subgroupClusteredOr(lessThan(data[1].i4.xy, ivec2(0)), 1));
|
| 126 | data[invocation].i4.xyz = ivec3(subgroupClusteredOr(lessThan(data[1].i4.xyz, ivec3(0)), 1));
|
| 127 | data[invocation].i4 = ivec4(subgroupClusteredOr(lessThan(data[1].i4, ivec4(0)), 1));
|
| 128 |
|
| 129 | data[invocation].i4.x = subgroupClusteredXor(data[0].i4.x, 1);
|
| 130 | data[invocation].i4.xy = subgroupClusteredXor(data[1].i4.xy, 1);
|
| 131 | data[invocation].i4.xyz = subgroupClusteredXor(data[2].i4.xyz, 1);
|
| 132 | data[invocation].i4 = subgroupClusteredXor(data[3].i4, 1);
|
| 133 |
|
| 134 | data[invocation].u4.x = subgroupClusteredXor(data[0].u4.x, 1);
|
| 135 | data[invocation].u4.xy = subgroupClusteredXor(data[1].u4.xy, 1);
|
| 136 | data[invocation].u4.xyz = subgroupClusteredXor(data[2].u4.xyz, 1);
|
| 137 | data[invocation].u4 = subgroupClusteredXor(data[3].u4, 1);
|
| 138 |
|
| 139 | data[invocation].i4.x = int(subgroupClusteredXor(data[0].i4.x < 0, 1));
|
| 140 | data[invocation].i4.xy = ivec2(subgroupClusteredXor(lessThan(data[1].i4.xy, ivec2(0)), 1));
|
| 141 | data[invocation].i4.xyz = ivec3(subgroupClusteredXor(lessThan(data[1].i4.xyz, ivec3(0)), 1));
|
| 142 | data[invocation].i4 = ivec4(subgroupClusteredXor(lessThan(data[1].i4, ivec4(0)), 1));
|
| 143 | }
|