[Mesa-dev] [PATCH 2/2] swrast: check for null/-1 when mapping renderbuffers

Roland Scheidegger sroland at vmware.com
Mon Jan 20 08:16:21 PST 2014


Am 20.01.2014 17:07, schrieb Brian Paul:
> Fixes fbo-drawbuffers-none crash (but test still fails).
> https://urldefense.proofpoint.com/v1/url?u=https://bugs.freedesktop.org/show_bug.cgi?id%3D73757&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=F4msKE2WxRzA%2BwN%2B25muztFm5TSPwE8HKJfWfR2NgfY%3D%0A&m=NwAWyMUIHlva0Hyr49qYFUYZHuaGQC9RtQJg%2BNie8g0%3D%0A&s=bdbd75884c7f5caf0bed2245042a4002952f6e6ffecf7f2cdd55e7da4fa003cc
> ---
>  src/mesa/swrast/s_renderbuffer.c |   10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/src/mesa/swrast/s_renderbuffer.c b/src/mesa/swrast/s_renderbuffer.c
> index e3f33de..a19d02a 100644
> --- a/src/mesa/swrast/s_renderbuffer.c
> +++ b/src/mesa/swrast/s_renderbuffer.c
> @@ -659,8 +659,10 @@ _swrast_map_renderbuffers(struct gl_context *ctx)
>     }
>  
>     for (buf = 0; buf < fb->_NumColorDrawBuffers; buf++) {
> -      map_attachment(ctx, fb, fb->_ColorDrawBufferIndexes[buf]);
> -      find_renderbuffer_colortype(fb->_ColorDrawBuffers[buf]);
> +      if (fb->_ColorDrawBufferIndexes[buf] >= 0) {
> +         map_attachment(ctx, fb, fb->_ColorDrawBufferIndexes[buf]);
> +         find_renderbuffer_colortype(fb->_ColorDrawBuffers[buf]);
> +      }
>     }
>  }
>   
> @@ -688,6 +690,8 @@ _swrast_unmap_renderbuffers(struct gl_context *ctx)
>     }
>  
>     for (buf = 0; buf < fb->_NumColorDrawBuffers; buf++) {
> -      unmap_attachment(ctx, fb, fb->_ColorDrawBufferIndexes[buf]);
> +      if (fb->_ColorDrawBufferIndexes[buf] >= 0) {
> +         unmap_attachment(ctx, fb, fb->_ColorDrawBufferIndexes[buf]);
> +      }
>     }
>  }
> 

For the series:
Reviewed-by: Roland Scheidegger <sroland at vmware.com>


More information about the mesa-dev mailing list