[Piglit] [PATCH] arb_internalformat_query2: don't get enum string for numerical values
Alejandro PiƱeiro
apinheiro at igalia.com
Tue Jan 30 11:27:10 UTC 2018
When printing the failing case we were printing the real value, and
trying to get the enum string. That doesn't make sense for pnames that
returns a numerical value, like SAMPLE_COUNTS, leading get a
"unrecognized enum" or worse, a totally unrelated enum string.
---
This patch could be fancy for those working on the recent GL_RGB9_E5
related regression, as would prevent getting those noisy "unrecognized
enum" values.
tests/spec/arb_internalformat_query2/common.c | 52 +++++++++++++++++++++------
1 file changed, 42 insertions(+), 10 deletions(-)
diff --git a/tests/spec/arb_internalformat_query2/common.c b/tests/spec/arb_internalformat_query2/common.c
index 68f33a4a02..e49689b952 100644
--- a/tests/spec/arb_internalformat_query2/common.c
+++ b/tests/spec/arb_internalformat_query2/common.c
@@ -212,12 +212,36 @@ test_data_check_possible_values(test_data *data,
}
/*
+ * Returns if the expected value for a given @pname is numeric (vs a enum).
+ */
+static bool
+return_value_is_numeric(const GLenum pname)
+{
+ switch (pname) {
+ case GL_NUM_SAMPLE_COUNTS:
+ case GL_SAMPLES:
+ case GL_INTERNALFORMAT_RED_SIZE:
+ case GL_INTERNALFORMAT_GREEN_SIZE:
+ case GL_INTERNALFORMAT_BLUE_SIZE:
+ case GL_INTERNALFORMAT_ALPHA_SIZE:
+ case GL_INTERNALFORMAT_DEPTH_SIZE:
+ case GL_INTERNALFORMAT_STENCIL_SIZE:
+ case GL_INTERNALFORMAT_SHARED_SIZE:
+ case GL_MAX_WIDTH:
+ case GL_MAX_HEIGHT:
+ case GL_MAX_DEPTH:
+ case GL_MAX_LAYERS:
+ case GL_MAX_COMBINED_DIMENSIONS:
+ case GL_TEXTURE_COMPRESSED_BLOCK_WIDTH:
+ case GL_TEXTURE_COMPRESSED_BLOCK_HEIGHT:
+ case GL_TEXTURE_COMPRESSED_BLOCK_SIZE:
+ return true;
+ default:
+ return false;
+ }
+}
+/*
* Prints the info of a failing case for a given pname.
- *
- * Note that it tries to get the name of the value at @data as if it
- * were a enum, as it is useful on that case. But there are several
- * pnames that returns a value. A possible improvement would be that
- * for those just printing the value.
*/
void
print_failing_case(const GLenum target, const GLenum internalformat,
@@ -255,11 +279,19 @@ void print_failing_case_full(const GLenum target, const GLenum internalformat,
fprintf(stderr, "expected value = (%" PRIi64 "), ",
expected_value);
- fprintf(stderr, "params[0] = (%" PRIi64 ",%s), "
- "supported=%i\n",
- current_value,
- piglit_get_gl_enum_name(current_value),
- supported);
+ if (return_value_is_numeric(pname)) {
+ fprintf(stderr, "params[0] = %" PRIi64 ", "
+ "supported=%i\n",
+ current_value,
+ supported);
+
+ } else {
+ fprintf(stderr, "params[0] = (%" PRIi64 ",%s), "
+ "supported=%i\n",
+ current_value,
+ piglit_get_gl_enum_name(current_value),
+ supported);
+ }
}
/*
--
2.11.0
More information about the Piglit
mailing list