tests/hlsl: Add tests to check the types of the value arguments of atomic ops.

This commit is contained in:
Shaun Ren 2024-12-20 16:10:17 -05:00 committed by Henri Verbeet
parent c8b87f9bd9
commit 728cf1dcfe
Notes: Henri Verbeet 2025-01-20 16:18:51 +01:00
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Elizabeth Figura (@zfigura)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1330

View File

@ -156,3 +156,101 @@ uniform 0 int4 -3 1 0 0
todo(sm<6) dispatch 1 1 1
probe uav 2 (0) ri (1)
probe uav 2 (1) ri (-3)
[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.
[compute shader fail(sm<5) todo(sm>=5)]
RWBuffer<uint> u : register(u1);
RWBuffer<int> s : register(u2);
[numthreads(3, 1, 1)]
void main()
{
uint i = 0xffffffff;
float a = -1.0;
InterlockedMax(u[0], i);
InterlockedMin(u[1], i);
InterlockedMin(u[2], a);
InterlockedMax(s[0], i);
InterlockedMin(s[1], i);
InterlockedMin(s[2], a);
}
[test]
todo(sm<6) dispatch 1 1 1
probe uav 1 (0) rui (0xffffffff)
probe uav 1 (1) rui (1)
% SM6 emits i32 undef for the value float a = -1.0.
if(sm<6) probe uav 1 (2) rui (0)
probe uav 2 (0) ri (1)
probe uav 2 (1) ri (-1)
if(sm<6) probe uav 2 (2) ri (-1)
[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.
[compute shader fail(sm<5) todo(sm>=5)]
RWBuffer<uint> u : register(u1);
RWBuffer<int> s : register(u2);
[numthreads(3, 1, 1)]
void main()
{
uint i = 0xffffffff;
float a = -1.0;
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]
todo(sm<6) dispatch 1 1 1
if(sm<6) probe uav 1 (0) rui (0xffffffff)
if(sm>=6) probe uav 1 (0) rui (0xfffffffd)
% SM6 emits i32 undef for the value float a = -1.0.
if(sm<6) probe uav 1 (1) rui (0)
if(sm<6) probe uav 1 (2) rui (0)
probe uav 1 (3) rui (0xffffffff)
if(sm<6) probe uav 1 (4) rui (0xffffffff)
if(sm<6) probe uav 2 (0) ri (-1)
if(sm>=6) probe uav 2 (0) rui (0xfffffffd)
if(sm<6) probe uav 2 (1) ri (0)
if(sm<6) probe uav 2 (2) ri (0)
probe uav 2 (3) ri (-1)
if(sm<6) probe uav 2 (4) ri (-1)