tests: Split hlsl-operations into individual test units.

Partly to make the tests easier to navigate, and partly to allow marking some
tests as SM4+.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2022-03-07 19:55:40 -06:00 committed by Alexandre Julliard
parent b64482e7c7
commit e9ff88469e
7 changed files with 372 additions and 369 deletions

View File

@ -52,6 +52,10 @@ vkd3d_cross_tests = \
vkd3d_shader_tests = \ vkd3d_shader_tests = \
tests/abs.shader_test \ tests/abs.shader_test \
tests/arithmetic-float.shader_test \
tests/arithmetic-int.shader_test \
tests/arithmetic-uint.shader_test \
tests/bitwise.shader_test \
tests/cast-to-float.shader_test \ tests/cast-to-float.shader_test \
tests/cast-to-half.shader_test \ tests/cast-to-half.shader_test \
tests/cast-to-int.shader_test \ tests/cast-to-int.shader_test \
@ -85,7 +89,6 @@ vkd3d_shader_tests = \
tests/hlsl-nested-arrays.shader_test \ tests/hlsl-nested-arrays.shader_test \
tests/hlsl-numeric-constructor-truncation.shader_test \ tests/hlsl-numeric-constructor-truncation.shader_test \
tests/hlsl-numeric-types.shader_test \ tests/hlsl-numeric-types.shader_test \
tests/hlsl-operations.shader_test \
tests/hlsl-return-implicit-conversion.shader_test \ tests/hlsl-return-implicit-conversion.shader_test \
tests/hlsl-return-void.shader_test \ tests/hlsl-return-void.shader_test \
tests/hlsl-shape.shader_test \ tests/hlsl-shape.shader_test \
@ -97,6 +100,7 @@ vkd3d_shader_tests = \
tests/hlsl-struct-semantics.shader_test \ tests/hlsl-struct-semantics.shader_test \
tests/hlsl-vector-indexing.shader_test \ tests/hlsl-vector-indexing.shader_test \
tests/hlsl-vector-indexing-uniform.shader_test \ tests/hlsl-vector-indexing-uniform.shader_test \
tests/logic-operations.shader_test \
tests/math.shader_test \ tests/math.shader_test \
tests/pow.shader_test \ tests/pow.shader_test \
tests/preproc-if.shader_test \ tests/preproc-if.shader_test \
@ -309,6 +313,10 @@ tests_vkd3d_api_LDADD = libvkd3d.la @VULKAN_LIBS@
tests_vkd3d_shader_api_LDADD = libvkd3d-shader.la tests_vkd3d_shader_api_LDADD = libvkd3d-shader.la
SHADER_TEST_LOG_COMPILER = tests/shader_runner SHADER_TEST_LOG_COMPILER = tests/shader_runner
XFAIL_TESTS = \ XFAIL_TESTS = \
tests/arithmetic-float.shader_test \
tests/arithmetic-int.shader_test \
tests/arithmetic-uint.shader_test \
tests/bitwise.shader_test \
tests/cast-to-float.shader_test \ tests/cast-to-float.shader_test \
tests/cast-to-half.shader_test \ tests/cast-to-half.shader_test \
tests/cast-to-int.shader_test \ tests/cast-to-int.shader_test \
@ -334,7 +342,6 @@ XFAIL_TESTS = \
tests/hlsl-nested-arrays.shader_test \ tests/hlsl-nested-arrays.shader_test \
tests/hlsl-numeric-constructor-truncation.shader_test \ tests/hlsl-numeric-constructor-truncation.shader_test \
tests/hlsl-numeric-types.shader_test \ tests/hlsl-numeric-types.shader_test \
tests/hlsl-operations.shader_test \
tests/hlsl-return-implicit-conversion.shader_test \ tests/hlsl-return-implicit-conversion.shader_test \
tests/hlsl-return-void.shader_test \ tests/hlsl-return-void.shader_test \
tests/hlsl-shape.shader_test \ tests/hlsl-shape.shader_test \
@ -342,6 +349,7 @@ XFAIL_TESTS = \
tests/hlsl-storage-qualifiers.shader_test \ tests/hlsl-storage-qualifiers.shader_test \
tests/hlsl-vector-indexing.shader_test \ tests/hlsl-vector-indexing.shader_test \
tests/hlsl-vector-indexing-uniform.shader_test \ tests/hlsl-vector-indexing-uniform.shader_test \
tests/logic-operations.shader_test \
tests/max.shader_test \ tests/max.shader_test \
tests/sampler-offset.shader_test \ tests/sampler-offset.shader_test \
tests/trigonometry.shader_test tests/trigonometry.shader_test

View File

@ -0,0 +1,25 @@
[pixel shader]
float4 main() : SV_TARGET
{
float x = 5.0;
float y = 15.0;
return float4(x + y, x - y, x * y, x / y);
}
[test]
draw quad
probe all rgba (20.0, -10.0, 75.0, 0.33333333)
[pixel shader]
float4 main() : SV_TARGET
{
float x = 5.0;
float y = 15.0;
return float4(x % y, +x, -x, y / x);
}
[test]
draw quad
probe all rgba (5.0, 5.0, -5.0, 3.0)

View File

@ -0,0 +1,25 @@
[pixel shader]
float4 main() : SV_TARGET
{
int x = 5;
int y = 15;
return float4(x + y, x - y, x * y, x / y);
}
[test]
draw quad
probe all rgba (20.0, -10.0, 75.0, 0.0)
[pixel shader]
float4 main() : SV_TARGET
{
int x = 5;
int y = 15;
return float4(x % y, +x, -x, y / x);
}
[test]
draw quad
probe all rgba (5.0, 5.0, -5.0, 3.0)

View File

@ -0,0 +1,25 @@
[pixel shader]
float4 main() : SV_TARGET
{
uint x = 5;
uint y = 15;
return float4(x + y, x - y, x * y, x / y);
}
[test]
draw quad
probe all rgba (20.0, 4294967296.0, 75.0, 0.0)
[pixel shader]
float4 main() : SV_TARGET
{
uint x = 5;
uint y = 15;
return float4(x % y, +x, -x, y / x);
}
[test]
draw quad
probe all rgba (5.0, 5.0, 4294967296.0, 3.0)

129
tests/bitwise.shader_test Normal file
View File

@ -0,0 +1,129 @@
[pixel shader]
float4 main() : SV_TARGET
{
int x = 5;
int y = 15;
return float4(x >> y, y >> x, x << y, y << x);
}
[test]
draw quad
probe all rgba (0.0, 0.0, 163840.0, 480.0)
[pixel shader]
float4 main() : SV_TARGET
{
int x = 5;
int y = 15;
return float4(x & y, x | y, x ^ y, ~x);
}
[test]
draw quad
probe all rgba (5.0, 15.0, 10.0, -6.0)
[pixel shader]
float4 main() : SV_TARGET
{
int zero = 0;
int one = 1;
return float4(zero & zero, zero & one, one & zero, one & one);
}
[test]
draw quad
probe all rgba (0.0, 0.0, 0.0, 1.0)
[pixel shader]
float4 main() : SV_TARGET
{
int zero = 0;
int one = 1;
return float4(zero | zero, zero | one, one | zero, one | one);
}
[test]
draw quad
probe all rgba (0.0, 1.0, 1.0, 1.0)
[pixel shader]
float4 main() : SV_TARGET
{
int zero = 0;
int one = 1;
return float4(zero ^ zero, zero ^ one, one ^ zero, one ^ one);
}
[test]
draw quad
probe all rgba (0.0, 1.0, 1.0, 0.0)
[pixel shader]
float4 main() : SV_TARGET
{
uint x = 5;
uint y = 15;
return float4(x >> y, y >> x, x << y, y << x);
}
[test]
draw quad
probe all rgba (0.0, 0.0, 163840.0, 480.0)
[pixel shader]
float4 main() : SV_TARGET
{
uint x = 5;
uint y = 15;
return float4(x & y, x | y, x ^ y, ~x);
}
[test]
draw quad
probe all rgba (5.0, 15.0, 10.0, 4294967296.0)
[pixel shader]
float4 main() : SV_TARGET
{
uint zero = 0;
uint one = 1;
return float4(zero & zero, zero & one, one & zero, one & one);
}
[test]
draw quad
probe all rgba (0.0, 0.0, 0.0, 1.0)
[pixel shader]
float4 main() : SV_TARGET
{
uint zero = 0;
uint one = 1;
return float4(zero | zero, zero | one, one | zero, one | one);
}
[test]
draw quad
probe all rgba (0.0, 1.0, 1.0, 1.0)
[pixel shader]
float4 main() : SV_TARGET
{
uint zero = 0;
uint one = 1;
return float4(zero ^ zero, zero ^ one, one ^ zero, one ^ one);
}
[test]
draw quad
probe all rgba (0.0, 1.0, 1.0, 0.0)

View File

@ -1,367 +0,0 @@
[pixel shader]
float4 main() : SV_TARGET
{
float x = 5.0;
float y = 15.0;
return float4(x + y, x - y, x * y, x / y);
}
[test]
draw quad
probe all rgba (20.0, -10.0, 75.0, 0.33333333)
[pixel shader]
float4 main() : SV_TARGET
{
float x = 5.0;
float y = 15.0;
return float4(x % y, +x, -x, y / x);
}
[test]
draw quad
probe all rgba (5.0, 5.0, -5.0, 3.0)
[pixel shader]
float4 main() : SV_TARGET
{
float x = 5.0;
float y = 15.0;
return float4(x == y, x != y, x < y, x <= y);
}
[test]
draw quad
probe all rgba (0.0, 1.0, 1.0, 1.0)
[pixel shader]
float4 main() : SV_TARGET
{
float x = 5.0;
float y = 15.0;
float zero = 0.0;
return float4(x > y, x >= y, !x, !zero);
}
[test]
draw quad
probe all rgba (0.0, 0.0, 0.0, 1.0)
[pixel shader]
float4 main() : SV_TARGET
{
float zero = 0.0;
float one = 1.0;
return float4(zero && zero, zero && one, one && zero, one && one);
}
[test]
draw quad
probe all rgba (0.0, 0.0, 0.0, 1.0)
[pixel shader]
float4 main() : SV_TARGET
{
float zero = 0.0;
float one = 1.0;
return float4(zero || zero, zero || one, one || zero, one || one);
}
[test]
draw quad
probe all rgba (0.0, 1.0, 1.0, 1.0)
[pixel shader]
float4 main() : SV_TARGET
{
int x = 5;
int y = 15;
return float4(x + y, x - y, x * y, x / y);
}
[test]
draw quad
probe all rgba (20.0, -10.0, 75.0, 0.0)
[pixel shader]
float4 main() : SV_TARGET
{
int x = 5;
int y = 15;
return float4(x % y, +x, -x, y / x);
}
[test]
draw quad
probe all rgba (5.0, 5.0, -5.0, 3.0)
[pixel shader]
float4 main() : SV_TARGET
{
int x = 5;
int y = 15;
return float4(x == y, x != y, x < y, x <= y);
}
[test]
draw quad
probe all rgba (0.0, 1.0, 1.0, 1.0)
[pixel shader]
float4 main() : SV_TARGET
{
int x = 5;
int y = 15;
int zero = 0;
return float4(x > y, x >= y, !x, !zero);
}
[test]
draw quad
probe all rgba (0.0, 0.0, 0.0, 1.0)
[pixel shader]
float4 main() : SV_TARGET
{
int x = 5;
int y = 15;
return float4(x >> y, y >> x, x << y, y << x);
}
[test]
draw quad
probe all rgba (0.0, 0.0, 163840.0, 480.0)
[pixel shader]
float4 main() : SV_TARGET
{
int x = 5;
int y = 15;
return float4(x & y, x | y, x ^ y, ~x);
}
[test]
draw quad
probe all rgba (5.0, 15.0, 10.0, -6.0)
[pixel shader]
float4 main() : SV_TARGET
{
int zero = 0;
int one = 1;
return float4(zero && zero, zero && one, one && zero, one && one);
}
[test]
draw quad
probe all rgba (0.0, 0.0, 0.0, 1.0)
[pixel shader]
float4 main() : SV_TARGET
{
int zero = 0;
int one = 1;
return float4(zero || zero, zero || one, one || zero, one || one);
}
[test]
draw quad
probe all rgba (0.0, 1.0, 1.0, 1.0)
[pixel shader]
float4 main() : SV_TARGET
{
int zero = 0;
int one = 1;
return float4(zero & zero, zero & one, one & zero, one & one);
}
[test]
draw quad
probe all rgba (0.0, 0.0, 0.0, 1.0)
[pixel shader]
float4 main() : SV_TARGET
{
int zero = 0;
int one = 1;
return float4(zero | zero, zero | one, one | zero, one | one);
}
[test]
draw quad
probe all rgba (0.0, 1.0, 1.0, 1.0)
[pixel shader]
float4 main() : SV_TARGET
{
int zero = 0;
int one = 1;
return float4(zero ^ zero, zero ^ one, one ^ zero, one ^ one);
}
[test]
draw quad
probe all rgba (0.0, 1.0, 1.0, 0.0)
[pixel shader]
float4 main() : SV_TARGET
{
uint x = 5;
uint y = 15;
return float4(x + y, x - y, x * y, x / y);
}
[test]
draw quad
probe all rgba (20.0, 4294967296.0, 75.0, 0.0)
[pixel shader]
float4 main() : SV_TARGET
{
uint x = 5;
uint y = 15;
return float4(x % y, +x, -x, y / x);
}
[test]
draw quad
probe all rgba (5.0, 5.0, 4294967296.0, 3.0)
[pixel shader]
float4 main() : SV_TARGET
{
uint x = 5;
uint y = 15;
return float4(x == y, x != y, x < y, x <= y);
}
[test]
draw quad
probe all rgba (0.0, 1.0, 1.0, 1.0)
[pixel shader]
float4 main() : SV_TARGET
{
uint x = 5;
uint y = 15;
uint zero = 0;
return float4(x > y, x >= y, !x, !zero);
}
[test]
draw quad
probe all rgba (0.0, 0.0, 0.0, 1.0)
[pixel shader]
float4 main() : SV_TARGET
{
uint x = 5;
uint y = 15;
return float4(x >> y, y >> x, x << y, y << x);
}
[test]
draw quad
probe all rgba (0.0, 0.0, 163840.0, 480.0)
[pixel shader]
float4 main() : SV_TARGET
{
uint x = 5;
uint y = 15;
return float4(x & y, x | y, x ^ y, ~x);
}
[test]
draw quad
probe all rgba (5.0, 15.0, 10.0, 4294967296.0)
[pixel shader]
float4 main() : SV_TARGET
{
uint zero = 0;
uint one = 1;
return float4(zero && zero, zero && one, one && zero, one && one);
}
[test]
draw quad
probe all rgba (0.0, 0.0, 0.0, 1.0)
[pixel shader]
float4 main() : SV_TARGET
{
uint zero = 0;
uint one = 1;
return float4(zero || zero, zero || one, one || zero, one || one);
}
[test]
draw quad
probe all rgba (0.0, 1.0, 1.0, 1.0)
[pixel shader]
float4 main() : SV_TARGET
{
uint zero = 0;
uint one = 1;
return float4(zero & zero, zero & one, one & zero, one & one);
}
[test]
draw quad
probe all rgba (0.0, 0.0, 0.0, 1.0)
[pixel shader]
float4 main() : SV_TARGET
{
uint zero = 0;
uint one = 1;
return float4(zero | zero, zero | one, one | zero, one | one);
}
[test]
draw quad
probe all rgba (0.0, 1.0, 1.0, 1.0)
[pixel shader]
float4 main() : SV_TARGET
{
uint zero = 0;
uint one = 1;
return float4(zero ^ zero, zero ^ one, one ^ zero, one ^ one);
}
[test]
draw quad
probe all rgba (0.0, 1.0, 1.0, 0.0)

View File

@ -0,0 +1,158 @@
[pixel shader]
float4 main() : SV_TARGET
{
float x = 5.0;
float y = 15.0;
return float4(x == y, x != y, x < y, x <= y);
}
[test]
draw quad
probe all rgba (0.0, 1.0, 1.0, 1.0)
[pixel shader]
float4 main() : SV_TARGET
{
float x = 5.0;
float y = 15.0;
float zero = 0.0;
return float4(x > y, x >= y, !x, !zero);
}
[test]
draw quad
probe all rgba (0.0, 0.0, 0.0, 1.0)
[pixel shader]
float4 main() : SV_TARGET
{
float zero = 0.0;
float one = 1.0;
return float4(zero && zero, zero && one, one && zero, one && one);
}
[test]
draw quad
probe all rgba (0.0, 0.0, 0.0, 1.0)
[pixel shader]
float4 main() : SV_TARGET
{
float zero = 0.0;
float one = 1.0;
return float4(zero || zero, zero || one, one || zero, one || one);
}
[test]
draw quad
probe all rgba (0.0, 1.0, 1.0, 1.0)
[pixel shader]
float4 main() : SV_TARGET
{
int x = 5;
int y = 15;
return float4(x == y, x != y, x < y, x <= y);
}
[test]
draw quad
probe all rgba (0.0, 1.0, 1.0, 1.0)
[pixel shader]
float4 main() : SV_TARGET
{
int x = 5;
int y = 15;
int zero = 0;
return float4(x > y, x >= y, !x, !zero);
}
[test]
draw quad
probe all rgba (0.0, 0.0, 0.0, 1.0)
[pixel shader]
float4 main() : SV_TARGET
{
int zero = 0;
int one = 1;
return float4(zero && zero, zero && one, one && zero, one && one);
}
[test]
draw quad
probe all rgba (0.0, 0.0, 0.0, 1.0)
[pixel shader]
float4 main() : SV_TARGET
{
int zero = 0;
int one = 1;
return float4(zero || zero, zero || one, one || zero, one || one);
}
[test]
draw quad
probe all rgba (0.0, 1.0, 1.0, 1.0)
[pixel shader]
float4 main() : SV_TARGET
{
uint x = 5;
uint y = 15;
return float4(x == y, x != y, x < y, x <= y);
}
[test]
draw quad
probe all rgba (0.0, 1.0, 1.0, 1.0)
[pixel shader]
float4 main() : SV_TARGET
{
uint x = 5;
uint y = 15;
uint zero = 0;
return float4(x > y, x >= y, !x, !zero);
}
[test]
draw quad
probe all rgba (0.0, 0.0, 0.0, 1.0)
[pixel shader]
float4 main() : SV_TARGET
{
uint zero = 0;
uint one = 1;
return float4(zero && zero, zero && one, one && zero, one && one);
}
[test]
draw quad
probe all rgba (0.0, 0.0, 0.0, 1.0)
[pixel shader]
float4 main() : SV_TARGET
{
uint zero = 0;
uint one = 1;
return float4(zero || zero, zero || one, one || zero, one || one);
}
[test]
draw quad
probe all rgba (0.0, 1.0, 1.0, 1.0)