On Thu, Sep 9, 2021 at 6:01 AM Zebediah Figura zfigura@codeweavers.com wrote:
Signed-off-by: Zebediah Figura zfigura@codeweavers.com
Makefile.am | 2 ++ tests/cast-to-float.shader_test | 29 +++++++++++++++++++++++++++++ tests/shader_runner_d3d12.c | 33 ++++++++++++++++++++++++++++++--- 3 files changed, 61 insertions(+), 3 deletions(-) create mode 100644 tests/cast-to-float.shader_test
diff --git a/tests/shader_runner_d3d12.c b/tests/shader_runner_d3d12.c index 2221c0f87..86151e424 100644 --- a/tests/shader_runner_d3d12.c +++ b/tests/shader_runner_d3d12.c
@@ -242,11 +242,38 @@ static void parse_test_directive(struct shader_context *context, const char *lin } memcpy(context->uniforms + offset, &v, sizeof(v)); }
else if (match_string(line, "float", &line)){float f;if (!(f = strtof(line, &line)) && !line)goto err;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, &f, sizeof(f));}else if (match_string(line, "int", &line)){int i;if (!(i = strtol(line, &line, 0)))goto err;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, &i, sizeof(i));} else if (match_string(line, "uint", &line)) { unsigned int u;
sscanf(line, "%u", &u);
if (!(u = strtoul(line, &line, 0)))goto err; if (offset + 1 > context->uniform_count) { context->uniform_count = offset + 1;
Strictly speaking, it doesn't seem necessary to change and use the strto*() functions instead of sscanf() in all the non-float4 cases. Unless you have plans...