[Mesa-dev] [PATCH] st/mesa: fix incorrect buffer token passed to _mesa_BindFramebuffer()

Jose Fonseca jfonseca at vmware.com
Tue Jan 12 03:04:45 PST 2016


On 12/01/16 01:24, Brian Paul wrote:
> I added this code right at the end, and got it wrong.
> Only used by the WGL_ARB_render_texture code.
> ---
>   src/mesa/state_tracker/st_copytex.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/mesa/state_tracker/st_copytex.c b/src/mesa/state_tracker/st_copytex.c
> index d246d8b..4e0fd79 100644
> --- a/src/mesa/state_tracker/st_copytex.c
> +++ b/src/mesa/state_tracker/st_copytex.c
> @@ -59,7 +59,7 @@ st_copy_framebuffer_to_texture(GLenum srcBuffer,
>      _mesa_GetIntegerv(GL_READ_BUFFER, &readBufSave);
>
>      /* Read from the winsys buffer */
> -   _mesa_BindFramebuffer(GL_READ_BUFFER, 0);
> +   _mesa_BindFramebuffer(GL_READ_FRAMEBUFFER, 0);
>      _mesa_ReadBuffer(srcBuffer);
>
>      /* copy image from pbuffer to texture */
> @@ -136,5 +136,5 @@ st_copy_framebuffer_to_texture(GLenum srcBuffer,
>
>      /* restore readbuffer */
>      _mesa_ReadBuffer(readBufSave);
> -   _mesa_BindFramebuffer(GL_READ_BUFFER, readFBOSave);
> +   _mesa_BindFramebuffer(GL_READ_FRAMEBUFFER, readFBOSave);
>   }

Ah. If OpenGL hadn't used a single GLenum for all parameters, the C 
compiler type checking would have caught this. And the fact that all 
these enums look so much alike makes it even worse to spot.

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


More information about the mesa-dev mailing list