medfall

A super great game engine
Log | Files | Refs

commit fea1122dfe23c5cb28e8b901071643933b7c1550
parent 4c8c849ad74a77037517b53a36ff926271106f27
Author: Michael Savage <mikejsavage@gmail.com>
Date:   Sat, 27 Oct 2018 12:24:35 +0300

Simplify mipmap_levels

Diffstat:
renderer.cc | 4+++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/renderer.cc b/renderer.cc @@ -827,7 +827,9 @@ static u32 mipmap_dim( u32 dim, u32 level ) { // TODO: use clz static u32 mipmap_levels( u32 width, u32 height ) { u32 levels = 1; - while( mipmap_dim( width, levels ) > 1 || mipmap_dim( height, levels ) > 1 ) { + u32 dim = max( width, height ); + while( dim > 1 ) { + dim >>= 1; levels++; } return levels;