tests/hlsl: Split the test for countbits()/firstbithigh()/firstbitlow().

And add some more.
This commit is contained in:
Petrichor Park
2024-07-29 14:23:53 -05:00
committed by Henri Verbeet
parent 52b9aa416b
commit 16cb69a324
Notes: Henri Verbeet 2025-09-22 11:46:20 +02:00
Approved-by: Francisco Casas (@fcasas)
Approved-by: Elizabeth Figura (@zfigura)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/965

View File

@@ -1,3 +1,42 @@
[pixel shader todo]
uint4 u;
float4 main() : sv_target
{
return countbits(u);
}
[test]
uniform 0 uint4 0 0xffffffff 0xcccccccc 0x31415926
todo(sm<6 | msl & sm>=6) draw quad
if(sm>=4) probe (0, 0) f32(0, 32, 16, 12)
if(sm<4) probe (0, 0) f32(0, 0, 0, 0)
[pixel shader todo]
float4 main(float4 pos : sv_position) : sv_target
{
uint4x4 umat =
{
1, 2, 3, 4,
5, 6, 7, 8,
9, 10, 11, 12,
13, 14, 15, 16,
};
uint4x4 bitscounted = countbits(umat);
return bitscounted[int(pos.x)];
}
[test]
todo(sm<6 | msl & sm>=6) draw quad
if(sm>=4) probe(0, 0) f32(1, 1, 2, 1)
if(sm>=4) probe(1, 0) f32(2, 2, 3, 1)
if(sm>=4) probe(2, 0) f32(2, 2, 3, 2)
if(sm>=4) probe(3, 0) f32(3, 3, 4, 1)
if(sm<4) probe(0, 0) f32(0, 0, 0, 0)
if(sm<4) probe(1, 0) f32(0, 0, 0, 0)
if(sm<4) probe(2, 0) f32(0, 0, 0, 0)
if(sm<4) probe(3, 0) f32(0, 0, 0, 0)
[require]
shader model >= 4.0
@@ -216,24 +255,88 @@ format r32g32b32a32-uint
size (2d, 640, 480)
[pixel shader todo]
uint u;
int i;
uint4 u;
uint4 main() : sv_target
{
return uint4(countbits(u), firstbitlow(u), firstbithigh(u), firstbithigh(i));
return firstbitlow(u);
}
[test]
uniform 0 uint4 0 0 0 0
uniform 0 uint4 0 0xffffffff 0x00001000 0x00760400
todo(sm<6 | msl & sm>=6) draw quad
probe (0, 0) u32(0, 0xffffffff, 0xffffffff, 0xffffffff)
uniform 0 uint4 0xffffffff 0xffffffff 0 0
probe (0, 0) u32(0xffffffff, 0, 12, 10)
[pixel shader todo]
uint4 main(float4 pos : sv_position) : sv_target
{
uint4x4 umat =
{
1, 2, 3, 4,
5, 6, 7, 8,
9, 10, 11, 12,
13, 14, 15, 16,
};
uint4x4 lobits = firstbitlow(umat);
return lobits[int(pos.x)];
}
[test]
todo(sm<6 | msl & sm>=6) draw quad
probe (0, 0) u32(32, 0, 31, 0xffffffff)
uniform 0 uint4 0xcccccccc 0xcccccccc 0 0
probe(0, 0) u32(0, 1, 0, 2)
probe(1, 0) u32(0, 1, 0, 3)
probe(2, 0) u32(0, 1, 0, 2)
probe(3, 0) u32(0, 1, 0, 4)
[pixel shader todo]
uint4 u;
uint4 main() : sv_target
{
return firstbithigh(u);
}
[test]
uniform 0 uint4 0 0xffffffff 0x00001000 0x00760400
todo(sm<6 | msl & sm>=6) draw quad
probe (0, 0) u32(16, 2, 31, 29)
probe (0, 0) u32(0xffffffff, 31, 12, 22)
[pixel shader todo]
int4 i;
uint4 main() : sv_target
{
return firstbithigh(i);
}
[test]
uniform 0 uint4 0 0xffffffff 0x00001db4 0xff900000
todo(sm<6 | msl & sm>=6) draw quad
probe (0, 0) i32(-1, -1, 12, 22)
uniform 0 int4 -500 -400 -300 -7604
todo(sm<6 | msl & sm>=6) draw quad
probe (0, 0) i32(8, 8, 8, 12)
[pixel shader todo]
uint4 main(float4 pos : sv_position) : sv_target
{
uint4x4 umat =
{
1, 2, 3, 4,
5, 6, 7, 8,
9, 10, 11, 12,
13, 14, 15, 16,
};
uint4x4 hibits = firstbithigh(umat);
return hibits[int(pos.x)];
}
[test]
todo(sm<6 | msl & sm>=6) draw quad
probe(0, 0) u32(0, 1, 1, 2)
probe(1, 0) u32(2, 2, 2, 3)
probe(2, 0) u32(3, 3, 3, 3)
probe(3, 0) u32(3, 3, 3, 4)
[rtv 0]
format r32g32b32a32-float