summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland Scheidegger <sroland@vmware.com>2017-11-09 19:03:00 +0100
committerRoland Scheidegger <sroland@vmware.com>2017-11-14 18:22:39 +0100
commitf043ca3a085c58131dac7d6115264934091b32f7 (patch)
treee3479414842b2515928f9a5e455e678ce7c72399
parent58280881b7bea00d937e694468e25ec2581545e9 (diff)
isinf-and-isnan: add clamp / min / max tests
We expect non-nan results for these (according to d3d10 rules, and at least for min/max, also according to ieee rules). The tests will not actually fail with other results (since GL's NaN behavior is all undefined), albeit some apps may rely on this. (We'll use clamp to 0/1 on purpose, which may get optimized to a saturate modifier on some hw, and ideally we'd see a non-nan result there too. The expected result there is really zero (d3d10 would require this), so if it gets decomposed into min/max combo the order is actually important.) On r600, right now all 3 give undesired (NaN) results (pending fixes), albeit all legal. Reviewed-by: Brian Paul <brianp@vmware.com>
-rw-r--r--tests/spec/glsl-1.30/execution/isinf-and-isnan.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/spec/glsl-1.30/execution/isinf-and-isnan.c b/tests/spec/glsl-1.30/execution/isinf-and-isnan.c
index 099b5c28a..99f267f41 100644
--- a/tests/spec/glsl-1.30/execution/isinf-and-isnan.c
+++ b/tests/spec/glsl-1.30/execution/isinf-and-isnan.c
@@ -340,6 +340,7 @@ enum behavior
B_FINITE = 1, /* Expected to evaluate to a finite value */
B_POSINF = 2, /* Expected to evaluate to +Infinity */
B_NEGINF = 3, /* Expected to evaluate to -Infinity */
+ B_FINITE_NAN_OK = 4, /* Expected finite value, but NaN ok */
};
struct expression_table_element
@@ -369,6 +370,10 @@ static struct expression_table_element expressions[] = {
{ "log(-1.0+z)", B_NAN },
{ "sqrt(-1.0)", B_NAN },
{ "sqrt(-1.0+z)", B_NAN },
+ { "clamp(u_nan, 0.0, 1.0)", B_FINITE_NAN_OK },
+ { "min(u_two, u_nan)", B_FINITE_NAN_OK },
+ { "max(u_two, u_nan)", B_FINITE_NAN_OK },
+
};
/**
@@ -446,6 +451,7 @@ test_expr(char *expression, int expected_behavior)
"uniform float u_inf;\n" /* Always == +infinity */
"uniform float u_minus_inf;\n" /* Always == -infinity */
"uniform float u_nan;\n" /* Always == NaN */
+ "uniform float u_two = 2.0;\n" /* To defeat constant folding */
"float compute_value() {\n"
" return %s;\n"
"}\n",
@@ -523,6 +529,9 @@ test_expr(char *expression, int expected_behavior)
pass = false;
}
break;
+ case B_FINITE_NAN_OK:
+ expected_behavior_string = "finite";
+ break;
default:
expected_behavior_string = "NaN";
break;