[Piglit] [PATCH 2/6] shader_runner: Don't call glDeleteProgram on an ARB program.

Kenneth Graunke kenneth at whitecape.org
Wed Nov 11 16:53:35 PST 2015


On Tuesday, November 10, 2015 10:46:19 PM Matt Turner wrote:
> I don't feel good about this check, but it is done elsewhere in the same
> file ("prog == 0").
> ---
>  tests/shaders/shader_runner.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
> index 4597b46..bb17381 100644
> --- a/tests/shaders/shader_runner.c
> +++ b/tests/shaders/shader_runner.c
> @@ -3081,8 +3081,12 @@ piglit_display(void)
>  	if (piglit_automatic) {
>  	        free_subroutine_uniforms();
>  		/* Free our resources, useful for valgrinding. */
> -		glDeleteProgram(prog);
> -		glUseProgram(0);
> +		if (prog != 0) {
> +			glDeleteProgram(prog);
> +			glUseProgram(0);
> +		} else {
> +			glDeleteProgramsARB(1, &prog);
> +		}
>  	}
>  
>  	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
> 

Wow.  Nasty.

Both link_and_use_shaders() [GLSL] and compile_and_bind_program() [ARB]
set prog to a non-zero value.  So at first glance this seems utterly bunk.
However, compile_and_bind_program() creates a local "GLuint prog" variable
that shadows the global one, so it never actually sets this.  Heh.

I was about to say this was correct.

However, I don't see anything actually initializing the global prog
variable to 0...so won't this be using an uninitialized value?  (As
would the existing code you patterned this after?)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20151111/65913145/attachment.sig>


More information about the Piglit mailing list