mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-04-13 05:43:18 -07:00
tests: Import vector indexing tests from Wine.
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:
parent
b64b304061
commit
fd9a568b8a
@ -50,6 +50,9 @@ vkd3d_shader_runners = \
|
|||||||
tests/shader_runner_d3d12
|
tests/shader_runner_d3d12
|
||||||
|
|
||||||
vkd3d_shader_tests = \
|
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/math.shader_test \
|
||||||
tests/swizzle-0.shader_test \
|
tests/swizzle-0.shader_test \
|
||||||
tests/swizzle-1.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
|
tests_vkd3d_shader_api_LDADD = libvkd3d-shader.la
|
||||||
SHADER_TEST_LOG_COMPILER = tests/shader_runner_d3d12
|
SHADER_TEST_LOG_COMPILER = tests/shader_runner_d3d12
|
||||||
XFAIL_TESTS = \
|
XFAIL_TESTS = \
|
||||||
|
tests/conditional.shader_test \
|
||||||
|
tests/hlsl-vector-indexing.shader_test \
|
||||||
|
tests/hlsl-vector-indexing-uniform.shader_test \
|
||||||
tests/math.shader_test \
|
tests/math.shader_test \
|
||||||
tests/swizzle-0.shader_test \
|
tests/swizzle-0.shader_test \
|
||||||
tests/swizzle-1.shader_test \
|
tests/swizzle-1.shader_test \
|
||||||
|
16
tests/hlsl-vector-indexing-uniform.shader_test
Normal file
16
tests/hlsl-vector-indexing-uniform.shader_test
Normal file
@ -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)
|
14
tests/hlsl-vector-indexing.shader_test
Normal file
14
tests/hlsl-vector-indexing.shader_test
Normal file
@ -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)
|
@ -211,6 +211,18 @@ static void parse_test_directive(struct shader_context *context, const char *lin
|
|||||||
}
|
}
|
||||||
memcpy(context->uniforms + offset, &v, sizeof(v));
|
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
|
else
|
||||||
{
|
{
|
||||||
@ -271,6 +283,9 @@ START_TEST(shader_runner_d3d12)
|
|||||||
|
|
||||||
while (fgets(line, sizeof(line), f))
|
while (fgets(line, sizeof(line), f))
|
||||||
{
|
{
|
||||||
|
if (line[0] == '\n')
|
||||||
|
continue;
|
||||||
|
|
||||||
if (line[0] == '[')
|
if (line[0] == '[')
|
||||||
{
|
{
|
||||||
switch (state)
|
switch (state)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user