[Piglit] [PATCH] Convert the compile/link utility functions to using the ARB/core wrappers.
Ian Romanick
idr at freedesktop.org
Mon Jul 11 17:02:06 PDT 2011
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 07/11/2011 01:27 PM, Eric Anholt wrote:
> This gets a few more tests working on 915, because we were trying to
> use the core functions without checking which to use (notably, one of
> them in a test where it only used GLSL when the ARB extensions were
> present!).
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
> ---
> tests/util/piglit-util.c | 36 +++++++++++++++++++++---------------
> 1 files changed, 21 insertions(+), 15 deletions(-)
>
> diff --git a/tests/util/piglit-util.c b/tests/util/piglit-util.c
> index 28096b8..78722d9 100644
> --- a/tests/util/piglit-util.c
> +++ b/tests/util/piglit-util.c
> @@ -328,25 +328,27 @@ piglit_compile_shader_text(GLenum target, const char *text)
> GLuint prog;
> GLint ok;
>
> - prog = glCreateShader(target);
> - glShaderSource(prog, 1, (const GLchar **) &text, NULL);
> - glCompileShader(prog);
> + piglit_require_GLSL();
>
> - glGetShaderiv(prog, GL_COMPILE_STATUS, &ok);
> + prog = piglit_CreateShader(target);
> + piglit_ShaderSource(prog, 1, (const GLchar **) &text, NULL);
> + piglit_CompileShader(prog);
> +
> + piglit_GetShaderiv(prog, GL_COMPILE_STATUS, &ok);
>
> {
> GLchar *info;
> GLint size;
>
> - glGetShaderiv(prog, GL_INFO_LOG_LENGTH, &size);
> + piglit_GetShaderiv(prog, GL_INFO_LOG_LENGTH, &size);
> info = malloc(size);
>
> - glGetShaderInfoLog(prog, size, NULL, info);
> + piglit_GetShaderInfoLog(prog, size, NULL, info);
> if (!ok) {
> fprintf(stderr, "Failed to compile %s shader: %s\n",
> shader_name(target),
> info);
> - glDeleteShader(prog);
> + piglit_DeleteShader(prog);
> prog = 0;
> }
> else if (0) {
> @@ -369,15 +371,17 @@ link_check_status(GLint prog, FILE *output)
> GLint size;
> GLint ok;
>
> - glGetProgramiv(prog, GL_LINK_STATUS, &ok);
> + piglit_require_GLSL();
> +
> + piglit_GetProgramiv(prog, GL_LINK_STATUS, &ok);
>
> /* Some drivers return a size of 1 for an empty log. This is the size
> * of a log that contains only a terminating NUL character.
> */
> - glGetProgramiv(prog, GL_INFO_LOG_LENGTH, &size);
> + piglit_GetProgramiv(prog, GL_INFO_LOG_LENGTH, &size);
> if (size > 1) {
> info = malloc(size);
> - glGetProgramInfoLog(prog, size, NULL, info);
> + piglit_GetProgramInfoLog(prog, size, NULL, info);
> }
>
> if (!ok) {
> @@ -423,15 +427,17 @@ GLint piglit_link_simple_program(GLint vs, GLint fs)
> {
> GLint prog;
>
> - prog = glCreateProgram();
> + piglit_require_GLSL();
> +
> + prog = piglit_CreateProgram();
> if (fs)
> - glAttachShader(prog, fs);
> + piglit_AttachShader(prog, fs);
> if (vs)
> - glAttachShader(prog, vs);
> - glLinkProgram(prog);
> + piglit_AttachShader(prog, vs);
> + piglit_LinkProgram(prog);
>
> if (!piglit_link_check_status(prog)) {
> - glDeleteProgram(prog);
> + piglit_DeleteProgram(prog);
> prog = 0;
> }
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/
iEYEARECAAYFAk4bjv4ACgkQX1gOwKyEAw9/nwCfTOfseBWfFVpJXiAIrKJ2A5HG
I1EAoIzQ1r6XLnIgOiJBQP8FI2MYkgt7
=sEUd
-----END PGP SIGNATURE-----
More information about the Piglit
mailing list