This is a continuation to !406. With this MR all the tests pass on Windows. [The next step is to allow the CI to run crosstests on Windows](https://gitlab.winehq.org/giomasce/vkd3d/-/commits/ci3).
-- v2: tests: Skip processing resources according to [require] directives. tests: Do not test matrix majority on SM1-3. tests: Fix the usage of require directives. tests: Remove an irrelevant input from a test. tests: Do not test integral types for SM1-3. tests: Do not use global half values.
From: Giovanni Mascellani gmascellani@codeweavers.com
--- gitlab/build-crosstest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gitlab/build-crosstest b/gitlab/build-crosstest index 38eb3e110..4a1341a09 100755 --- a/gitlab/build-crosstest +++ b/gitlab/build-crosstest @@ -14,7 +14,7 @@ set -Eeuxo pipefail rm -fr build mkdir build cd build -../configure CROSSCC32="i686-w64-mingw32-gcc" CROSSCC64="x86_64-w64-mingw32-gcc" CFLAGS="-g -O2 -Wno-array-bounds -Werror" && \ +../configure CROSSCC64="x86_64-w64-mingw32-gcc -Wno-array-bounds -Werror" CROSSCC32="i686-w64-mingw32-gcc -Wno-array-bounds -Werror" && \ make -j$(nproc) crosstest || \ touch ../pipeline_failed
From: Giovanni Mascellani gmascellani@codeweavers.com
They are not allowed by the native compiler, except in compatibility mode. --- Makefile.am | 1 + tests/hlsl/asfloat.shader_test | 4 ++-- tests/hlsl/asuint.shader_test | 4 ++-- tests/hlsl/cast-to-float.shader_test | 4 ++-- tests/hlsl/cast-to-int.shader_test | 4 ++-- tests/hlsl/cast-to-uint.shader_test | 4 ++-- tests/hlsl/half.shader_test | 23 +++++++++++++++++++++++ 7 files changed, 34 insertions(+), 10 deletions(-) create mode 100644 tests/hlsl/half.shader_test
diff --git a/Makefile.am b/Makefile.am index 8364aaa37..2821ddc6f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -98,6 +98,7 @@ vkd3d_shader_tests = \ tests/hlsl/gather-offset.shader_test \ tests/hlsl/gather.shader_test \ tests/hlsl/getdimensions.shader_test \ + tests/hlsl/half.shader_test \ tests/hlsl/initializer-flatten.shader_test \ tests/hlsl/initializer-implicit-array.shader_test \ tests/hlsl/initializer-invalid-arg-count.shader_test \ diff --git a/tests/hlsl/asfloat.shader_test b/tests/hlsl/asfloat.shader_test index 00238164c..d2c0f9aab 100644 --- a/tests/hlsl/asfloat.shader_test +++ b/tests/hlsl/asfloat.shader_test @@ -5,7 +5,7 @@ shader model >= 4.0 uniform float f; uniform int i; uniform uint u; -uniform half h; +uniform float h;
float4 main() : sv_target { @@ -14,7 +14,7 @@ float4 main() : sv_target ret.x = asfloat(f); ret.y = asfloat(i); ret.z = asfloat(u); - ret.w = asfloat(h); + ret.w = asfloat((half)h); return ret; }
diff --git a/tests/hlsl/asuint.shader_test b/tests/hlsl/asuint.shader_test index 494229e7e..0a2e39e53 100644 --- a/tests/hlsl/asuint.shader_test +++ b/tests/hlsl/asuint.shader_test @@ -5,7 +5,7 @@ shader model >= 4.0 uniform float f; uniform int i; uniform uint u; -uniform half h; +uniform float h;
float4 main() : sv_target { @@ -14,7 +14,7 @@ float4 main() : sv_target ret.x = asuint(f); ret.y = asuint(i); ret.z = asuint(u); - ret.w = asuint(h); + ret.w = asuint((half)h); return ret; }
diff --git a/tests/hlsl/cast-to-float.shader_test b/tests/hlsl/cast-to-float.shader_test index 69786eccc..7c32acfa3 100644 --- a/tests/hlsl/cast-to-float.shader_test +++ b/tests/hlsl/cast-to-float.shader_test @@ -5,11 +5,11 @@ shader model >= 4.0 uniform int i; uniform uint u; uniform bool b; -uniform half h; +uniform float h;
float4 main() : sv_target { - return float4(((float)i) + 1.5, ((float)u) - 2.5, ((float)b) / 2, h); + return float4(((float)i) + 1.5, ((float)u) - 2.5, ((float)b) / 2, (half)h); }
[test] diff --git a/tests/hlsl/cast-to-int.shader_test b/tests/hlsl/cast-to-int.shader_test index efa60eed1..ae566a039 100644 --- a/tests/hlsl/cast-to-int.shader_test +++ b/tests/hlsl/cast-to-int.shader_test @@ -5,7 +5,7 @@ shader model >= 4.0 uniform float f; uniform uint u; uniform bool b; -uniform half h; +uniform float h;
float4 main() : sv_target { @@ -14,7 +14,7 @@ float4 main() : sv_target ret.x = ((float)(int)f) - 1.5; ret.y = ((float)(int)u) + 2.5; ret.z = ((float)(int)b) / 2; - ret.w = ((float)(int)h) + 3.5; + ret.w = ((float)(int)(half)h) + 3.5; return ret; }
diff --git a/tests/hlsl/cast-to-uint.shader_test b/tests/hlsl/cast-to-uint.shader_test index 668538554..dece99b75 100644 --- a/tests/hlsl/cast-to-uint.shader_test +++ b/tests/hlsl/cast-to-uint.shader_test @@ -5,7 +5,7 @@ shader model >= 4.0 uniform float f; uniform int i; uniform bool b; -uniform half h; +uniform float h;
float4 main() : sv_target { @@ -14,7 +14,7 @@ float4 main() : sv_target ret.x = ((float)(uint)f) - 1.5; ret.y = ((float)(uint)i) - 1.5; ret.z = ((float)(uint)b) / 2; - ret.w = ((float)(uint)h) + 0.5; + ret.w = ((float)(uint)(half)h) + 0.5; return ret; }
diff --git a/tests/hlsl/half.shader_test b/tests/hlsl/half.shader_test new file mode 100644 index 000000000..956102359 --- /dev/null +++ b/tests/hlsl/half.shader_test @@ -0,0 +1,23 @@ +[pixel shader fail(sm<6) todo] +uniform half h; + +float4 main() : sv_target +{ + return 0; +} + +[require] +options: backcompat + +[pixel shader] +uniform half h; + +float4 main() : sv_target +{ + return h; +} + +[test] +uniform 0 float 10.0 +todo(sm>=6) draw quad +probe all rgba (10.0, 10.0, 10.0, 10.0)
From: Giovanni Mascellani gmascellani@codeweavers.com
--- tests/hlsl/sign.shader_test | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/tests/hlsl/sign.shader_test b/tests/hlsl/sign.shader_test index c56d90823..54b953681 100644 --- a/tests/hlsl/sign.shader_test +++ b/tests/hlsl/sign.shader_test @@ -44,6 +44,10 @@ uniform 4 float4 3.0 4.0 0.0 0.0 todo(sm>=6) draw quad probe all rgba (1.0, 1.0, 1.0, 1.0)
+[require] +% SM1-3 doesn't support integral types +shader model >= 4.0 + [pixel shader] uniform int f;
From: Giovanni Mascellani gmascellani@codeweavers.com
The irrelevant input caused the test to fail on D3D12 for reasons unrelated to the test's goal. --- tests/hlsl/object-references.shader_test | 1 - 1 file changed, 1 deletion(-)
diff --git a/tests/hlsl/object-references.shader_test b/tests/hlsl/object-references.shader_test index e7b2bef06..ff405559c 100644 --- a/tests/hlsl/object-references.shader_test +++ b/tests/hlsl/object-references.shader_test @@ -226,7 +226,6 @@ size (1, 1) [pixel shader todo fail(sm>=6)] struct apple { Texture2D tex; - float4 fo : COLOR; };
float4 main(struct apple input) : sv_target
From: Giovanni Mascellani gmascellani@codeweavers.com
They are reset each time "[require]" is encountered. --- tests/hlsl/combined-samplers.shader_test | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/tests/hlsl/combined-samplers.shader_test b/tests/hlsl/combined-samplers.shader_test index 19038c34d..235537594 100644 --- a/tests/hlsl/combined-samplers.shader_test +++ b/tests/hlsl/combined-samplers.shader_test @@ -1,6 +1,7 @@ [require] shader model >= 4.0 shader model < 6.0 +options: backcompat
[sampler 0] @@ -35,10 +36,6 @@ size (1, 1) size (1, 1) 4.0 4.0 4.0 1.0
-[require] -shader model < 6.0 -options: backcompat - [pixel shader] sampler sam;
@@ -139,6 +136,7 @@ probe all rgba (1, 1, 1, 11) [require] shader model >= 5.0 shader model < 6.0 +options: backcompat
[pixel shader todo]
From: Giovanni Mascellani gmascellani@codeweavers.com
I'm not sure of what's happening here, but it seems that this change fixes a crash when running on Windows in the CI. Since most of the test excludes SM1-3 anyway, this shouldn't be a big loss. --- tests/hlsl/matrix-semantics.shader_test | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tests/hlsl/matrix-semantics.shader_test b/tests/hlsl/matrix-semantics.shader_test index 082c69c0c..e19b6b48c 100644 --- a/tests/hlsl/matrix-semantics.shader_test +++ b/tests/hlsl/matrix-semantics.shader_test @@ -1,3 +1,6 @@ +[require] +shader model >= 4.0 + [pixel shader] float4x1 main() : sv_target { @@ -18,9 +21,6 @@ row_major float1x4 main() : sv_target draw quad probe all rgba (1.0, 2.0, 3.0, 4.0)
-[require] -shader model >= 4.0 - [render target 0] format r32 float size (640, 480)
From: Giovanni Mascellani gmascellani@codeweavers.com
--- tests/shader_runner.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/tests/shader_runner.c b/tests/shader_runner.c index 423f42bd3..85987bfda 100644 --- a/tests/shader_runner.c +++ b/tests/shader_runner.c @@ -1081,7 +1081,13 @@ void run_shader_tests(struct shader_runner *runner, const struct shader_runner_o break;
case STATE_RESOURCE: - set_resource(runner, runner->ops->create_resource(runner, ¤t_resource)); + /* Not every backend supports every resource type + * (specifically, D3D9 doesn't support UAVs and + * textures with data type other than float). */ + if (!skip_tests) + { + set_resource(runner, runner->ops->create_resource(runner, ¤t_resource)); + } free(current_resource.data); break;
Half globals are legal with the backwards-compatibility flag, though. Which is not to say that 1/8 is wrong as is, but maybe we should add a test to half.shader_test.
Good point, fixed (together with the CI failure, related to the SM6 parser).
Wrt 3/8 and 6/8, should we instead skip resource directives if we're under a [require] directive?
Yeah, it makes sense. Done.
Wrt 8/8, do you know where it crashes? d3dcompiler_47 here seems perfectly capable of compiling both of those shaders.
Yes, I don't think the problem is compilation. However, I found it pretty hard to collect more information: I couldn't reproduce the crash on my own virtual machine (only on the CI), even on the CI it is not deterministic (sometimes it passes) and, unfortunately, I can't collect any stdout/stderr from a process that crashes, I don't know why. I tried setting line buffering, but it didn't help. I didn't want to waste too much time on this minor case, so I just cut it short.
This merge request was approved by Zebediah Figura.
This merge request was approved by Henri Verbeet.