[Piglit] [PATCH] GL 3.2: Test validity of GL_DEPTH_CLAMP state

Brian Paul brianp at vmware.com
Wed Aug 14 14:39:25 PDT 2013


On 08/14/2013 01:54 PM, Nicholas Mack wrote:
> ---
>   tests/spec/gl-3.2/CMakeLists.gl.txt |  1 +
>   tests/spec/gl-3.2/depth-clamp.c     | 76 +++++++++++++++++++++++++++++++++++++
>   2 files changed, 77 insertions(+)
>   create mode 100644 tests/spec/gl-3.2/depth-clamp.c
>
> diff --git a/tests/spec/gl-3.2/CMakeLists.gl.txt b/tests/spec/gl-3.2/CMakeLists.gl.txt
> index c4734c0..7b1b5e5 100644
> --- a/tests/spec/gl-3.2/CMakeLists.gl.txt
> +++ b/tests/spec/gl-3.2/CMakeLists.gl.txt
> @@ -12,5 +12,6 @@ link_libraries (
>   piglit_add_executable (gl-3.2-minmax minmax.c)
>   piglit_add_executable (gl-3.2-draw-buffers-errors draw-buffers-errors.c)
>   piglit_add_executable (gl-3.2-clear-no-buffers clear-no-buffers.c)
> +piglit_add_executable (gl-3.2-depth-clamp depth-clamp.c)
>
>   # vim: ft=cmake:
> diff --git a/tests/spec/gl-3.2/depth-clamp.c b/tests/spec/gl-3.2/depth-clamp.c
> new file mode 100644
> index 0000000..5461995
> --- /dev/null
> +++ b/tests/spec/gl-3.2/depth-clamp.c
> @@ -0,0 +1,76 @@
> +/**
> + * 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.
> + */
> +
> +/**
> + * Test that GL_DEPTH_CLAMP is a valid state
> + *
> + * Table 6.8 (Transformation state) of OpenGL 3.2 Core added DEPTH_CLAMP
> + *
> + */
> +
> +#include "piglit-util-gl-common.h"
> +
> +PIGLIT_GL_TEST_CONFIG_BEGIN
> +
> +	config.supports_gl_compat_version = 32;
> +        config.supports_gl_core_version = 32;

spaces vs. tabs?


> +
> +        config.window_visual = PIGLIT_GL_VISUAL_RGB |
> +				PIGLIT_GL_VISUAL_DOUBLE |
> +				PIGLIT_GL_VISUAL_DEPTH |
> +				PIGLIT_GL_VISUAL_STENCIL;

I don't think you need depth/stencil/double for this test.


> +
> +PIGLIT_GL_TEST_CONFIG_END
> +
> +void
> +piglit_init(int argc, char **argv)
> +{
> +}
> +
> +enum piglit_result
> +piglit_display(void)
> +{
> +	bool pass = true;
> +
> +	if(glIsEnabled(GL_DEPTH_CLAMP)) {

Space between if and (.


> +		printf("GL_DEPTH_CLAMP was not initialized to FALSE\n");
> +		pass = false;
> +	}
> +	pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
> +
> +	glEnable(GL_DEPTH_CLAMP);
> +	if(!glIsEnabled(GL_DEPTH_CLAMP)) {
> +		printf("GL_DEPTH_CLAMP was not enabled properly\n");
> +		pass = false;
> +	}
> +	pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
> +
> +	glDisable(GL_DEPTH_CLAMP);
> +	if(glIsEnabled(GL_DEPTH_CLAMP)) {
> +		printf("GL_DEPTH_CLAMP was not disabled properly\n");
> +		pass = false;
> +	}
> +	pass = piglit_check_gl_error(GL_NO_ERROR) && pass;

You might as well test the glGetInteger/Float/Bool/Doublev() functions too.


> +	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
> +}
>

-Brian



More information about the Piglit mailing list