From: Francisco Casas fcasas@codeweavers.com
d3dbc expects bools to be passed as either 1.0f or 0.0f, accordingly. --- tests/hlsl/cast-to-float.shader_test | 2 +- tests/hlsl/cast-to-half.shader_test | 2 +- tests/hlsl/cast-to-int.shader_test | 2 +- tests/hlsl/cast-to-uint.shader_test | 2 +- tests/shader_runner.c | 38 ++++++++++++++++++++++++++++ 5 files changed, 42 insertions(+), 4 deletions(-)
diff --git a/tests/hlsl/cast-to-float.shader_test b/tests/hlsl/cast-to-float.shader_test index caaf98c02..010c722a3 100644 --- a/tests/hlsl/cast-to-float.shader_test +++ b/tests/hlsl/cast-to-float.shader_test @@ -15,7 +15,7 @@ float4 main() : sv_target [test] uniform 0 int -1 uniform 1 uint 3 -uniform 2 int -2 +uniform 2 bool true uniform 3 float 0.5 draw quad probe all rgba (0.5, 0.5, 0.5, 0.5) diff --git a/tests/hlsl/cast-to-half.shader_test b/tests/hlsl/cast-to-half.shader_test index b8feb6760..44f610502 100644 --- a/tests/hlsl/cast-to-half.shader_test +++ b/tests/hlsl/cast-to-half.shader_test @@ -15,7 +15,7 @@ float4 main() : sv_target [test] uniform 0 int -1 uniform 1 uint 3 -uniform 2 int -2 +uniform 2 bool true uniform 3 float 0.5 draw quad probe all rgba (0.5, 0.5, 0.5, 0.5) diff --git a/tests/hlsl/cast-to-int.shader_test b/tests/hlsl/cast-to-int.shader_test index 3e850fb5b..7d362128b 100644 --- a/tests/hlsl/cast-to-int.shader_test +++ b/tests/hlsl/cast-to-int.shader_test @@ -21,7 +21,7 @@ float4 main() : sv_target [test] uniform 0 float 2.6 uniform 1 int -2 -uniform 2 int -2 +uniform 2 bool true uniform 3 float -3.6 draw quad probe all rgba (0.5, 0.5, 0.5, 0.5) diff --git a/tests/hlsl/cast-to-uint.shader_test b/tests/hlsl/cast-to-uint.shader_test index 07479984a..e7ad30677 100644 --- a/tests/hlsl/cast-to-uint.shader_test +++ b/tests/hlsl/cast-to-uint.shader_test @@ -21,7 +21,7 @@ float4 main() : sv_target [test] uniform 0 float 2.6 uniform 1 int 2 -uniform 2 int -2 +uniform 2 bool true uniform 3 float -3.6 draw quad probe all rgba (0.5, 0.5, 0.5, 0.5) diff --git a/tests/shader_runner.c b/tests/shader_runner.c index 8cffe20f4..873f10447 100644 --- a/tests/shader_runner.c +++ b/tests/shader_runner.c @@ -546,6 +546,20 @@ static void set_uniforms(struct shader_runner *runner, size_t offset, size_t cou memcpy(runner->uniforms + offset, uniforms, count * sizeof(*runner->uniforms)); }
+static void read_bool(const char **line, bool *b) +{ + const char *rest; + + if (match_string(*line, "true", &rest)) + *b = true; + else if (match_string(*line, "false", &rest)) + *b = false; + else + fatal_error("Malformed bool constant '%s'.\n", *line); + + *line = rest; +} + static void read_int(const char **line, int *i) { char *rest; @@ -972,6 +986,30 @@ static void parse_test_directive(struct shader_runner *runner, const char *line) set_uniforms(runner, offset, 1, &f); } } + else if (match_string(line, "bool4", &line)) + { + unsigned int k; + float f; + bool b; + + for (k = 0; k < 4; ++k) + { + read_bool(&line, &b); + /* SM1-SM3 expects true to be 1.0f, while SM4-SM5 allows any non-zero value. */ + f = b; + set_uniforms(runner, offset + k, 1, &f); + } + } + else if (match_string(line, "bool", &line)) + { + float f; + bool b; + + read_bool(&line, &b); + /* SM1-SM3 expects true to be 1.0f, while SM4-SM5 allows any non-zero value. */ + f = b; + set_uniforms(runner, offset, 1, &f); + } else if (match_string(line, "int64_t2", &line)) { struct i64vec2 v;