[Piglit] [PATCH] oes_matrix_get: Add basic test for GL_OES_matrix_get

Chad Versace chad.versace at linux.intel.com
Tue Sep 17 11:34:29 PDT 2013


On 09/10/2013 01:46 PM, Ian Romanick wrote:
> From: Ian Romanick <ian.d.romanick at intel.com>
>
> This is an OpenGL ES 1.x extension that Mesa has advertised for quite
> some time.  However, it appears that there is *no* code in Mesa to back
> that up!
>
> This test currently fails in all versions of Mesa.
>
> Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
> ---
>   tests/all.tests                                |  4 ++
>   tests/spec/CMakeLists.txt                      |  1 +
>   tests/spec/oes_matrix_get/CMakeLists.gles1.txt | 11 +++
>   tests/spec/oes_matrix_get/CMakeLists.txt       |  1 +
>   tests/spec/oes_matrix_get/api.c                | 92 ++++++++++++++++++++++++++
>   5 files changed, 109 insertions(+)
>   create mode 100644 tests/spec/oes_matrix_get/CMakeLists.gles1.txt
>   create mode 100644 tests/spec/oes_matrix_get/CMakeLists.txt
>   create mode 100644 tests/spec/oes_matrix_get/api.c
>




> +void
> +piglit_init(int argc, char **argv)
> +{
> +	static const struct {
> +		GLenum set;
> +		GLenum get;
> +	} test_vectors[] = {
> +		{ GL_MODELVIEW, GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES },
> +		{ GL_PROJECTION, GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES },
> +		{ GL_TEXTURE, GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES },
> +	};
> +
> +	static const float m[] = {
> +		10., 11., 12., 13.,
> +		14., 15., 16., 17.,
> +		18., 19., 20., 21.,
> +		22., 23., 24., 25.
> +	};
> +
> +	float got[ARRAY_SIZE(m)];
> +	unsigned i;
> +	bool pass = true;
> +
> +	piglit_require_extension("GL_OES_matrix_get");
> +
> +	for (i = 0; i < ARRAY_SIZE(test_vectors); i++) {
> +		glMatrixMode(test_vectors[i].set);
> +		glLoadMatrixf(m);
> +
> +		memset(got, 0, sizeof(got));
> +		glGetIntegerv(test_vectors[i].get, (GLint *) got);
> +                pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
> +
> +		if (memcmp(got, m, sizeof(m)) != 0) {
> +			unsigned j;

Since the test expects the same matrix to be returned in `got`
regardless of the queried matrix target, it's ripe for a
false positive. Store a unique matrix into each matrix target
and this gets

Reviewed-by: Chad Versace <chad.versace at linux.intel.com>

Oh yeah, the -fbo crashing thing really sucks.


More information about the Piglit mailing list