From: Zebediah Figura zfigura@codeweavers.com
--- tests/asuint.shader_test | 40 ++++++++++++++++++++++++++++++++++++++++ tests/shader_runner.c | 12 ++++++++---- 2 files changed, 48 insertions(+), 4 deletions(-) create mode 100644 tests/asuint.shader_test
diff --git a/tests/asuint.shader_test b/tests/asuint.shader_test new file mode 100644 index 00000000..eda96f58 --- /dev/null +++ b/tests/asuint.shader_test @@ -0,0 +1,40 @@ +[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 fail todo] + +float4 main() : sv_target +{ + bool b = true; + + return asuint(b); +} + + +[pixel shader fail todo] + +float4 main() : sv_target +{ + double d = 1.0; + + return asuint(b); +} diff --git a/tests/shader_runner.c b/tests/shader_runner.c index 25986b31..3fb677ce 100644 --- a/tests/shader_runner.c +++ b/tests/shader_runner.c @@ -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 {