[Mesa-dev] [PATCH 1/2] meta: use _mesa_set_enable(), fix decompress_texture_image()

Brian Paul brianp at vmware.com
Tue Sep 20 12:12:16 PDT 2011


On 09/20/2011 01:05 PM, Eric Anholt wrote:
> On Tue, 20 Sep 2011 11:56:49 -0600, Brian Paul<brian.e.paul at gmail.com>  wrote:
>> From: Brian Paul<brianp at vmware.com>
>>
>> Use _mesa_set_enable() to avoid a redudant context lookup.
>> Need to disable the texture target in decompress_texture_image() so the
>> unit isn't still enabled after glGetTexImage() returns.  Arguably, the
>> meta restore code should do this, but it doesn't.
>> ---
>>   src/mesa/drivers/common/meta.c |    5 ++++-
>>   1 files changed, 4 insertions(+), 1 deletions(-)
>>
>> diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
>> index 82b072e..be1953a 100644
>> --- a/src/mesa/drivers/common/meta.c
>> +++ b/src/mesa/drivers/common/meta.c
>> @@ -3182,7 +3182,7 @@ decompress_texture_image(struct gl_context *ctx,
>>
>>      /* setup texture state */
>>      _mesa_BindTexture(target, texObj->Name);
>> -   _mesa_Enable(target);
>> +   _mesa_set_enable(ctx, target, GL_TRUE);
>>
>>      {
>>         /* save texture object state */
>> @@ -3233,6 +3233,9 @@ decompress_texture_image(struct gl_context *ctx,
>>      ctx->Pack.RowLength = destRowLength;
>>      _mesa_ReadPixels(0, 0, width, height, destFormat, destType, dest);
>>
>> +   /* disable texture unit */
>> +   _mesa_set_enable(ctx, target, GL_FALSE);
>> +
>>      _mesa_meta_end(ctx);
>
> It's always confused me that the dispatch doesn't pass the context in to
> the _mesa_[A-Z].* functions itself, and that we have to prefix seemingly
> each of those with GET_CURRENT_CONTEXT(ctx).

The idea is that we can use a little assembly code to lookup the 
current dispatch table, then jump right through it without having to 
construct a new stack frame.


> On the other hand, this series seems like an obvious little
> improvement for now.

I'll take that to mean Reviewed-by.  Thanks.

-Brian


More information about the mesa-dev mailing list