2024-02-13 15:11:57 +10:00
|
|
|
[require]
|
2024-08-01 19:13:31 -04:00
|
|
|
format r32-sint uav-load
|
|
|
|
format r32-uint uav-load
|
2024-02-13 15:11:57 +10:00
|
|
|
|
|
|
|
[uav 1]
|
2024-08-01 21:03:46 -04:00
|
|
|
format r32-uint
|
2024-12-18 19:27:27 -05:00
|
|
|
size (buffer, 11)
|
2024-02-13 15:11:57 +10:00
|
|
|
|
2024-12-18 19:27:27 -05:00
|
|
|
0xd 5 6 0x10 4 4 7 2 0 5 0
|
2024-02-13 15:11:57 +10:00
|
|
|
|
2024-12-18 19:47:04 -05:00
|
|
|
[compute shader fail(sm<5)]
|
2024-02-13 15:11:57 +10:00
|
|
|
RWBuffer<uint> u : register(u1);
|
|
|
|
|
|
|
|
uniform uint4 v;
|
|
|
|
|
|
|
|
[numthreads(3, 1, 1)]
|
|
|
|
void main()
|
|
|
|
{
|
2024-03-04 15:23:27 +10:00
|
|
|
uint old;
|
2024-02-13 15:11:57 +10:00
|
|
|
InterlockedAnd(u[0], v.x);
|
|
|
|
InterlockedCompareStore(u[1], v.y, v.x);
|
|
|
|
InterlockedAdd(u[2], v.x);
|
|
|
|
InterlockedOr(u[3], v.x);
|
|
|
|
InterlockedMax(u[4], v.x);
|
|
|
|
InterlockedMin(u[5], v.x);
|
|
|
|
InterlockedXor(u[6], v.x);
|
2024-03-04 15:23:27 +10:00
|
|
|
InterlockedExchange(u[7], v.x, old);
|
|
|
|
InterlockedAdd(u[8], old == 2);
|
2024-12-18 19:27:27 -05:00
|
|
|
InterlockedCompareExchange(u[9], v.y, v.x, old);
|
|
|
|
InterlockedAdd(u[10], old == 5);
|
2024-02-13 15:11:57 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
[test]
|
|
|
|
uniform 0 uint4 3 5 0 0
|
2024-12-18 19:47:04 -05:00
|
|
|
todo(glsl | msl) dispatch 1 1 1
|
2024-02-13 15:11:57 +10:00
|
|
|
probe uav 1 (0) rui (1)
|
|
|
|
probe uav 1 (1) rui (3)
|
|
|
|
probe uav 1 (2) rui (15)
|
|
|
|
probe uav 1 (3) rui (0x13)
|
|
|
|
probe uav 1 (4) rui (4)
|
|
|
|
probe uav 1 (5) rui (3)
|
|
|
|
probe uav 1 (6) rui (4)
|
2024-03-04 15:23:27 +10:00
|
|
|
probe uav 1 (7) rui (3)
|
|
|
|
probe uav 1 (8) rui (1)
|
2024-12-18 19:27:27 -05:00
|
|
|
probe uav 1 (9) rui (3)
|
|
|
|
probe uav 1 (10) rui (1)
|
2024-02-13 15:11:57 +10:00
|
|
|
|
|
|
|
uniform 0 uint4 1 2 0 0
|
2024-12-18 19:47:04 -05:00
|
|
|
todo(glsl | msl) dispatch 2 1 1
|
2024-02-13 15:11:57 +10:00
|
|
|
probe uav 1 (0) rui (1)
|
|
|
|
probe uav 1 (1) rui (3)
|
|
|
|
probe uav 1 (2) rui (21)
|
|
|
|
probe uav 1 (3) rui (0x13)
|
|
|
|
probe uav 1 (4) rui (4)
|
|
|
|
probe uav 1 (5) rui (1)
|
|
|
|
probe uav 1 (6) rui (4)
|
2024-03-04 15:23:27 +10:00
|
|
|
probe uav 1 (7) rui (1)
|
|
|
|
probe uav 1 (8) rui (1)
|
2024-12-18 19:27:27 -05:00
|
|
|
probe uav 1 (9) rui (3)
|
|
|
|
probe uav 1 (10) rui (1)
|
2024-02-13 15:11:57 +10:00
|
|
|
|
|
|
|
|
|
|
|
[uav 2]
|
2024-08-01 21:03:46 -04:00
|
|
|
format r32-sint
|
2024-02-13 15:11:57 +10:00
|
|
|
size (buffer, 2)
|
|
|
|
|
|
|
|
-3 1
|
|
|
|
|
2025-01-16 15:48:11 -05:00
|
|
|
[compute shader fail(sm<5)]
|
2024-02-13 15:11:57 +10:00
|
|
|
RWBuffer<int> u : register(u2);
|
|
|
|
|
|
|
|
uniform int4 i;
|
|
|
|
|
|
|
|
[numthreads(3, 1, 1)]
|
|
|
|
void main()
|
|
|
|
{
|
|
|
|
InterlockedMax(u[0], i.x);
|
|
|
|
InterlockedMin(u[1], i.y);
|
|
|
|
}
|
|
|
|
|
|
|
|
[test]
|
|
|
|
uniform 0 int4 1 -3 0 0
|
2025-01-16 15:48:11 -05:00
|
|
|
todo(glsl | msl) dispatch 1 1 1
|
2024-02-13 15:11:57 +10:00
|
|
|
probe uav 2 (0) ri (1)
|
|
|
|
probe uav 2 (1) ri (-3)
|
|
|
|
|
|
|
|
uniform 0 int4 -3 1 0 0
|
2025-01-16 15:48:11 -05:00
|
|
|
todo(glsl | msl) dispatch 1 1 1
|
2024-02-13 15:11:57 +10:00
|
|
|
probe uav 2 (0) ri (1)
|
|
|
|
probe uav 2 (1) ri (-3)
|
2024-03-04 15:24:41 +10:00
|
|
|
|
|
|
|
|
|
|
|
[uav 1]
|
2024-08-01 21:03:46 -04:00
|
|
|
format r32-uint
|
2024-12-18 19:27:27 -05:00
|
|
|
size (2d, 11, 1)
|
2024-03-04 15:24:41 +10:00
|
|
|
|
2024-12-18 19:27:27 -05:00
|
|
|
0xd 5 6 0x10 4 4 7 2 0 5 0
|
2024-03-04 15:24:41 +10:00
|
|
|
|
2024-12-18 19:47:04 -05:00
|
|
|
[compute shader fail(sm<5)]
|
2024-03-04 15:24:41 +10:00
|
|
|
RWTexture2D<uint> u : register(u1);
|
|
|
|
|
|
|
|
uniform uint4 v;
|
|
|
|
|
|
|
|
[numthreads(3, 1, 1)]
|
|
|
|
void main()
|
|
|
|
{
|
|
|
|
uint old;
|
|
|
|
InterlockedAnd(u[uint2(0, 0)], v.x);
|
|
|
|
InterlockedCompareStore(u[uint2(1, 0)], v.y, v.x);
|
|
|
|
InterlockedAdd(u[uint2(2, 0)], v.x);
|
|
|
|
InterlockedOr(u[uint2(3, 0)], v.x);
|
|
|
|
InterlockedMax(u[uint2(4, 0)], v.x);
|
|
|
|
InterlockedMin(u[uint2(5, 0)], v.x);
|
|
|
|
InterlockedXor(u[uint2(6, 0)], v.x);
|
|
|
|
InterlockedExchange(u[uint2(7, 0)], v.x, old);
|
|
|
|
InterlockedAdd(u[uint2(8, 0)], old == 2);
|
2024-12-18 19:27:27 -05:00
|
|
|
InterlockedCompareExchange(u[uint2(9, 0)], v.y, v.x, old);
|
|
|
|
InterlockedAdd(u[uint2(10, 0)], old == 5);
|
2024-03-04 15:24:41 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
[test]
|
|
|
|
uniform 0 uint4 3 5 0 0
|
2024-12-18 19:47:04 -05:00
|
|
|
todo(glsl | msl) dispatch 1 1 1
|
2024-03-04 15:24:41 +10:00
|
|
|
probe uav 1 (0) rui (1)
|
|
|
|
probe uav 1 (1) rui (3)
|
|
|
|
probe uav 1 (2) rui (15)
|
|
|
|
probe uav 1 (3) rui (0x13)
|
|
|
|
probe uav 1 (4) rui (4)
|
|
|
|
probe uav 1 (5) rui (3)
|
|
|
|
probe uav 1 (6) rui (4)
|
|
|
|
probe uav 1 (7) rui (3)
|
|
|
|
probe uav 1 (8) rui (1)
|
2024-12-18 19:27:27 -05:00
|
|
|
probe uav 1 (9) rui (3)
|
|
|
|
probe uav 1 (10) rui (1)
|
2024-03-04 15:51:10 +10:00
|
|
|
|
|
|
|
|
2025-01-16 15:48:11 -05:00
|
|
|
[compute shader fail(sm<5)]
|
2024-03-04 15:51:10 +10:00
|
|
|
RWTexture2D<int> u : register(u2);
|
|
|
|
|
|
|
|
uniform int4 i;
|
|
|
|
|
|
|
|
[numthreads(3, 1, 1)]
|
|
|
|
void main()
|
|
|
|
{
|
|
|
|
InterlockedMax(u[uint2(0, 0)], i.x);
|
|
|
|
InterlockedMin(u[uint2(1, 0)], i.y);
|
|
|
|
}
|
|
|
|
|
|
|
|
[test]
|
|
|
|
uniform 0 int4 1 -3 0 0
|
2025-01-16 15:48:11 -05:00
|
|
|
% SPIR-V compilation currently fails because of the mismatched resource type for u2.
|
|
|
|
todo(mvk | vulkan | opengl | msl) dispatch 1 1 1
|
2024-03-04 15:51:10 +10:00
|
|
|
probe uav 2 (0) ri (1)
|
|
|
|
probe uav 2 (1) ri (-3)
|
|
|
|
|
|
|
|
uniform 0 int4 -3 1 0 0
|
2025-01-16 15:48:11 -05:00
|
|
|
todo(mvk | vulkan | opengl | msl) dispatch 1 1 1
|
2024-03-04 15:51:10 +10:00
|
|
|
probe uav 2 (0) ri (1)
|
|
|
|
probe uav 2 (1) ri (-3)
|
2024-12-20 16:10:17 -05:00
|
|
|
|
|
|
|
|
|
|
|
[uav 1]
|
|
|
|
format r32-uint
|
|
|
|
size (buffer, 3)
|
|
|
|
|
|
|
|
1 1 1
|
|
|
|
|
|
|
|
[uav 2]
|
|
|
|
format r32-sint
|
|
|
|
size (buffer, 3)
|
|
|
|
|
|
|
|
1 1 1
|
|
|
|
|
|
|
|
% The value fields of InterlockedMax/Min have the same type as the underlying scalar type of dst.
|
2024-12-20 15:38:51 -05:00
|
|
|
% However, floating point numbers are always converted to signed integers.
|
2024-12-20 16:10:17 -05:00
|
|
|
|
2025-01-16 15:48:11 -05:00
|
|
|
[compute shader fail(sm<5)]
|
2024-12-20 16:10:17 -05:00
|
|
|
RWBuffer<uint> u : register(u1);
|
|
|
|
RWBuffer<int> s : register(u2);
|
|
|
|
|
2024-12-20 15:38:51 -05:00
|
|
|
uniform uint i;
|
|
|
|
uniform float a;
|
|
|
|
|
2024-12-20 16:10:17 -05:00
|
|
|
[numthreads(3, 1, 1)]
|
|
|
|
void main()
|
|
|
|
{
|
|
|
|
InterlockedMax(u[0], i);
|
|
|
|
InterlockedMin(u[1], i);
|
2024-12-20 15:38:51 -05:00
|
|
|
InterlockedMax(u[2], a);
|
2024-12-20 16:10:17 -05:00
|
|
|
|
|
|
|
InterlockedMax(s[0], i);
|
|
|
|
InterlockedMin(s[1], i);
|
2024-12-20 15:38:51 -05:00
|
|
|
InterlockedMax(s[2], a);
|
2024-12-20 16:10:17 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
[test]
|
2024-12-20 15:38:51 -05:00
|
|
|
uniform 0 uint 0xffffffff
|
|
|
|
uniform 1 float 0x80000000
|
2025-01-16 15:48:11 -05:00
|
|
|
todo(glsl | msl) dispatch 1 1 1
|
2024-12-20 16:10:17 -05:00
|
|
|
probe uav 1 (0) rui (0xffffffff)
|
|
|
|
probe uav 1 (1) rui (1)
|
2024-12-20 15:38:51 -05:00
|
|
|
probe uav 1 (2) rui (0x7fffffff)
|
2024-12-20 16:10:17 -05:00
|
|
|
probe uav 2 (0) ri (1)
|
|
|
|
probe uav 2 (1) ri (-1)
|
2024-12-20 15:38:51 -05:00
|
|
|
probe uav 2 (2) rui (0x7fffffff)
|
2024-12-20 16:10:17 -05:00
|
|
|
|
|
|
|
[uav 1]
|
|
|
|
format r32-uint
|
|
|
|
size (buffer, 5)
|
|
|
|
|
|
|
|
0 0 0xffffffff 0 0xffffffff
|
|
|
|
|
|
|
|
[uav 2]
|
|
|
|
format r32-sint
|
|
|
|
size (buffer, 5)
|
|
|
|
|
|
|
|
0 0 -1 0 -1
|
|
|
|
|
|
|
|
% The value fields of other Interlocked functions are always uint.
|
|
|
|
|
2025-01-16 16:16:42 -05:00
|
|
|
[compute shader fail(sm<5)]
|
2024-12-20 16:10:17 -05:00
|
|
|
RWBuffer<uint> u : register(u1);
|
|
|
|
RWBuffer<int> s : register(u2);
|
|
|
|
|
2024-12-20 15:38:51 -05:00
|
|
|
uniform uint i;
|
|
|
|
uniform float a;
|
|
|
|
|
2024-12-20 16:10:17 -05:00
|
|
|
[numthreads(3, 1, 1)]
|
|
|
|
void main()
|
|
|
|
{
|
|
|
|
uint old;
|
|
|
|
|
|
|
|
InterlockedAdd(u[0], i);
|
|
|
|
InterlockedAdd(u[1], a);
|
|
|
|
InterlockedAnd(u[2], a);
|
|
|
|
InterlockedExchange(u[3], i, old);
|
|
|
|
InterlockedCompareStore(u[4], a, 0);
|
|
|
|
|
|
|
|
InterlockedAdd(s[0], i);
|
|
|
|
InterlockedAdd(s[1], a);
|
|
|
|
InterlockedAnd(s[2], a);
|
|
|
|
InterlockedExchange(s[3], i, old);
|
|
|
|
InterlockedCompareStore(s[4], a, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
[test]
|
2024-12-20 15:38:51 -05:00
|
|
|
uniform 0 uint 0xffffffff
|
|
|
|
uniform 1 float -1
|
2025-01-16 16:16:42 -05:00
|
|
|
todo(glsl | msl) dispatch 1 1 1
|
2024-12-20 16:10:17 -05:00
|
|
|
if(sm<6) probe uav 1 (0) rui (0xffffffff)
|
|
|
|
if(sm>=6) probe uav 1 (0) rui (0xfffffffd)
|
2024-12-20 15:38:51 -05:00
|
|
|
probe uav 1 (1) rui (0)
|
|
|
|
probe uav 1 (2) rui (0)
|
2024-12-20 16:10:17 -05:00
|
|
|
probe uav 1 (3) rui (0xffffffff)
|
2024-12-20 15:38:51 -05:00
|
|
|
probe uav 1 (4) rui (0xffffffff)
|
2024-12-20 16:10:17 -05:00
|
|
|
if(sm<6) probe uav 2 (0) ri (-1)
|
|
|
|
if(sm>=6) probe uav 2 (0) rui (0xfffffffd)
|
2024-12-20 15:38:51 -05:00
|
|
|
probe uav 2 (1) ri (0)
|
|
|
|
probe uav 2 (2) ri (0)
|
2024-12-20 16:10:17 -05:00
|
|
|
probe uav 2 (3) ri (-1)
|
2024-12-20 15:38:51 -05:00
|
|
|
probe uav 2 (4) ri (-1)
|
2025-01-07 16:19:37 -05:00
|
|
|
|
|
|
|
|
|
|
|
% Interlocked* functions return void.
|
|
|
|
|
|
|
|
[compute shader fail]
|
|
|
|
RWBuffer<uint> u : register(u1);
|
|
|
|
|
|
|
|
[numthreads(3, 1, 1)]
|
|
|
|
void main()
|
|
|
|
{
|
|
|
|
uint err = InterlockedAdd(u[0], 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
[compute shader fail]
|
|
|
|
RWBuffer<uint> u : register(u1);
|
|
|
|
|
|
|
|
[numthreads(3, 1, 1)]
|
|
|
|
void main()
|
|
|
|
{
|
|
|
|
uint old;
|
|
|
|
uint err = InterlockedAdd(u[0], 1, old);
|
|
|
|
}
|
|
|
|
|
|
|
|
[compute shader fail]
|
|
|
|
RWBuffer<uint> u : register(u1);
|
|
|
|
|
|
|
|
[numthreads(3, 1, 1)]
|
|
|
|
void main()
|
|
|
|
{
|
|
|
|
uint err = InterlockedCompareStore(u[0], 0, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
[compute shader fail]
|
|
|
|
RWBuffer<uint> u : register(u1);
|
|
|
|
|
|
|
|
[numthreads(3, 1, 1)]
|
|
|
|
void main()
|
|
|
|
{
|
|
|
|
uint old;
|
|
|
|
uint err = InterlockedCompareExchange(u[0], 0, 1, old);
|
|
|
|
}
|
2024-12-20 15:38:51 -05:00
|
|
|
|
|
|
|
|
|
|
|
% The underlying type of the destination parameter must be a scalar integer.
|
|
|
|
|
|
|
|
[compute shader fail]
|
|
|
|
RWBuffer<uint1> u : register(u1);
|
|
|
|
|
|
|
|
[numthreads(3, 1, 1)]
|
|
|
|
void main()
|
|
|
|
{
|
|
|
|
InterlockedAdd(u[0], 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
[compute shader fail]
|
|
|
|
RWBuffer<int1> u : register(u1);
|
|
|
|
|
|
|
|
[numthreads(3, 1, 1)]
|
|
|
|
void main()
|
|
|
|
{
|
|
|
|
InterlockedAdd(u[0], 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
[compute shader fail]
|
|
|
|
RWBuffer<float> u : register(u1);
|
|
|
|
|
|
|
|
[numthreads(3, 1, 1)]
|
|
|
|
void main()
|
|
|
|
{
|
|
|
|
InterlockedAdd(u[0], 1);
|
|
|
|
}
|