[Piglit] [PATCH] for gles v1 extension oes_query_matrix

Huang, JunX A junx.a.huang at intel.com
Tue Dec 17 18:06:32 PST 2013


Hi Paul,

Thanks for your correcting!
But I still can not follow your following saying, could you be more specific?
"Also, maybe it should be structured so that the floating point matrix is first constructed from the mantisa & exponent arrays first.  Then, compare that matrix to the expected result."
And here is the update file:

/*
 * Copyright © 2013 Intel Corporation
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice (including the next
 * paragraph) shall be included in all copies or substantial portions of the
 * Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 * IN THE SOFTWARE.
 */

/**
 * @file
 * @brief Test GL_OES_query_matrix with types of operation in OpenGL ES 1.1.
 *
 * It uses the GL_FIXED data type.
 *
 */

#include "piglit-util-gl-common.h"
#include "piglit-util-egl.h"


struct sub_test
{
    const char *name;
    const GLfloat matrix[16];
};

PIGLIT_GL_TEST_CONFIG_BEGIN config.supports_gl_es_version = 11;
PIGLIT_GL_TEST_CONFIG_END static PFNGLQUERYMATRIXXOESPROC glQueryMatrixxOES;
static char sOut[256] = {0}, sTmp[256] = {0};

static bool
verifyQuery(struct sub_test
 test, GLbitfield status)
{
	const GLfloat * matrix = test.matrix;
	GLfloat (*m)[4] = (void *) matrix;
	GLint i, j, k;
	bool functionPass = true;
	GLbitfield querystatus;
	GLfixed fMan[16];
	GLint iExp[16];
	GLfloat fQueryresult, fLimit, fDiff;
	sOut[0] = '\0';
	strcat(sOut, sTmp);
	querystatus = glQueryMatrixxOES(fMan, iExp);
	functionPass = piglit_check_gl_error(GL_NO_ERROR) && functionPass;
	snprintf(sTmp, sizeof(sTmp), "0x%x,0x%x, VerifyQuery:\n",
			status, querystatus);
	strcat(sOut, sTmp);

	for(i = 0; i < 4; i++){
		for(j = 0; j < 4; j++){
			k = j * 4 + i;
			strcat(sOut, "\t\t");
			fQueryresult = 1.0 * fMan[k] * (exp2 (iExp[k]) / (1 << 16));
			fLimit = 0.01 * (fabs(fQueryresult) + 1);
			fDiff = m[i][j] - fQueryresult;
			if((querystatus & (1 << k)) != 0 && (status & (1 << k)) != 0)
				strcat(sOut, "sameNA");
			else if(abs(fDiff) <= fLimit){
				strcat(sOut, "sameValue");
			}else{
				if(!(fDiff <= fLimit)){
					snprintf(sTmp, sizeof(sTmp),
							"should:%f<%f", (float) fDiff, (float) fLimit);
					strcat(sOut, sTmp);
				}else if(!(fDiff >= (-fLimit))){
					snprintf(sTmp, sizeof(sTmp),
							"should:%f>%f", (float) fDiff, (float) (-fLimit));
					strcat(sOut, sTmp);
				}else{
					snprintf(sTmp, sizeof(sTmp),
							"should:%f=%f,%i=%i", fQueryresult, m[i][j],
							querystatus & (1 << k), status & (1 << k));
					strcat(sOut, sTmp);
				}
				functionPass = false;
			}
		}
		strcat(sOut, "\n");
	}
	strcat(sOut, "\n");
	sTmp[0] = '\0';
	piglit_report_subtest_result(
					functionPass ? PIGLIT_PASS : PIGLIT_FAIL, test.name);
	return functionPass ? true : false;
}


/* new window size or exposure */
static bool
tests()
{
	bool pass = true;
	GLint maxexp;
	GLfixed maxman;
	struct sub_test basedm = {
		"based", 
		{
			1, 0, 0, 0 ,
			0, 1, 0, 0,
			0, 0, 1, 0,
			0, 0, 0, 1
		}},

		transformedm1 = {
		"transformedm1", 
		{
			6.666626, 0, 0, 0,
			0, 5, 0, 0,
			0, 0, -1.181793, -10.908936,
			0, 0, -1, 0
		}},

		transformedm2 = {
		"transformedm2", 
		{
			0.444443, 0, 0, 0,
			0, 0.333328, 0, 0,
			0, 0, -0.666656, 0.333328,
			0, 0, 0, 1
		}},

		transformedm3 = {
		"transformedm3", 
		{
			2, 0, 0,0,
			0, 3, 0, 0,
			0, 0, 0.500000, 0,
			0, 0, 0, 1
		}},

		transformedm4 = {
		"transformedm4", 
		{
			2, 0, 0, 2,
			0, 3, 0, 6,
			0, 0, 0.500000, -3,
			0, 0, 0, 1
		}},

		transformedm5 = {
		"transformedm5", 
		{
			1.999939, -0.002892, 0.005826, 0,
			0.002926, 2.999878, -0.017427, 0,
			-0.002905, 0.002913, 0.499977, 0,
			0, 0, 0, 1
		}},

		transformedm6 = {
		"transformedm6", 
		{
			2, 0, 0, 0 ,
			0, 0, 0, 0,
			0, 0, 3.4E38, 0,
			0, 0, 0, 1
		}},

		transformedm7 = {
		"transformedm7", 
		{
			1, 0, 0, 2,
			0, 1, 0, 0,
			0, 0, 1, 3.4E38,
			0, 0, 0, 1
		}},

		transformedm8 = {
		"transformedm8", 
		{
			1, 0, 0, 2,
			0, 1, 0, 0,
			0, 0, 1, 3.4E38,
			0, 0, 0, 1
		}},

		transformedm9 = {
		"transformedm9", 
		{
			2, 0, 0, 2,
			0, 0, 0, 0,
			0, 0, 3.4E38, 3.4E38,
			0, 0, 0, 1
		}};

	GLfloat ar = 3.0f / 4.0f;

	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	glPushMatrix();

	snprintf(sTmp, sizeof(sTmp), "Identity:\n");
	pass = verifyQuery(basedm, 0) && pass;

	glFrustumf(-ar, ar, -1, 1, 5.0, 60.0);
	snprintf(sTmp, sizeof(sTmp), "Frustum:\n");
	pass = verifyQuery(transformedm1, 0) && pass;



	glPopMatrix();
	pass = verifyQuery(basedm, 0) && pass;

	glOrthof(-3.0 * ar, 3.0 * ar, -3.0, 3.0, -2.0, 1.0);

	pass = verifyQuery(transformedm2, 0) && pass;


	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();
	glScalef(2.0, 3.0, 0.5);

	pass = verifyQuery(transformedm3, 0) && pass;

	snprintf(sTmp, sizeof(sTmp), "Push,Translate:\n");
	glPushMatrix();
	glTranslatef(1.0, 2.0, -6.0);

	pass = verifyQuery(transformedm4, 0) && pass;


	snprintf(sTmp, sizeof(sTmp), "Pop:\n");
	glPopMatrix();
	pass = verifyQuery(transformedm3, 0) && pass;


	snprintf(sTmp, sizeof(sTmp), "Rotate:\n");
	glRotatef(0.5, 1.0, 1.0, 0.5);

	pass = verifyQuery(transformedm5, 0) && pass;


	snprintf(sTmp, sizeof(sTmp), "overflow by max of GLfixed:\n");
	glLoadIdentity();
	maxexp = (1 << (8 * sizeof(GLint) - 1)) ^ (GLint) (-1);
	maxman = (1 << (8 * sizeof(GLfixed) - 1)) ^ (GLfixed) (-1);
	glTranslatef(1.0, 2.0, 1.0 * maxman * (exp2 (maxexp) / (1 << 16)));

	pass = verifyQuery(basedm, 0xf000) && pass;

	snprintf(sTmp, sizeof(sTmp), "invalid bits still:\n");
	glScalef(2.0, 3.0, 0.5);

	pass = verifyQuery(transformedm3, 0xf000) && pass;

	snprintf(sTmp, sizeof(sTmp),
					"revalid bits. glScalef with max and min of GLfloat:\n");
	glLoadIdentity();
	glScalef(2.0, 3.4E-38, 3.4E38);
	pass = verifyQuery(transformedm6, 0) && pass;


	snprintf(sTmp, sizeof(sTmp),
						"glTranslatef with max and min of GLfloat:\n");
	glLoadIdentity();
	glTranslatef(2.0, 3.4E-38, 3.4E38);
	pass = verifyQuery(transformedm7, 0) && pass;


	snprintf(sTmp, sizeof(sTmp), "glRotatef a circle:\n");
	glRotatef(360, 0, 0, 0);

	pass = verifyQuery(transformedm7, 0) && pass;


	snprintf(sTmp, sizeof(sTmp), "glRotatef with max and min of GLfloat:\n");
	glRotatef(360, 2.0, 3.4E-38, 3.4E38);
	pass = verifyQuery(transformedm8, 0) && pass;


	snprintf(sTmp, sizeof(sTmp),
						"glScalef again with max and min of GLfloat:\n");
	glScalef(2.0, 3.4E-38, 3.4E38);
	pass = verifyQuery(transformedm9, 0) && pass;


	if(pass != true)
		fprintf (stderr, "%s\nVerify Query Fail\n", sOut);
	return pass;
}

enum piglit_result
piglit_display(void)
{
	/* UNREACHED */
	return PIGLIT_FAIL;
}

void
piglit_init(int argc, char **argv)
{
	piglit_require_extension("GL_OES_query_matrix");
	glQueryMatrixxOES = (PFNGLQUERYMATRIXXOESPROC)
				eglGetProcAddress("glQueryMatrixxOES");
	if(!glQueryMatrixxOES)
		piglit_report_result(PIGLIT_FAIL);
	if(!piglit_check_gl_error(GL_NO_ERROR)){
		/* Should be no error at this point.  If there is, report failure */
		piglit_report_result(PIGLIT_FAIL);
	}
	piglit_report_result(tests() ? PIGLIT_PASS : PIGLIT_FAIL);
}


-----Original Message-----
From: piglit-bounces at lists.freedesktop.org [mailto:piglit-bounces at lists.freedesktop.org] On Behalf Of Brian Paul
Sent: Thursday, December 12, 2013 11:37 PM
To: piglit at lists.freedesktop.org
Subject: Re: [Piglit] [PATCH] for gles v1 extension oes_query_matrix
Importance: High

On 12/12/2013 07:42 AM, Huang Jun wrote:
> ---
>   tests/all.tests                                    |    4 +
>   tests/spec/CMakeLists.txt                          |    1 +
>   tests/spec/oes_query_matrix/CMakeLists.gles1.txt   |    7 +
>   tests/spec/oes_query_matrix/CMakeLists.txt         |    1 +
>   tests/spec/oes_query_matrix/oes_query_matrix-api.c |  283 ++++++++++++++++++++
>   5 files changed, 296 insertions(+)
>   create mode 100755 tests/spec/oes_query_matrix/CMakeLists.gles1.txt
>   create mode 100755 tests/spec/oes_query_matrix/CMakeLists.txt
>   create mode 100644 
> tests/spec/oes_query_matrix/oes_query_matrix-api.c
>
> diff --git a/tests/all.tests b/tests/all.tests index cdaf1d5..af129bb 
> 100644
> --- a/tests/all.tests
> +++ b/tests/all.tests
> @@ -2647,6 +2647,10 @@ oes_matrix_get = Group()
>   spec['OES_matrix_get'] = oes_matrix_get
>   oes_matrix_get['All queries'] = 
> concurrent_test('oes_matrix_get-api')
>
> +oes_query_matrix = Group()
> +spec['OES_query_matrix'] = oes_query_matrix oes_query_matrix['All 
> +queries'] = concurrent_test('oes_query_matrix-api')
> +
>   oes_fixed_point = Group()
>   spec['OES_fixed_point'] = oes_fixed_point
>   oes_fixed_point['attribute-arrays'] = 
> concurrent_test('oes_fixed_point-attribute-arrays')
> diff --git a/tests/spec/CMakeLists.txt b/tests/spec/CMakeLists.txt 
> index 1229a03..535b9e2 100644
> --- a/tests/spec/CMakeLists.txt
> +++ b/tests/spec/CMakeLists.txt
> @@ -57,6 +57,7 @@ add_subdirectory (nv_texture_barrier)
>   add_subdirectory (oes_compressed_etc1_rgb8_texture)
>   add_subdirectory (oes_compressed_paletted_texture)
>   add_subdirectory (oes_matrix_get)
> +add_subdirectory (oes_query_matrix)
>   add_subdirectory (arb_draw_elements_base_vertex)
>   add_subdirectory (arb_fragment_program)
>   add_subdirectory (arb_vertex_array_bgra) diff --git 
> a/tests/spec/oes_query_matrix/CMakeLists.gles1.txt 
> b/tests/spec/oes_query_matrix/CMakeLists.gles1.txt
> new file mode 100755
> index 0000000..131fda5
> --- /dev/null
> +++ b/tests/spec/oes_query_matrix/CMakeLists.gles1.txt
> @@ -0,0 +1,7 @@
> +link_libraries(
> +	piglitutil_${piglit_target_api}
> +	)
> +
> +piglit_add_executable(oes_query_matrix-api  oes_query_matrix-api.c)
> +
> +# vim: ft=cmake:
> diff --git a/tests/spec/oes_query_matrix/CMakeLists.txt 
> b/tests/spec/oes_query_matrix/CMakeLists.txt
> new file mode 100755
> index 0000000..144a306
> --- /dev/null
> +++ b/tests/spec/oes_query_matrix/CMakeLists.txt
> @@ -0,0 +1 @@
> +piglit_include_target_api()
> diff --git a/tests/spec/oes_query_matrix/oes_query_matrix-api.c 
> b/tests/spec/oes_query_matrix/oes_query_matrix-api.c
> new file mode 100644
> index 0000000..0a45841
> --- /dev/null
> +++ b/tests/spec/oes_query_matrix/oes_query_matrix-api.c
> @@ -0,0 +1,283 @@
> +/*
> + * Copyright © 2013 Intel Corporation
> + *
> + * Permission is hereby granted, free of charge, to any person 
> +obtaining a
> + * copy of this software and associated documentation files (the 
> +"Software"),
> + * to deal in the Software without restriction, including without 
> +limitation
> + * the rights to use, copy, modify, merge, publish, distribute, 
> +sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom 
> +the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice (including 
> +the next
> + * paragraph) shall be included in all copies or substantial portions 
> +of the
> + * Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
> +EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 
> +MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT 
> +SHALL
> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES 
> +OR OTHER
> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 
> +ARISING
> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 
> +OTHER DEALINGS
> + * IN THE SOFTWARE.
> + */
> +
> +/**
> + * @file
> + * @brief Test GL_OES_query_matrix with types of operation in OpenGL ES 1.1.
> + *
> + * It uses the GL_FIXED data type.
> + *
> + */
> +
> +#include "piglit-util-gl-common.h"
> +#include "piglit-util-egl.h"
> +//#include "common.h"
> +//#include "egl-util.h"//GLUtils::getProcAddress

Any reason to keep those comment lines?


> +
> +
> +PIGLIT_GL_TEST_CONFIG_BEGIN
> +    config.supports_gl_es_version = 11;
> +
> +PIGLIT_GL_TEST_CONFIG_END
> +
> +
> +
> +
> +static PFNGLQUERYMATRIXXOESPROC glQueryMatrixxOES; static bool pass = 
> +true; static char sOut[256]={0}, sTmp[256]={0};
> +
> +bool verifyQuery(GLfloat* matrix, GLbitfield status)

This function should be static.  Can matrix be const-qualified?



> +{
> +    GLfloat (*m)[4]=(void *)matrix;//    GLfloat m[4]

We use 8-space tabs for indentation in Piglit.  See the HACKING file for more style guidelines.  In fact, you may want to run your code through the 'indent' command seen in HACKING.


> +    GLint i,j,k;

Space after commas.

> +    bool functionPass=true;

space before/after =


> +    GLbitfield querystatus;
> +    GLfixed fMan[16];
> +    GLint iExp[16];
> +    GLfloat fQueryresult, fLimite, fDiff;

fLimite -> fLimit


> +    sOut[0]='\0';
> +    strcat(sOut, sTmp);
> +    querystatus = glQueryMatrixxOES(fMan, iExp );
> +    functionPass = piglit_check_gl_error(GL_NO_ERROR) && functionPass;
> +    snprintf(sTmp, sizeof(sTmp), "0x%x,0x%x, VerifyQuery:\n",
> +        status,querystatus);
> +    strcat(sOut, sTmp);
> +
> +    for (i = 0; i < 4; i++) {
> +        for (j = 0; j < 4; j++)
> +        {

Brace on same line as for.

> +            k=j*4+i;

Spaces around operators.


> +            strcat(sOut, "\t\t");
> +            fQueryresult = 1.0*fMan[k]* (exp2 (iExp[k])/(1<<16));
> +            fLimite = 0.01*( fabs( fQueryresult)+1);
> +            fDiff = m[i][j] - fQueryresult;
> +            if ((querystatus & (1<<k)) != 0 && (status & (1<<k) )!= 0)
> +                strcat(sOut, "sameNA");
> +
> +            else if ( (fDiff <= fLimite) && (fDiff>= -fLimite))

abs(fDiff) <= fLimit ?


> +            {

Brace on prev line.


> +                strcat(sOut, "sameValue");
> +            }
> +            else
> +            {

} else {


> +                if( ! (fDiff<=fLimite))

if (!(fDiff <= fLimit))


> +                {
> +                    snprintf(sTmp, sizeof(sTmp),
> +                        "should:%f<%f",(float)fDiff,(float)fLimite);
> +                    strcat(sOut, sTmp);
> +                }
> +                else if (! (fDiff>=(-fLimite)))
> +                {
> +                    snprintf(sTmp, sizeof(sTmp),
> +                        "should:%f>%f",(float)fDiff,(float)(-fLimite));
> +                    strcat(sOut, sTmp);
> +                }
> +                else
> +                {
> +                    snprintf(sTmp, sizeof(sTmp),
> +                        "should:%f=%f,%i=%i",
> +                        fQueryresult, m[i][j],querystatus & (1<<k),
> +                         status & (1<<k));
> +                    strcat(sOut, sTmp);
> +                }
> +                functionPass = false;
> +            }
> +        }
> +
> +        strcat(sOut, "\n");
> +    }
> +    strcat(sOut, "\n");
> +    sTmp[0] = '\0';
> +    return functionPass ? PIGLIT_PASS : PIGLIT_FAIL;

The return type of the function is bool, not piglit_result


> +}

The code in that function is a bit hard to follow without any comments.

Also, maybe it should be structured so that the floating point matrix is first constructed from the mantisa & exponent arrays first.  Then, compare that matrix to the expected result.



> +
> +
> +/* new window size or exposure */
> +static void
> +tests()

static bool
tests(void)
{



> +{
> +
> +    GLint maxexp;
> +    GLfixed maxman ;
> +    GLfloat basedm[16] = {
> +    1, 0, 0, 0 ,
> +    0, 1, 0, 0,
> +    0, 0, 1, 0,
> +    0, 0, 0, 1},
> +
> +    transformedm1[16] = {
> +    6.666626, 0, 0, 0,
> +    0, 5, 0, 0,
> +    0, 0, -1.181793,-10.908936,
> +    0, 0, -1,0},
> +
> +    transformedm2[16] = {
> +    0.444443, 0, 0, 0,
> +    0, 0.333328, 0, 0,
> +    0, 0, -0.666656, 0.333328,
> +    0, 0, 0, 1},
> +    transformedm3[16] = {
> +    2, 0, 0,0,
> +    0, 3, 0, 0,
> +    0, 0, 0.500000, 0,
> +    0, 0, 0, 1},
> +    transformedm4[16] =  {
> +    2, 0, 0, 2,
> +    0, 3, 0, 6,
> +    0, 0, 0.500000, -3,
> +    0, 0, 0, 1},
> +    transformedm5[16] = {
> +    1.999939, -0.002892, 0.005826, 0,
> +    0.002926, 2.999878, -0.017427, 0,
> +    -0.002905, 0.002913, 0.499977, 0,
> +    0, 0, 0, 1},
> +    transformedm6[16] ={
> +    2, 0, 0, 0 ,
> +    0, 0, 0, 0,
> +    0, 0, 3.4E38, 0,
> +    0, 0, 0, 1},
> +    transformedm7[16] ={
> +    1, 0, 0, 2,
> +    0, 1, 0, 0,
> +    0, 0, 1, 3.4E38,
> +    0, 0, 0, 1},
> +    transformedm8[16] ={
> +    1, 0, 0, 2,
> +    0, 1, 0, 0,
> +    0, 0, 1, 3.4E38,
> +    0, 0, 0, 1},
> +    transformedm9[16] ={
> +    2, 0, 0, 2,
> +    0, 0, 0, 0,
> +    0, 0, 3.4E38, 3.4E38,
> +    0, 0, 0, 1};

Can all those arrays be marked const?


> +
> +    GLfloat ar = (GLfloat) 3 / (GLfloat) 4;

3.0f / 4.0f ?


> +
> +

A single blank line would be enough.


> +    glMatrixMode(GL_PROJECTION);
> +    glLoadIdentity();
> +    glPushMatrix();
> +
> +    snprintf(sTmp, sizeof(sTmp), "Identity:\n");
> +    pass = pass && !verifyQuery(basedm,0);

Se usually do "pass = test() && pass"

Maybe use piglit_report_subtest_result() for each test?


> +
> +
> +    glFrustumf(-ar, ar, -1, 1, 5.0, 60.0);
> +    snprintf(sTmp, sizeof(sTmp), "Frustum:\n");
> +    pass = pass && !verifyQuery(transformedm1,0);
> +
> +
> +    glPopMatrix();
> +    pass = pass && !verifyQuery(basedm,0);
> +    glOrthof(-3.0*ar, 3.0*ar, -3.0, 3.0, -2.0, 1.0);
> +
> +    pass = pass && !verifyQuery(transformedm2,0);
> +
> +    glMatrixMode(GL_MODELVIEW);
> +    glLoadIdentity();
> +    glScalef(2.0,3.0,0.5);
> +
> +    pass = pass && !verifyQuery(transformedm3,0);
> +    snprintf(sTmp, sizeof(sTmp), "Push,Translate:\n");
> +    glPushMatrix();
> +    glTranslatef(1.0, 2.0, -6.0);
> +
> +    pass = pass && !verifyQuery(transformedm4,0);
> +
> +    snprintf(sTmp, sizeof(sTmp), "pop:%5Cn");
> +    glPopMatrix();
> +    pass = pass && !verifyQuery(transformedm3,0);
> +
> +    snprintf(sTmp, sizeof(sTmp), "Rotate:\n");
> +    glRotatef(0.5,1.0,1.0,0.5);
> +
> +    pass = pass && !verifyQuery(transformedm5,0);
> +
> +    snprintf(sTmp, sizeof(sTmp), "overflow by max of GLfixed:\n");
> +    glLoadIdentity();
> +    maxexp= (1<<(8*sizeof(GLint)-1))^(GLint)(-1);
> +    maxman = (1<<(8*sizeof(GLfixed)-1))^ (GLfixed)(-1);
> +    glTranslatef(1.0, 2.0,  1.0*maxman* (exp2 (maxexp)/(1<<16)));
> +
> +    pass = pass && !verifyQuery(basedm,0xf000);
> +
> +    snprintf(sTmp, sizeof(sTmp), "invalid bits still:\n");
> +    glScalef(2.0,3.0,0.5);
> +
> +    pass = pass && !verifyQuery(transformedm3,0xf000);
> +
> +    snprintf(sTmp, sizeof(sTmp),
> +        "revalid bits. glScalef with max and min of GLfloat:\n");
> +    glLoadIdentity();
> +    glScalef(2.0,3.4E-38,3.4E38);
> +    pass = pass && !verifyQuery(transformedm6,0);
> +
> +    snprintf(sTmp, sizeof(sTmp),
> +        "glTranslatef with max and min of GLfloat:\n");
> +    glLoadIdentity();
> +    glTranslatef(2.0,3.4E-38,3.4E38);
> +    pass = pass && !verifyQuery(transformedm7,0);
> +
> +    snprintf(sTmp, sizeof(sTmp),
> +        "glRotatef a circle:\n");
> +    glRotatef(360, 0, 0, 0);
> +    pass = pass && !verifyQuery(transformedm7,0);
> +
> +    snprintf(sTmp, sizeof(sTmp),
> +        "glRotatef with max and min of GLfloat:\n");
> +    glRotatef(360, 2.0,3.4E-38,3.4E38);
> +    pass = pass && !verifyQuery(transformedm8,0);
> +
> +    snprintf(sTmp, sizeof(sTmp),
> +        "glScalef again with max and min of GLfloat:\n");
> +    glScalef(2.0,3.4E-38,3.4E38);
> +    pass = pass && !verifyQuery(transformedm9,0);
> +
> +    if (pass != true )
> +      fprintf(stderr, "%s\nVerify Query Fail\n", sOut);
> +    return;

Let's return pass here


> +}
> +
> +enum piglit_result
> +piglit_display(void)
> +{
> +    /* UNREACHED */
> +    return PIGLIT_FAIL;
> +}
> +
> +void
> +piglit_init(int argc, char **argv)
> +{
> +    piglit_require_extension("GL_OES_query_matrix");
> +    glQueryMatrixxOES = (PFNGLQUERYMATRIXXOESPROC)
> +        eglGetProcAddress("glQueryMatrixxOES");
> +    if (!glQueryMatrixxOES)
> +        piglit_report_result(PIGLIT_FAIL);
> +
> +    tests();
> +    piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL); }
> +
> +
>

_______________________________________________
Piglit mailing list
Piglit at lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


More information about the Piglit mailing list