From 3823b53ff88b36cfe0c46a2207abe8568237283d Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Tue, 8 Mar 2016 20:45:26 -0800 Subject: [PATCH] mesa: Make glGetInteger64v convert float/doubles to 32-bit integers. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit According to the GL 4.4 core specification, section 2.2.2 ("Data Conversions For State Query Commands"): "If a command returning integer data is called, such as GetIntegerv or GetInteger64v, a boolean value of TRUE or FALSE is interpreted as one or zero, respectively. A floating-point value is rounded to the nearest integer, unless the value is an RGBA color component, a DepthRange value, or a depth buffer clear value. In these cases, the query command converts the floating-point value to an integer according to the INT entry of table 18.2; a value not in [−1, 1] converts to an undefined value." The INT entry of table 18.2 shows that b = 32, meaning the expectation is to convert it to a 32-bit integer value. Fixes: dEQP-GLES3.functional.state_query.floats.blend_color_getinteger64 dEQP-GLES3.functional.state_query.floats.color_clear_value_getinteger64 dEQP-GLES3.functional.state_query.floats.depth_clear_value_getinteger64 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94456 Signed-off-by: Kenneth Graunke Reviewed-by: Dave Airlie --- src/mesa/main/get.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index 4cc82d8..67c4f99 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -1717,19 +1717,19 @@ _mesa_GetInteger64v(GLenum pname, GLint64 *params) break; case TYPE_FLOATN_4: - params[3] = FLOAT_TO_INT64(((GLfloat *) p)[3]); + params[3] = FLOAT_TO_INT(((GLfloat *) p)[3]); case TYPE_FLOATN_3: - params[2] = FLOAT_TO_INT64(((GLfloat *) p)[2]); + params[2] = FLOAT_TO_INT(((GLfloat *) p)[2]); case TYPE_FLOATN_2: - params[1] = FLOAT_TO_INT64(((GLfloat *) p)[1]); + params[1] = FLOAT_TO_INT(((GLfloat *) p)[1]); case TYPE_FLOATN: - params[0] = FLOAT_TO_INT64(((GLfloat *) p)[0]); + params[0] = FLOAT_TO_INT(((GLfloat *) p)[0]); break; case TYPE_DOUBLEN_2: - params[1] = FLOAT_TO_INT64(((GLdouble *) p)[1]); + params[1] = FLOAT_TO_INT(((GLdouble *) p)[1]); case TYPE_DOUBLEN: - params[0] = FLOAT_TO_INT64(((GLdouble *) p)[0]); + params[0] = FLOAT_TO_INT(((GLdouble *) p)[0]); break; case TYPE_INT_4: -- 2.7.4