mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
tests: Add a test for asuint().
This commit is contained in:
parent
3d85d77ced
commit
eb70f1aeb5
Notes:
Alexandre Julliard
2022-10-18 00:13:00 +02:00
Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Henri Verbeet (@hverbeet) Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/25
55
tests/asuint.shader_test
Normal file
55
tests/asuint.shader_test
Normal file
@ -0,0 +1,55 @@
|
||||
[require]
|
||||
shader model >= 4.0
|
||||
|
||||
[pixel shader]
|
||||
|
||||
float4 main(uniform float f, uniform int i, uniform uint u, uniform half h) : sv_target
|
||||
{
|
||||
uint4 ret;
|
||||
|
||||
ret.x = asuint(f);
|
||||
ret.y = asuint(i);
|
||||
ret.z = asuint(u);
|
||||
ret.w = asuint(h);
|
||||
return ret;
|
||||
}
|
||||
|
||||
[test]
|
||||
uniform 0 uint4 123 0xc0000000 456 0x7fd69345
|
||||
todo draw quad
|
||||
probe (320,240) rgba (123.0, 3221225472.0, 456.0, 2144768896.0)
|
||||
|
||||
|
||||
[pixel shader]
|
||||
|
||||
float4 main(uniform float2x2 m, uniform float4 v) : sv_target
|
||||
{
|
||||
return float4(asuint(m)[0][1], asuint(v).y, 0, 0);
|
||||
}
|
||||
|
||||
[test]
|
||||
uniform 0 uint4 11 12 0 0
|
||||
uniform 4 uint4 13 14 0 0
|
||||
uniform 8 uint4 20 21 22 23
|
||||
todo draw quad
|
||||
probe (320,240) rgba (13.0, 21.0, 0.0, 0.0)
|
||||
|
||||
|
||||
[pixel shader fail]
|
||||
|
||||
float4 main() : sv_target
|
||||
{
|
||||
bool b = true;
|
||||
|
||||
return asuint(b);
|
||||
}
|
||||
|
||||
|
||||
[pixel shader fail]
|
||||
|
||||
float4 main() : sv_target
|
||||
{
|
||||
double d = 1.0;
|
||||
|
||||
return asuint(b);
|
||||
}
|
@ -557,7 +557,7 @@ static void parse_test_directive(struct shader_runner *runner, const char *line)
|
||||
unsigned int offset;
|
||||
|
||||
if (!sscanf(line, "%u", &offset))
|
||||
fatal_error("Unknown uniform type '%s'.\n", line);
|
||||
fatal_error("Malformed uniform offset '%s'.\n", line);
|
||||
line = strchr(line, ' ') + 1;
|
||||
|
||||
if (match_string(line, "float4", &line))
|
||||
@ -576,12 +576,12 @@ static void parse_test_directive(struct shader_runner *runner, const char *line)
|
||||
fatal_error("Malformed float constant '%s'.\n", line);
|
||||
set_uniforms(runner, offset, 1, &f);
|
||||
}
|
||||
else if (match_string(line, "int4", &line))
|
||||
else if (match_string(line, "int4", &line) || match_string(line, "uint4", &line))
|
||||
{
|
||||
int v[4];
|
||||
|
||||
if (sscanf(line, "%d %d %d %d", &v[0], &v[1], &v[2], &v[3]) < 4)
|
||||
fatal_error("Malformed int4 constant '%s'.\n", line);
|
||||
if (sscanf(line, "%i %i %i %i", &v[0], &v[1], &v[2], &v[3]) < 4)
|
||||
fatal_error("Malformed (u)int4 constant '%s'.\n", line);
|
||||
set_uniforms(runner, offset, 4, v);
|
||||
}
|
||||
else if (match_string(line, "int", &line))
|
||||
@ -600,6 +600,10 @@ static void parse_test_directive(struct shader_runner *runner, const char *line)
|
||||
fatal_error("Malformed uint constant '%s'.\n", line);
|
||||
set_uniforms(runner, offset, 1, &u);
|
||||
}
|
||||
else
|
||||
{
|
||||
fatal_error("Unknown uniform type '%s'.\n", line);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user