[Mesa-dev] [PATCH 2/6] swrast: don't modify immutable textures

Brian Paul brianp at vmware.com
Fri May 4 07:15:39 PDT 2012


On 05/02/2012 11:05 AM, nobled wrote:
> ---
>   src/mesa/drivers/dri/swrast/swrast.c |    6 ++++++
>   1 files changed, 6 insertions(+), 0 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/swrast/swrast.c
> b/src/mesa/drivers/dri/swrast/swrast.c
> index 22d71bf..70bbcb8 100644
> --- a/src/mesa/drivers/dri/swrast/swrast.c
> +++ b/src/mesa/drivers/dri/swrast/swrast.c
> @@ -84,6 +84,12 @@ static void swrastSetTexBuffer2(__DRIcontext
> *pDRICtx, GLint target,
>
>       _mesa_lock_texture(&dri_ctx->Base, texObj);
>
> +    if (texObj->Immutable) {
> +        driWarnImmutableTexture(&dri_ctx->Base, texObj->Name);
> +        _mesa_unlock_texture(&dri_ctx->Base, texObj);
> +        return;
> +    }
> +
>       sPriv->swrast_loader->getDrawableInfo(dPriv,&x,&y,&w,&h,
> dPriv->loaderPrivate);
>
>       if (texture_format == __DRI_TEXTURE_FORMAT_RGB)

In these patches I think we could get away with checking if 
texObj->Immutable before calling _mesa_lock_texture().  Then you 
wouldn't need the _mesa_unlock_texture() call on the error path.

-Brian


More information about the mesa-dev mailing list