Roland Scheidegger wrote:
> On 22.11.2008 02:00, Brian Paul wrote:
>> Philipp Klaus Krause wrote:
>>> In _mesa_compressed_texture_size(), texcompress.c there's lots of code
>>> similar to the following:
>>>
>>> case MESA_FORMAT_RGBA_DXT1:
>>>       /* round up width, height to next multiple of 4 */
>>>       width = (width + 3) & ~3;
>>>       height = (height + 3) & ~3;
>>>       /* 8 bytes per 4x4 tile of RGB[A] texels */
>>>       size = width * height / 2;
>>>       /* Textures smaller than 4x4 will effectively be made into 4x4 and
>>>        * take 8 bytes.
>>>        */
>>>       if (size < 8)
>>>          size = 8;
>>>       return size;
>>>
>>> What's the purpose of the if (size < 8) size = 8;? It seems redundant to me.
>> IIRC, all DTX blocks are 4x4 texels in size and each such block is 
>> represented by 8 bytes.  Images smaller than 4x4 pixels are still stored 
>> in 8-byte 4x4 blocks so we need to allocate that minimum amount of memory.
>>
>> -Brian
> 
> I think the question was why it would be necessary to explicitly round
> up the calculated size to 8, since width and height are rounded up
> already and hence size can't be smaller than 8 anyway (unless height or
> width would be zero, that is).

Call it an oversight, or defensive programming. :)

-Brian


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Mesa3d-dev mailing list
Mesa3d-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Reply via email to