2024-04-15 21:30:12 -07:00
|
|
|
[require]
|
|
|
|
shader model >= 6.0
|
2024-10-05 05:46:00 -07:00
|
|
|
wave-ops
|
2024-08-01 16:13:31 -07:00
|
|
|
format r32-uint uav-load
|
2024-04-15 21:30:12 -07:00
|
|
|
|
|
|
|
[uav 0]
|
2024-08-01 18:03:46 -07:00
|
|
|
format r32-uint
|
2024-04-15 21:30:12 -07:00
|
|
|
size (buffer, 4)
|
|
|
|
|
|
|
|
8 15 8 10
|
|
|
|
|
|
|
|
[uav 1]
|
2024-08-01 18:03:46 -07:00
|
|
|
format r32-uint
|
2024-04-15 21:30:12 -07:00
|
|
|
size (buffer, 8)
|
|
|
|
|
|
|
|
0 0 0 0 0 0 0 0
|
|
|
|
|
|
|
|
[compute shader]
|
|
|
|
RWBuffer<uint> u1 : register(u1);
|
|
|
|
|
|
|
|
[numthreads(4, 1, 1)]
|
|
|
|
void main(uint id : SV_GroupIndex)
|
|
|
|
{
|
|
|
|
u1[id] = WaveIsFirstLane();
|
|
|
|
}
|
|
|
|
|
|
|
|
[test]
|
2024-04-23 04:56:26 -07:00
|
|
|
dispatch 4 1 1
|
2024-04-15 21:30:12 -07:00
|
|
|
probe uav 1 (0) rui (1)
|
|
|
|
probe uav 1 (1) rui (0)
|
|
|
|
probe uav 1 (2) rui (0)
|
|
|
|
probe uav 1 (3) rui (0)
|
|
|
|
|
|
|
|
|
|
|
|
[compute shader]
|
|
|
|
RWBuffer<uint> u1 : register(u1);
|
|
|
|
|
|
|
|
[numthreads(4, 1, 1)]
|
|
|
|
void main(uint id : SV_GroupIndex)
|
|
|
|
{
|
|
|
|
if (!id)
|
|
|
|
{
|
|
|
|
u1[0] = 0;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
u1[id] = WaveIsFirstLane();
|
|
|
|
}
|
|
|
|
|
|
|
|
[test]
|
2024-04-23 04:56:26 -07:00
|
|
|
dispatch 4 1 1
|
2024-04-15 21:30:12 -07:00
|
|
|
probe uav 1 (0) rui (0)
|
|
|
|
probe uav 1 (1) rui (1)
|
|
|
|
probe uav 1 (2) rui (0)
|
|
|
|
probe uav 1 (3) rui (0)
|
|
|
|
|
|
|
|
|
|
|
|
[compute shader]
|
|
|
|
RWBuffer<uint> u1 : register(u1);
|
|
|
|
|
|
|
|
[numthreads(4, 1, 1)]
|
|
|
|
void main(uint id : SV_GroupIndex)
|
|
|
|
{
|
|
|
|
u1[id] = WaveGetLaneIndex();
|
|
|
|
}
|
|
|
|
|
|
|
|
[test]
|
2024-04-17 17:59:08 -07:00
|
|
|
dispatch 4 1 1
|
2024-04-15 21:30:12 -07:00
|
|
|
probe uav 1 (0) rui (0)
|
|
|
|
probe uav 1 (1) rui (1)
|
|
|
|
probe uav 1 (2) rui (2)
|
|
|
|
probe uav 1 (3) rui (3)
|
|
|
|
|
|
|
|
|
|
|
|
[compute shader]
|
|
|
|
RWBuffer<uint> u1 : register(u1);
|
|
|
|
|
|
|
|
[numthreads(4, 1, 1)]
|
|
|
|
void main(uint id : SV_GroupIndex)
|
|
|
|
{
|
|
|
|
// Between 4 and 128, and includes inactive and/or helper lanes.
|
|
|
|
uint count = WaveGetLaneCount();
|
|
|
|
u1[id] = count >= 4 && count <= 128;
|
|
|
|
}
|
|
|
|
|
|
|
|
[test]
|
2023-06-19 22:16:52 -07:00
|
|
|
dispatch 4 1 1
|
2024-04-15 21:30:12 -07:00
|
|
|
probe uav 1 (0) rui (1)
|
|
|
|
probe uav 1 (1) rui (1)
|
|
|
|
probe uav 1 (2) rui (1)
|
|
|
|
probe uav 1 (3) rui (1)
|
|
|
|
|
|
|
|
|
|
|
|
[compute shader]
|
|
|
|
RWBuffer<uint> u0;
|
|
|
|
RWBuffer<uint> u1;
|
|
|
|
|
|
|
|
[numthreads(4, 1, 1)]
|
|
|
|
void main(uint id : SV_GroupIndex)
|
|
|
|
{
|
|
|
|
uint i = (id & 1) ? -u0[id] : u0[id];
|
|
|
|
u1[id] = WaveActiveMin(i);
|
|
|
|
}
|
|
|
|
|
|
|
|
[test]
|
2024-04-23 04:35:27 -07:00
|
|
|
dispatch 4 1 1
|
2024-04-15 21:30:12 -07:00
|
|
|
probe uav 1 (0) rui (8)
|
|
|
|
probe uav 1 (1) rui (8)
|
|
|
|
probe uav 1 (2) rui (8)
|
|
|
|
probe uav 1 (3) rui (8)
|
|
|
|
|
|
|
|
|
|
|
|
[compute shader]
|
|
|
|
RWBuffer<uint> u0;
|
|
|
|
RWBuffer<uint> u1;
|
|
|
|
|
|
|
|
[numthreads(4, 1, 1)]
|
|
|
|
void main(uint id : SV_GroupIndex)
|
|
|
|
{
|
|
|
|
bool b = u0[id] == 8;
|
|
|
|
u1[id] = WaveActiveBallot(b).x;
|
|
|
|
}
|
|
|
|
|
|
|
|
[test]
|
2024-04-23 04:00:56 -07:00
|
|
|
dispatch 4 1 1
|
2024-04-15 21:30:12 -07:00
|
|
|
probe uav 1 (0) rui (5)
|
|
|
|
probe uav 1 (1) rui (5)
|
|
|
|
probe uav 1 (2) rui (5)
|
|
|
|
probe uav 1 (3) rui (5)
|
|
|
|
|
|
|
|
|
|
|
|
[compute shader]
|
|
|
|
RWBuffer<uint> u0;
|
|
|
|
RWBuffer<uint> u1;
|
|
|
|
|
|
|
|
[numthreads(4, 1, 1)]
|
|
|
|
void main(uint id : SV_GroupIndex)
|
|
|
|
{
|
|
|
|
uint i = u0[id] + u0[id ^ 1];
|
|
|
|
u1[id] = WaveReadLaneFirst(i);
|
|
|
|
}
|
|
|
|
|
|
|
|
[test]
|
2024-04-23 06:36:42 -07:00
|
|
|
dispatch 4 1 1
|
2024-04-15 21:30:12 -07:00
|
|
|
probe uav 1 (0) rui (23)
|
|
|
|
probe uav 1 (1) rui (23)
|
|
|
|
probe uav 1 (2) rui (23)
|
|
|
|
probe uav 1 (3) rui (23)
|
|
|
|
|
|
|
|
|
|
|
|
[compute shader]
|
|
|
|
RWBuffer<uint> u0;
|
|
|
|
RWBuffer<uint> u1;
|
|
|
|
|
|
|
|
[numthreads(4, 1, 1)]
|
|
|
|
void main(uint id : SV_GroupIndex)
|
|
|
|
{
|
|
|
|
uint i = u0[id] + u0[id ^ 1];
|
|
|
|
u1[id] = WaveReadLaneAt(i, 3);
|
|
|
|
}
|
|
|
|
|
|
|
|
[test]
|
2024-05-08 19:25:44 -07:00
|
|
|
dispatch 4 1 1
|
2024-04-15 21:30:12 -07:00
|
|
|
probe uav 1 (0) rui (18)
|
|
|
|
probe uav 1 (1) rui (18)
|
|
|
|
probe uav 1 (2) rui (18)
|
|
|
|
probe uav 1 (3) rui (18)
|
|
|
|
|
|
|
|
|
2024-05-08 19:22:03 -07:00
|
|
|
[compute shader]
|
|
|
|
RWBuffer<uint> u0;
|
|
|
|
RWBuffer<uint> u1;
|
|
|
|
|
|
|
|
[numthreads(4, 1, 1)]
|
|
|
|
void main(uint id : SV_GroupIndex)
|
|
|
|
{
|
|
|
|
uint i = u0[id] + u0[id ^ 1];
|
|
|
|
// Non-uniform lane index
|
|
|
|
u1[id] = WaveReadLaneAt(i, (id + 2) & 3);
|
|
|
|
}
|
|
|
|
|
|
|
|
[test]
|
2024-05-08 19:25:44 -07:00
|
|
|
dispatch 4 1 1
|
2024-05-08 19:22:03 -07:00
|
|
|
probe uav 1 (0) rui (18)
|
|
|
|
probe uav 1 (1) rui (18)
|
|
|
|
probe uav 1 (2) rui (23)
|
|
|
|
probe uav 1 (3) rui (23)
|
|
|
|
|
|
|
|
|
2024-04-15 21:30:12 -07:00
|
|
|
[compute shader]
|
|
|
|
RWBuffer<uint> u0;
|
|
|
|
RWBuffer<uint> u1;
|
|
|
|
|
|
|
|
[numthreads(4, 1, 1)]
|
|
|
|
void main(uint id : SV_GroupIndex)
|
|
|
|
{
|
|
|
|
bool b = u0[id] == 8;
|
|
|
|
u1[id] = WaveActiveCountBits(b);
|
|
|
|
}
|
|
|
|
|
|
|
|
[test]
|
2024-04-23 04:52:12 -07:00
|
|
|
dispatch 4 1 1
|
2024-04-15 21:30:12 -07:00
|
|
|
probe uav 1 (0) rui (2)
|
|
|
|
probe uav 1 (1) rui (2)
|
|
|
|
probe uav 1 (2) rui (2)
|
|
|
|
probe uav 1 (3) rui (2)
|
|
|
|
|
|
|
|
|
|
|
|
[compute shader]
|
|
|
|
RWBuffer<uint> u0;
|
|
|
|
RWBuffer<uint> u1;
|
|
|
|
|
|
|
|
[numthreads(4, 1, 1)]
|
|
|
|
void main(uint id : SV_GroupIndex)
|
|
|
|
{
|
|
|
|
bool b = u0[id] == 8;
|
|
|
|
u1[id] = WavePrefixCountBits(b);
|
|
|
|
}
|
|
|
|
|
|
|
|
[test]
|
2024-04-23 05:03:14 -07:00
|
|
|
dispatch 4 1 1
|
2024-04-15 21:30:12 -07:00
|
|
|
probe uav 1 (0) rui (0)
|
|
|
|
probe uav 1 (1) rui (1)
|
|
|
|
probe uav 1 (2) rui (1)
|
|
|
|
probe uav 1 (3) rui (2)
|
|
|
|
|
|
|
|
|
|
|
|
[compute shader]
|
|
|
|
RWBuffer<uint> u0;
|
|
|
|
RWBuffer<uint> u1;
|
|
|
|
|
|
|
|
[numthreads(4, 1, 1)]
|
|
|
|
void main(uint id : SV_GroupIndex)
|
|
|
|
{
|
|
|
|
u1[id] = WaveActiveSum(u0[id]);
|
|
|
|
}
|
|
|
|
|
|
|
|
[test]
|
2024-04-23 04:35:27 -07:00
|
|
|
dispatch 4 1 1
|
2024-04-15 21:30:12 -07:00
|
|
|
probe uav 1 (0) rui (41)
|
|
|
|
probe uav 1 (1) rui (41)
|
|
|
|
probe uav 1 (2) rui (41)
|
|
|
|
probe uav 1 (3) rui (41)
|
|
|
|
|
|
|
|
|
|
|
|
[compute shader]
|
|
|
|
RWBuffer<uint> u0;
|
|
|
|
RWBuffer<uint> u1;
|
|
|
|
|
|
|
|
[numthreads(4, 1, 1)]
|
|
|
|
void main(uint id : SV_GroupIndex)
|
|
|
|
{
|
|
|
|
u1[id] = WaveActiveBitAnd(u0[id]);
|
|
|
|
}
|
|
|
|
|
|
|
|
[test]
|
2024-04-23 04:14:22 -07:00
|
|
|
dispatch 4 1 1
|
2024-04-15 21:30:12 -07:00
|
|
|
probe uav 1 (0) rui (8)
|
|
|
|
probe uav 1 (1) rui (8)
|
|
|
|
probe uav 1 (2) rui (8)
|
|
|
|
probe uav 1 (3) rui (8)
|
|
|
|
|
|
|
|
|
|
|
|
[compute shader]
|
|
|
|
RWBuffer<uint> u0;
|
|
|
|
RWBuffer<uint> u1;
|
|
|
|
|
|
|
|
[numthreads(4, 1, 1)]
|
|
|
|
void main(uint id : SV_GroupIndex)
|
|
|
|
{
|
|
|
|
u1[id] = WaveActiveBitOr(u0[id]);
|
|
|
|
}
|
|
|
|
|
|
|
|
[test]
|
2024-04-23 04:14:22 -07:00
|
|
|
dispatch 4 1 1
|
2024-04-15 21:30:12 -07:00
|
|
|
probe uav 1 (0) rui (15)
|
|
|
|
probe uav 1 (1) rui (15)
|
|
|
|
probe uav 1 (2) rui (15)
|
|
|
|
probe uav 1 (3) rui (15)
|
|
|
|
|
|
|
|
|
|
|
|
[compute shader]
|
|
|
|
RWBuffer<uint> u0;
|
|
|
|
RWBuffer<uint> u1;
|
|
|
|
|
|
|
|
[numthreads(4, 1, 1)]
|
|
|
|
void main(uint id : SV_GroupIndex)
|
|
|
|
{
|
|
|
|
u1[id] = WaveActiveBitXor(u0[id]);
|
|
|
|
}
|
|
|
|
|
|
|
|
[test]
|
2024-04-23 04:14:22 -07:00
|
|
|
dispatch 4 1 1
|
2024-04-15 21:30:12 -07:00
|
|
|
probe uav 1 (0) rui (5)
|
|
|
|
probe uav 1 (1) rui (5)
|
|
|
|
probe uav 1 (2) rui (5)
|
|
|
|
probe uav 1 (3) rui (5)
|
|
|
|
|
|
|
|
|
|
|
|
[compute shader]
|
|
|
|
uniform uint2 u;
|
|
|
|
|
|
|
|
RWBuffer<uint> u0;
|
|
|
|
RWBuffer<uint> u1;
|
|
|
|
|
|
|
|
[numthreads(4, 1, 1)]
|
|
|
|
void main(uint id : SV_GroupIndex)
|
|
|
|
{
|
|
|
|
uint table[] = {u.x, u.y};
|
|
|
|
uint i;
|
|
|
|
|
|
|
|
// Value depends on control flow.
|
|
|
|
if (id & 1)
|
|
|
|
i = table[id / 2u];
|
|
|
|
else
|
|
|
|
i = u0[id / 2u];
|
|
|
|
|
|
|
|
u1[id] = WaveActiveSum(i);
|
|
|
|
}
|
|
|
|
|
|
|
|
[test]
|
|
|
|
uniform 0 uint4 1 5 0 0
|
2024-04-23 04:35:27 -07:00
|
|
|
dispatch 4 1 1
|
2024-04-15 21:30:12 -07:00
|
|
|
probe uav 1 (0) rui (29)
|
|
|
|
probe uav 1 (1) rui (29)
|
|
|
|
probe uav 1 (2) rui (29)
|
|
|
|
probe uav 1 (3) rui (29)
|