Zebediah Figura : tests: Try to avoid using SV_Position from shaders which can be tested with SM1.
Alexandre Julliard
julliard at winehq.org
Fri Apr 8 14:42:29 CDT 2022
Module: vkd3d
Branch: master
Commit: 90b4cbc1f2ab2f39b85861b298f8cbd53d957249
URL: https://source.winehq.org/git/vkd3d.git/?a=commit;h=90b4cbc1f2ab2f39b85861b298f8cbd53d957249
Author: Zebediah Figura <zfigura at codeweavers.com>
Date: Thu Apr 7 18:58:16 2022 -0500
tests: Try to avoid using SV_Position from shaders which can be tested with SM1.
Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
tests/conditional.shader_test | 14 +++++++++----
tests/hlsl-for.shader_test | 18 +++++++++++------
tests/hlsl-struct-semantics.shader_test | 35 +++++++++++++++++++++++++++------
tests/trigonometry.shader_test | 13 +++++++++---
4 files changed, 61 insertions(+), 19 deletions(-)
diff --git a/tests/conditional.shader_test b/tests/conditional.shader_test
index 1a1b8fee..e665ac1d 100644
--- a/tests/conditional.shader_test
+++ b/tests/conditional.shader_test
@@ -1,7 +1,13 @@
+[vertex shader]
+void main(out float tex : texcoord, inout float4 pos : sv_position)
+{
+ tex = pos.x;
+}
+
[pixel shader]
-float4 main(float4 pos : SV_POSITION) : SV_TARGET
+float4 main(float tex : texcoord) : SV_TARGET
{
- if(pos.x > 200.0)
+ if (tex > 0.0)
return float4(0.1, 0.2, 0.3, 0.4);
else
return float4(0.9, 0.8, 0.7, 0.6);
@@ -9,5 +15,5 @@ float4 main(float4 pos : SV_POSITION) : SV_TARGET
[test]
draw quad
-probe rect rgba (0, 0, 200, 480) (0.9, 0.8, 0.7, 0.6)
-probe rect rgba (200, 0, 640, 480) (0.1, 0.2, 0.3, 0.4)
+probe rect rgba ( 0, 0, 319, 480) (0.9, 0.8, 0.7, 0.6)
+probe rect rgba (321, 0, 640, 480) (0.1, 0.2, 0.3, 0.4)
diff --git a/tests/hlsl-for.shader_test b/tests/hlsl-for.shader_test
index b133ce99..4e91ce41 100644
--- a/tests/hlsl-for.shader_test
+++ b/tests/hlsl-for.shader_test
@@ -1,14 +1,20 @@
+[vertex shader]
+void main(out float tex : texcoord, inout float4 pos : sv_position)
+{
+ tex = pos.x;
+}
+
[pixel shader]
-float4 main(float4 pos : SV_POSITION) : SV_TARGET
+float4 main(float tex : texcoord) : sv_target
{
int i;
float x = 0.0;
for (i = 0; i < 10; i++)
{
x += i;
- if (pos.x == 1.5 && i == 5)
+ if (tex > 0.5 && i == 5)
break;
- if (pos.x == 2.5 && i >= 7)
+ if (tex > -0.5 && i >= 7)
continue;
x -= 1;
}
@@ -17,6 +23,6 @@ float4 main(float4 pos : SV_POSITION) : SV_TARGET
[test]
draw quad
-probe rgba (0, 0) (10.0, 35.0, 0.0, 0.0)
-probe rgba (1, 0) (5.0, 10.0, 0.0, 0.0)
-probe rgba (2, 0) (10.0, 38.0, 0.0, 0.0)
+probe rect rgba ( 0, 0, 159, 480) (10.0, 35.0, 0.0, 0.0)
+probe rect rgba (161, 0, 479, 480) (10.0, 38.0, 0.0, 0.0)
+probe rect rgba (481, 0, 640, 480) ( 5.0, 10.0, 0.0, 0.0)
diff --git a/tests/hlsl-struct-semantics.shader_test b/tests/hlsl-struct-semantics.shader_test
index b623a998..43b07bb8 100644
--- a/tests/hlsl-struct-semantics.shader_test
+++ b/tests/hlsl-struct-semantics.shader_test
@@ -1,9 +1,34 @@
+[input layout]
+0 r32g32b32a32 float texcoord
+0 r32g32 float sv_position
+
+[vertex buffer 0]
+0.0 1.0 0.0 1.0 -2.0 -2.0
+0.0 1.0 0.0 1.0 -2.0 2.0
+0.0 1.0 0.0 1.0 2.0 -2.0
+0.0 1.0 0.0 1.0 2.0 2.0
+
+[vertex shader]
+
+struct vertex
+{
+ struct
+ {
+ float4 texcoord : texcoord;
+ float4 pos : sv_position;
+ } m;
+};
+
+void main(inout struct vertex v)
+{
+}
+
[pixel shader]
struct input
{
struct
{
- float4 pos : sv_position;
+ float4 texcoord : texcoord;
} m;
};
@@ -18,12 +43,10 @@ struct output
struct output main(struct input i)
{
struct output o;
- o.m.color = i.m.pos;
+ o.m.color = i.m.texcoord;
return o;
}
[test]
-draw quad
-probe rgba (0, 1) (0.5, 1.5, 0.0, 1.0)
-probe rgba (1, 0) (1.5, 0.5, 0.0, 1.0)
-probe rgba (3, 5) (3.5, 5.5, 0.0, 1.0)
+draw triangle strip 4
+probe all rgba (0.0, 1.0, 0.0, 1.0)
diff --git a/tests/trigonometry.shader_test b/tests/trigonometry.shader_test
index 07a280a0..cf53d7a1 100644
--- a/tests/trigonometry.shader_test
+++ b/tests/trigonometry.shader_test
@@ -1,7 +1,14 @@
+[vertex shader]
+void main(out float tex : texcoord, inout float4 pos : sv_position)
+{
+ tex = (pos.x + 1) * 320;
+}
+
[pixel shader]
-float4 main(float4 pos : SV_POSITION) : SV_TARGET
+float4 main(float tex : texcoord) : sv_target
{
- return float4(sin(pos.x - 0.5), cos(pos.x - 0.5), 0, 0);
+ tex = floor(tex + 0.25);
+ return float4(sin(tex), cos(tex), 0, 0);
}
[test]
@@ -17,7 +24,7 @@ probe rgba ( 7, 0) ( 0.65698660, 0.75390225, 0.0, 0.0) 1024
probe rgba ( 8, 0) ( 0.98935825, -0.14550003, 0.0, 0.0) 1024
probe rgba ( 9, 0) ( 0.41211849, -0.91113026, 0.0, 0.0) 1024
probe rgba (10, 0) (-0.54402111, -0.83907153, 0.0, 0.0) 1024
-probe rgba (11, 0) (-0.99999021, 0.00442570, 0.0, 0.0) 1024
+probe rgba (11, 0) (-0.99999021, 0.00442570, 0.0, 0.0) 2048
probe rgba (12, 0) (-0.53657292, 0.84385396, 0.0, 0.0) 1024
probe rgba (13, 0) ( 0.42016704, 0.90744678, 0.0, 0.0) 1024
probe rgba (14, 0) ( 0.99060736, 0.13673722, 0.0, 0.0) 1024
More information about the wine-cvs
mailing list