<div dir="ltr"><div dir="ltr"><div dir="ltr"><div>I'm currently implementing mipmaps but I have a set of troubles guessing the block height and block depth of them. According to <a href="https://envytools.readthedocs.io/en/latest/hw/memory/g80-surface.html#textures-mipmapping-and-arrays">https://envytools.readthedocs.io/en/latest/hw/memory/g80-surface.html#textures-mipmapping-and-arrays</a> the texture unit auto resizes mipmaps' blocks but how do I know how many blocks each one uses?</div><div><br></div><div>I'm currently using this algorithm:</div><div><div>        u32 height = MipHeight(mip_level);</div><div>        u32 gobs_in_y = (height + 7) / 8;</div><div>        u32 bh = block_height;</div><div>        // Magical block resizing algorithm, needs more testing.</div><div>        while (bh > 1 && (gobs_in_y + bh - 1) / bh <= 2) {</div><div>            bh >>= 1;</div><div>        }</div><div>        return bh;</div></div><div>it works 95% of the time but doesn't fit the correct block size all the time. Do you guys got any info on the correct algorithm used?</div><div dir="ltr" class="gmail_signature"><div dir="ltr"></div></div></div></div></div>