[Piglit] [PATCH 7/8] util: fix piglit-shader for GLES1

Ian Romanick ian.d.romanick at intel.com
Sun Sep 4 17:27:28 PDT 2011


On 09/03/2011 09:29 AM, Chia-I Wu wrote:
> Add stubs that simply assert that they should never be reached.
> ---
>  tests/util/piglit-shader-gles1.c |   46 ++++++++++++++++++++++++++++++++++++++
>  tests/util/piglit-shader.h       |   45 ++++++++++++++++++++++++++++++++++++-
>  2 files changed, 90 insertions(+), 1 deletions(-)
>  create mode 100644 tests/util/piglit-shader-gles1.c
> 
> diff --git a/tests/util/piglit-shader-gles1.c b/tests/util/piglit-shader-gles1.c
> new file mode 100644
> index 0000000..76a1f4e
> --- /dev/null
> +++ b/tests/util/piglit-shader-gles1.c
> @@ -0,0 +1,46 @@
> +/*
> + * Copyright © 2011 LunarG, Inc.
> + *
> + * 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.
> + */
> +
> +#ifndef USE_OPENGL_ES1
> +#	error USE_OPENGL_ES1 is undefined
> +#endif
> +
> +#include "piglit-util.h"
> +
> +void
> +piglit_require_GLSL(void)
> +{
> +	assert(!"GLSL does not exist in ES1");
> +}
> +
> +void
> +piglit_require_vertex_shader(void)
> +{
> +	assert(!"vertex shader does not exist in ES1");
> +}
> +
> +void
> +piglit_require_fragment_shader(void)
> +{
> +	assert(!"fragment shader does not exist in ES1");
> +}

The rest is fine, but I think the bodies of all these functions should
just be piglit_report_result(PIGLIT_SKIP).  If one of these tests
accidentally gets built or run with GLES1, nobody will waste time
tracking down a skip result.  They might waste time tracking down a
crash result...

> diff --git a/tests/util/piglit-shader.h b/tests/util/piglit-shader.h
> index fca080d..64e6623 100644
> --- a/tests/util/piglit-shader.h
> +++ b/tests/util/piglit-shader.h
> @@ -45,7 +45,50 @@ GLint piglit_link_simple_program(GLint vs, GLint fs);
>   * wrappers.
>   */
>  /*@{*/
> -#if defined(USE_OPENGL_ES2)
> +#if defined(USE_OPENGL_ES1)
> +#define piglit_AttachShader assert(!"glAttachShader does not exist in ES1")
> +#define piglit_BindAttribLocation assert(!"glBindAttribLocation does not exist in ES1")
> +#define piglit_CompileShader assert(!"glCompileShader does not exist in ES1")
> +#define piglit_CreateProgram assert(!"glCreateProgram does not exist in ES1")
> +#define piglit_CreateShader assert(!"glCreateShader does not exist in ES1")
> +#define piglit_DeleteProgram assert(!"glDeleteProgram does not exist in ES1")
> +#define piglit_DeleteShader assert(!"glDeleteShader does not exist in ES1")
> +#define piglit_GetActiveUniform assert(!"glGetActiveUniform does not exist in ES1")
> +#define piglit_GetAttribLocation assert(!"glGetAttribLocation does not exist in ES1")
> +#define piglit_GetProgramInfoLog assert(!"glGetProgramInfoLog does not exist in ES1")
> +#define piglit_GetProgramiv assert(!"glGetProgramiv does not exist in ES1")
> +#define piglit_GetShaderInfoLog assert(!"glGetShaderInfoLog does not exist in ES1")
> +#define piglit_GetShaderiv assert(!"glGetShaderiv does not exist in ES1")
> +#define piglit_GetUniformLocation assert(!"glGetUniformLocation does not exist in ES1")
> +#define piglit_LinkProgram assert(!"glLinkProgram does not exist in ES1")
> +#define piglit_ShaderSource assert(!"glShaderSource does not exist in ES1")
> +#define piglit_UseProgram assert(!"glUseProgram does not exist in ES1")
> +#define piglit_Uniform1f assert(!"glUniform1f does not exist in ES1")
> +#define piglit_Uniform2f assert(!"glUniform2f does not exist in ES1")
> +#define piglit_Uniform3f assert(!"glUniform3f does not exist in ES1")
> +#define piglit_Uniform4f assert(!"glUniform4f does not exist in ES1")
> +#define piglit_Uniform1fv assert(!"glUniform1fv does not exist in ES1")
> +#define piglit_Uniform2fv assert(!"glUniform2fv does not exist in ES1")
> +#define piglit_Uniform3fv assert(!"glUniform3fv does not exist in ES1")
> +#define piglit_Uniform4fv assert(!"glUniform4fv does not exist in ES1")
> +#define piglit_Uniform1i assert(!"glUniform1i does not exist in ES1")
> +#define piglit_Uniform2iv assert(!"glUniform2iv does not exist in ES1")
> +#define piglit_Uniform3iv assert(!"glUniform3iv does not exist in ES1")
> +#define piglit_Uniform4iv assert(!"glUniform4iv does not exist in ES1")
> +#define piglit_UniformMatrix2fv assert(!"glUniformMatrix2fv does not exist in ES1")
> +#define piglit_UniformMatrix3fv assert(!"glUniformMatrix3fv does not exist in ES1")
> +#define piglit_UniformMatrix4fv assert(!"glUniformMatrix4fv does not exist in ES1")
> +#define piglit_GetUniformfv assert(!"glGetUniformfv does not exist in ES1")
> +#define piglit_VertexAttribPointer assert(!"glVertexAttribPointer does not exist in ES1")
> +#define piglit_EnableVertexAttribArray assert(!"glEnableVertexAttribArray does not exist in ES1")
> +#define piglit_DisableVertexAttribArray assert(!"glDisableVertexAttribArray does not exist in ES1")
> +#define piglit_UniformMatrix2x3fv assert(!"glUniformMatrix2x3fv does not exist in ES1")
> +#define piglit_UniformMatrix2x4fv assert(!"glUniformMatrix2x4fv does not exist in ES1")
> +#define piglit_UniformMatrix3x2fv assert(!"glUniformMatrix3x2fv does not exist in ES1")
> +#define piglit_UniformMatrix3x4fv assert(!"glUniformMatrix3x4fv does not exist in ES1")
> +#define piglit_UniformMatrix4x2fv assert(!"glUniformMatrix4x2fv does not exist in ES1")
> +#define piglit_UniformMatrix4x3fv assert(!"glUniformMatrix4x3fv does not exist in ES1")
> +#elif defined(USE_OPENGL_ES2)
>  #define piglit_AttachShader glAttachShader
>  #define piglit_BindAttribLocation glBindAttribLocation
>  #define piglit_CompileShader glCompileShader



More information about the Piglit mailing list