[Mesa-dev] [PATCH 02/13] mesa: use MAX3() macro for 3D texture in _mesa_test_texobj_completeness()

Brian Paul brianp at vmware.com
Mon Mar 19 13:56:23 PDT 2012


On 03/19/2012 12:29 PM, Kenneth Graunke wrote:
> On 03/18/2012 09:49 AM, Brian Paul wrote:
>> ---
>> src/mesa/main/texobj.c | 6 +++---
>> 1 files changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
>> index 5905948..def09e2 100644
>> --- a/src/mesa/main/texobj.c
>> +++ b/src/mesa/main/texobj.c
>> @@ -465,9 +465,9 @@ _mesa_test_texobj_completeness( const struct
>> gl_context *ctx,
>> maxLevels = ctx->Const.MaxTextureLevels;
>> }
>> else if (t->Target == GL_TEXTURE_3D) {
>> - GLint max = MAX2(t->Image[0][baseLevel]->WidthLog2,
>> - t->Image[0][baseLevel]->HeightLog2);
>> - maxLog2 = MAX2(max, (GLint)(t->Image[0][baseLevel]->DepthLog2));
>> + maxLog2 = MAX3(t->Image[0][baseLevel]->WidthLog2,
>> + t->Image[0][baseLevel]->HeightLog2,
>> + t->Image[0][baseLevel]->DepthLog2);
>> maxLevels = ctx->Const.Max3DTextureLevels;
>> }
>> else if (t->Target == GL_TEXTURE_CUBE_MAP_ARB) {
>
> Doesn't this need a (GLint) on DepthLog2 to avoid warnings? (I haven't
> tried it myself, but it seems like it would...)

I haven't seen any warnings (on Linux).  The MAX3() code is pretty 
much the same as the preceeding MAX2() code and no casts are used 
there.  The cast was needed before because we were comparing int/unsigned.

-Brian


More information about the mesa-dev mailing list