[osg-submissions] Fix for very slow mipmap generation

Robert Osfield robert.osfield at gmail.com
Wed May 28 03:04:57 PDT 2008


Hi Michael,

I've created a 720x576 image and have been testing this and timing the
cost of the Texture::compile for various power of two images and now
power of two image, with both non power of two texture support and
using glu to rescale to power of two and found some interesting
results.


Origina code:

Speed of Texture::compile    Test
58ms                                    720x576 image,
texture->setResizeNonPowerOfTwoHint(false);
72ms                                    720x576 image,
texture->setResizeNonPowerOfTwoHint(true); // default path

Your code:

Speed of Texture::compile    Test
4.8ms                                   720x576 image,
texture->setResizeNonPowerOfTwoHint(false);
75ms                                    720x576 image,
texture->setResizeNonPowerOfTwoHint(true); // default path

Two observations, my system is much faster than yours for doing
compile, be it using your code, or mine, when using non power two
texture or not.   Perhaps your timing code was done differently - I
just timed the Texture::compile().

Second observation, the cost of glGenerateMipMap is far better for non
power to two textures, but slower for power of two data, not by much,
but consistently slower.

Third observation, the old code with non power of two texture performs
better than the rescaled to power of two, something that is way
different from your experience - you said it's taking half a second do
what is taking 1/10th the time on my system.  This suggests to me a
driver bug.

What hardware/OS are you working on?

Regardless of the driver bug, your changes make a significant
improvement to mipmapp with now power of two textures so is certainly
a worthy addition to the OSG so I'm merging.  However, I'm unhappy
with the default path being slower than before - this should be
fixable, perhaps by checking for power of two size and then using the
old paths.

Robert.


More information about the osg-submissions mailing list