[Piglit] [PATCH] util: fix broken depth/stencil FBO setup

Jose Fonseca jfonseca at vmware.com
Fri Jun 15 00:36:02 PDT 2012


----- Original Message -----
> The call to glTexImage2D(internalFormat=GL_DEPTH_STENCIL,
> format=GL_RGBA,
> type=GL_UNSIGNED_BYTE) generated in invalid operation error since the
> formats disagreed.  The subsquent glFramebufferTexture2D() calls
> failed
> too.  And Mesa hit a failed assertion (ex: piglit drawpix-z -fbo).
> 
> Fixed by passing the correct format/type values to glTexImage2D.
> 
> Also, GL_DEPTH_STENCIL and GL_DEPTH_STENCIL_OES have the same value
> so
> remove the compile-time #if/#else.
> ---
>  tests/util/piglit-framework-fbo.c |   15 +++++----------
>  1 files changed, 5 insertions(+), 10 deletions(-)
> 
> diff --git a/tests/util/piglit-framework-fbo.c
> b/tests/util/piglit-framework-fbo.c
> index 37411e3..0444c37 100644
> --- a/tests/util/piglit-framework-fbo.c
> +++ b/tests/util/piglit-framework-fbo.c
> @@ -256,19 +256,14 @@ piglit_framework_fbo_gl_init()
>  			       0);
>  
>  	if (piglit_window_mode & (GLUT_DEPTH | GLUT_STENCIL)) {
> -		GLenum depth_stencil;
> -
> -#ifdef USE_OPENGL
> -		depth_stencil = GL_DEPTH_STENCIL;
> -#else
> -		depth_stencil = GL_DEPTH_STENCIL_OES;
> -#endif
> -
> +		/* Create a combined depth+stencil texture and attach it
> +		 * to the depth and stencil attachment points.
> +		 */
>  		glGenTextures(1, &depth);
>  		glBindTexture(GL_TEXTURE_2D, depth);
> -		glTexImage2D(GL_TEXTURE_2D, 0, depth_stencil,
> +		glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_STENCIL,
>  			     piglit_width, piglit_height, 0,
> -			     GL_RGBA, GL_UNSIGNED_BYTE, NULL);
> +			     GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, NULL);
>  		glFramebufferTexture2D(GL_FRAMEBUFFER,
>  				       GL_DEPTH_ATTACHMENT,
>  				       GL_TEXTURE_2D,

Reviewed-by: Jose Fonseca <jfonseca at vmware.com>

Jose


More information about the Piglit mailing list