| 1 |
static const uint3 gl_WorkGroupSize = uint3(1u, 1u, 1u); |
| 2 |
|
| 3 |
RWByteAddressBuffer _9 : register(u0, space0); |
| 4 |
|
| 5 |
static uint4 gl_SubgroupEqMask; |
| 6 |
static uint4 gl_SubgroupGeMask; |
| 7 |
static uint4 gl_SubgroupGtMask; |
| 8 |
static uint4 gl_SubgroupLeMask; |
| 9 |
static uint4 gl_SubgroupLtMask; |
| 10 |
void comp_main() |
| 11 |
{ |
| 12 |
_9.Store(0, asuint(float(WaveGetLaneCount()))); |
| 13 |
_9.Store(0, asuint(float(WaveGetLaneIndex()))); |
| 14 |
bool elected = WaveIsFirstLane(); |
| 15 |
_9.Store(0, asuint(float4(gl_SubgroupEqMask).x)); |
| 16 |
_9.Store(0, asuint(float4(gl_SubgroupGeMask).x)); |
| 17 |
_9.Store(0, asuint(float4(gl_SubgroupGtMask).x)); |
| 18 |
_9.Store(0, asuint(float4(gl_SubgroupLeMask).x)); |
| 19 |
_9.Store(0, asuint(float4(gl_SubgroupLtMask).x)); |
| 20 |
float4 broadcasted = WaveReadLaneAt(10.0f.xxxx, 8u); |
| 21 |
float3 first = WaveReadLaneFirst(20.0f.xxx); |
| 22 |
uint4 ballot_value = WaveActiveBallot(true); |
| 23 |
uint bit_count = countbits(ballot_value.x) + countbits(ballot_value.y) + countbits(ballot_value.z) + countbits(ballot_value.w); |
| 24 |
bool has_all = WaveActiveAllTrue(true); |
| 25 |
bool has_any = WaveActiveAnyTrue(true); |
| 26 |
bool has_equal = WaveActiveAllEqualBool(true); |
| 27 |
float4 added = WaveActiveSum(20.0f.xxxx); |
| 28 |
int4 iadded = WaveActiveSum(int4(20, 20, 20, 20)); |
| 29 |
float4 multiplied = WaveActiveProduct(20.0f.xxxx); |
| 30 |
int4 imultiplied = WaveActiveProduct(int4(20, 20, 20, 20)); |
| 31 |
float4 lo = WaveActiveMin(20.0f.xxxx); |
| 32 |
float4 hi = WaveActiveMax(20.0f.xxxx); |
| 33 |
int4 slo = WaveActiveMin(int4(20, 20, 20, 20)); |
| 34 |
int4 shi = WaveActiveMax(int4(20, 20, 20, 20)); |
| 35 |
uint4 ulo = WaveActiveMin(uint4(20u, 20u, 20u, 20u)); |
| 36 |
uint4 uhi = WaveActiveMax(uint4(20u, 20u, 20u, 20u)); |
| 37 |
uint4 anded = WaveActiveBitAnd(ballot_value); |
| 38 |
uint4 ored = WaveActiveBitOr(ballot_value); |
| 39 |
uint4 xored = WaveActiveBitXor(ballot_value); |
| 40 |
added = WavePrefixSum(added) + added; |
| 41 |
iadded = WavePrefixSum(iadded) + iadded; |
| 42 |
multiplied = WavePrefixProduct(multiplied) * multiplied; |
| 43 |
imultiplied = WavePrefixProduct(imultiplied) * imultiplied; |
| 44 |
added = WavePrefixSum(multiplied); |
| 45 |
multiplied = WavePrefixProduct(multiplied); |
| 46 |
iadded = WavePrefixSum(imultiplied); |
| 47 |
imultiplied = WavePrefixProduct(imultiplied); |
| 48 |
float4 swap_horiz = QuadReadAcrossX(20.0f.xxxx); |
| 49 |
float4 swap_vertical = QuadReadAcrossY(20.0f.xxxx); |
| 50 |
float4 swap_diagonal = QuadReadAcrossDiagonal(20.0f.xxxx); |
| 51 |
float4 quad_broadcast = QuadReadLaneAt(20.0f.xxxx, 3u); |
| 52 |
} |
| 53 |
|
| 54 |
[numthreads(1, 1, 1)] |
| 55 |
void main() |
| 56 |
{ |
| 57 |
gl_SubgroupEqMask = 1u << (WaveGetLaneIndex() - uint4(0, 32, 64, 96)); |
| 58 |
if (WaveGetLaneIndex() >= 32) gl_SubgroupEqMask.x = 0; |
| 59 |
if (WaveGetLaneIndex() >= 64 || WaveGetLaneIndex() < 32) gl_SubgroupEqMask.y = 0; |
| 60 |
if (WaveGetLaneIndex() >= 96 || WaveGetLaneIndex() < 64) gl_SubgroupEqMask.z = 0; |
| 61 |
if (WaveGetLaneIndex() < 96) gl_SubgroupEqMask.w = 0; |
| 62 |
gl_SubgroupGeMask = ~((1u << (WaveGetLaneIndex() - uint4(0, 32, 64, 96))) - 1u); |
| 63 |
if (WaveGetLaneIndex() >= 32) gl_SubgroupGeMask.x = 0u; |
| 64 |
if (WaveGetLaneIndex() >= 64) gl_SubgroupGeMask.y = 0u; |
| 65 |
if (WaveGetLaneIndex() >= 96) gl_SubgroupGeMask.z = 0u; |
| 66 |
if (WaveGetLaneIndex() < 32) gl_SubgroupGeMask.y = ~0u; |
| 67 |
if (WaveGetLaneIndex() < 64) gl_SubgroupGeMask.z = ~0u; |
| 68 |
if (WaveGetLaneIndex() < 96) gl_SubgroupGeMask.w = ~0u; |
| 69 |
uint gt_lane_index = WaveGetLaneIndex() + 1; |
| 70 |
gl_SubgroupGtMask = ~((1u << (gt_lane_index - uint4(0, 32, 64, 96))) - 1u); |
| 71 |
if (gt_lane_index >= 32) gl_SubgroupGtMask.x = 0u; |
| 72 |
if (gt_lane_index >= 64) gl_SubgroupGtMask.y = 0u; |
| 73 |
if (gt_lane_index >= 96) gl_SubgroupGtMask.z = 0u; |
| 74 |
if (gt_lane_index >= 128) gl_SubgroupGtMask.w = 0u; |
| 75 |
if (gt_lane_index < 32) gl_SubgroupGtMask.y = ~0u; |
| 76 |
if (gt_lane_index < 64) gl_SubgroupGtMask.z = ~0u; |
| 77 |
if (gt_lane_index < 96) gl_SubgroupGtMask.w = ~0u; |
| 78 |
uint le_lane_index = WaveGetLaneIndex() + 1; |
| 79 |
gl_SubgroupLeMask = (1u << (le_lane_index - uint4(0, 32, 64, 96))) - 1u; |
| 80 |
if (le_lane_index >= 32) gl_SubgroupLeMask.x = ~0u; |
| 81 |
if (le_lane_index >= 64) gl_SubgroupLeMask.y = ~0u; |
| 82 |
if (le_lane_index >= 96) gl_SubgroupLeMask.z = ~0u; |
| 83 |
if (le_lane_index >= 128) gl_SubgroupLeMask.w = ~0u; |
| 84 |
if (le_lane_index < 32) gl_SubgroupLeMask.y = 0u; |
| 85 |
if (le_lane_index < 64) gl_SubgroupLeMask.z = 0u; |
| 86 |
if (le_lane_index < 96) gl_SubgroupLeMask.w = 0u; |
| 87 |
gl_SubgroupLtMask = (1u << (WaveGetLaneIndex() - uint4(0, 32, 64, 96))) - 1u; |
| 88 |
if (WaveGetLaneIndex() >= 32) gl_SubgroupLtMask.x = ~0u; |
| 89 |
if (WaveGetLaneIndex() >= 64) gl_SubgroupLtMask.y = ~0u; |
| 90 |
if (WaveGetLaneIndex() >= 96) gl_SubgroupLtMask.z = ~0u; |
| 91 |
if (WaveGetLaneIndex() < 32) gl_SubgroupLtMask.y = 0u; |
| 92 |
if (WaveGetLaneIndex() < 64) gl_SubgroupLtMask.z = 0u; |
| 93 |
if (WaveGetLaneIndex() < 96) gl_SubgroupLtMask.w = 0u; |
| 94 |
comp_main(); |
| 95 |
} |