[PATCH vkd3d 5/5] tests: Import vector indexing tests from Wine.
Zebediah Figura
zfigura at codeweavers.com
Wed Sep 30 21:01:22 CDT 2020
Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
---
Makefile.am | 6 ++++++
tests/hlsl-vector-indexing-uniform.shader_test | 16 ++++++++++++++++
tests/hlsl-vector-indexing.shader_test | 14 ++++++++++++++
tests/shader_runner_d3d12.c | 15 +++++++++++++++
4 files changed, 51 insertions(+)
create mode 100644 tests/hlsl-vector-indexing-uniform.shader_test
create mode 100644 tests/hlsl-vector-indexing.shader_test
diff --git a/Makefile.am b/Makefile.am
index bb69078c..27bc00b6 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -50,6 +50,9 @@ vkd3d_shader_runners = \
tests/shader_runner_d3d12
vkd3d_shader_tests = \
+ tests/conditional.shader_test \
+ tests/hlsl-vector-indexing.shader_test \
+ tests/hlsl-vector-indexing-uniform.shader_test \
tests/math.shader_test \
tests/swizzle-0.shader_test \
tests/swizzle-1.shader_test \
@@ -178,6 +181,9 @@ tests_vkd3d_api_LDADD = libvkd3d.la @VULKAN_LIBS@
tests_vkd3d_shader_api_LDADD = libvkd3d-shader.la
SHADER_TEST_LOG_COMPILER = tests/shader_runner_d3d12
XFAIL_TESTS = \
+ tests/conditional.shader_test \
+ tests/hlsl-vector-indexing.shader_test \
+ tests/hlsl-vector-indexing-uniform.shader_test \
tests/math.shader_test \
tests/swizzle-0.shader_test \
tests/swizzle-1.shader_test \
diff --git a/tests/hlsl-vector-indexing-uniform.shader_test b/tests/hlsl-vector-indexing-uniform.shader_test
new file mode 100644
index 00000000..2556b589
--- /dev/null
+++ b/tests/hlsl-vector-indexing-uniform.shader_test
@@ -0,0 +1,16 @@
+# Use a uniform to prevent the compiler from optimizing.
+
+[pixel shader]
+uniform int i;
+float4 main() : SV_TARGET
+{
+ float4 color = float4(0.5, 0.4, 0.3, 0.2);
+ color.g = color[i];
+ color.b = 0.8;
+ return color;
+}
+
+[test]
+uniform 0 uint 2
+draw quad
+probe all rgba (0.5, 0.3, 0.8, 0.2)
diff --git a/tests/hlsl-vector-indexing.shader_test b/tests/hlsl-vector-indexing.shader_test
new file mode 100644
index 00000000..b641d7f9
--- /dev/null
+++ b/tests/hlsl-vector-indexing.shader_test
@@ -0,0 +1,14 @@
+[pixel shader]
+float4 main() : SV_TARGET
+{
+ float4 color;
+ color[0] = 0.020;
+ color[1] = 0.245;
+ color[2] = 0.351;
+ color[3] = 1.0;
+ return color;
+}
+
+[test]
+draw quad
+probe all rgba (0.02, 0.245, 0.351, 1.0)
diff --git a/tests/shader_runner_d3d12.c b/tests/shader_runner_d3d12.c
index e429d384..709fc006 100644
--- a/tests/shader_runner_d3d12.c
+++ b/tests/shader_runner_d3d12.c
@@ -211,6 +211,18 @@ static void parse_test_directive(struct shader_context *context, const char *lin
}
memcpy(context->uniforms + offset, &v, sizeof(v));
}
+ else if (match_string(line, "uint", &line))
+ {
+ unsigned int u;
+
+ sscanf(line, "%u", &u);
+ if (offset + 1 > context->uniform_count)
+ {
+ context->uniform_count = offset + 1;
+ context->uniforms = realloc(context->uniforms, context->uniform_count * sizeof(*context->uniforms));
+ }
+ memcpy(context->uniforms + offset, &u, sizeof(u));
+ }
}
else
{
@@ -271,6 +283,9 @@ START_TEST(shader_runner_d3d12)
while (fgets(line, sizeof(line), f))
{
+ if (line[0] == '\n')
+ continue;
+
if (line[0] == '[')
{
switch (state)
--
2.28.0
More information about the wine-devel
mailing list