From Michael Platings, "On nvidia cards mipmap generation for non-power-of-two textures with
GL_GENERATE_MIPMAP_SGIS is very slow (over half a second for a 720*576 texture). However, glGenerateMipmapEXT() performs well (16ms for the same texture), so I have modified the attached files to use Texture::generateMipmap() if glGenerateMipmapEXT is supported, instead of enabling & disabling GL_GENERATE_MIPMAP_SGIS." Notes, from Robert Osfield, I've tested the out of the previous path using GL_GENERATE_MIPMAP_SGIS and non power of two textures on NVidia 7800GT and Nvidia linux drivers with the image size 720x576 and only get compile times of 56ms, so the above half second speed looks to be a driver bug. With Muchael's changes the cost goes done to less than 5ms, so it's certainly an effective change, even given that Michael's poor expereiences with GL_GENERATE_MIP_SGIS do look to be a driver bug.
This commit is contained in:
@@ -344,24 +344,21 @@ void TextureCubeMap::copyTexSubImageCubeMap(State& state, int face, int xoffset,
|
||||
bool hardwareMipMapOn = false;
|
||||
if (needHardwareMipMap)
|
||||
{
|
||||
const Texture::Extensions* tex_extensions = Texture::getExtensions(contextID,true);
|
||||
bool generateMipMapSupported = tex_extensions->isGenerateMipMapSupported();
|
||||
|
||||
hardwareMipMapOn = _useHardwareMipMapGeneration && generateMipMapSupported;
|
||||
hardwareMipMapOn = isHardwareMipmapGenerationEnabled(state);
|
||||
|
||||
if (!hardwareMipMapOn)
|
||||
{
|
||||
// have to swtich off mip mapping
|
||||
notify(NOTICE)<<"Warning: TextureCubeMap::copyTexImage2D(,,,,) switch of mip mapping as hardware support not available."<<std::endl;
|
||||
// have to switch off mip mapping
|
||||
notify(NOTICE)<<"Warning: TextureCubeMap::copyTexImage2D(,,,,) switch off mip mapping as hardware support not available."<<std::endl;
|
||||
_min_filter = LINEAR;
|
||||
}
|
||||
}
|
||||
|
||||
if (hardwareMipMapOn) glTexParameteri( target, GL_GENERATE_MIPMAP_SGIS,GL_TRUE);
|
||||
GenerateMipmapMode mipmapResult = mipmapBeforeTexImage(state, hardwareMipMapOn);
|
||||
|
||||
glCopyTexSubImage2D( target , 0, xoffset, yoffset, x, y, width, height);
|
||||
|
||||
if (hardwareMipMapOn) glTexParameteri( target, GL_GENERATE_MIPMAP_SGIS,GL_FALSE);
|
||||
mipmapAfterTexImage(state, mipmapResult);
|
||||
|
||||
// inform state that this texture is the current one bound.
|
||||
state.haveAppliedTextureAttribute(state.getActiveTextureUnit(), this);
|
||||
|
||||
Reference in New Issue
Block a user