tests/hlsl: Add tests for valid destination types of atomic operations.

This commit is contained in:
Shaun Ren 2024-12-20 15:38:51 -05:00 committed by Henri Verbeet
parent b3c13b443f
commit 5f943e9110
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

@ -171,35 +171,37 @@ size (buffer, 3)
1 1 1
% The value fields of InterlockedMax/Min have the same type as the underlying scalar type of dst.
% However, floating point numbers are always converted to signed integers.
[compute shader fail(sm<5) todo(sm>=5)]
RWBuffer<uint> u : register(u1);
RWBuffer<int> s : register(u2);
uniform uint i;
uniform float a;
[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(u[2], a);
InterlockedMax(s[0], i);
InterlockedMin(s[1], i);
InterlockedMin(s[2], a);
InterlockedMax(s[2], a);
}
[test]
uniform 0 uint 0xffffffff
uniform 1 float 0x80000000
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 1 (2) rui (0x7fffffff)
probe uav 2 (0) ri (1)
probe uav 2 (1) ri (-1)
if(sm<6) probe uav 2 (2) ri (-1)
probe uav 2 (2) rui (0x7fffffff)
[uav 1]
format r32-uint
@ -219,11 +221,12 @@ size (buffer, 5)
RWBuffer<uint> u : register(u1);
RWBuffer<int> s : register(u2);
uniform uint i;
uniform float a;
[numthreads(3, 1, 1)]
void main()
{
uint i = 0xffffffff;
float a = -1.0;
uint old;
InterlockedAdd(u[0], i);
@ -240,20 +243,21 @@ void main()
}
[test]
uniform 0 uint 0xffffffff
uniform 1 float -1
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 (1) rui (0)
probe uav 1 (2) rui (0)
probe uav 1 (3) rui (0xffffffff)
if(sm<6) probe uav 1 (4) rui (0xffffffff)
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 (1) ri (0)
probe uav 2 (2) ri (0)
probe uav 2 (3) ri (-1)
if(sm<6) probe uav 2 (4) ri (-1)
probe uav 2 (4) ri (-1)
% Interlocked* functions return void.
@ -295,3 +299,33 @@ void main()
uint old;
uint err = InterlockedCompareExchange(u[0], 0, 1, old);
}
% 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);
}