I will first describe my setup:
1. create a 2D texture (1024x1024) and bind it
2. set both GL_TEXTURE_MIN_FILTER and GL_TEXTURE_MAX_FILTER to GL_LINEAR
3. render something to it using an FBO
4. unbind the texture from the FBO
5. change its MIN_FILTER to be LINEAR_MIPMAP_LINEAR
6. call glGenerateMipmaps
7. draw the texture to the screen
8. delete the texture
important note: this is done every frame.
Now the question: is this allowed by OpenGL? (changing the MIN_FILTER to a mode that requires mipmap levels that were not allocated before the first "use"?) I've searched the spec but could not find anything specified against it so I guess it should be allowed. Anybody with more OpenGL knowledge may say otherwise?
I have made a small program to test this setup and ran it on a NVidia GPU and an ATI GPU, both with latest drivers.
On the NVidia GPU the application worked fine, but on the ATI one it consistently crashes (I used error checking all over the place and got no error from the GL). If I call glGenerateMipmaps before first texture use (even if this is not needed as the minification filter is set to LINEAR) everything works fine on the ATI GPU.
thank you for any help clearing this out!
PS: this scenario was deliberately made like this to reproduce a crash we are getting in our software with ATI hardware (the application applies a series of shaders to a chain of textures and only one undetermined texture should be displayed so we can't decide from the beginning which texture should have its mipmap levels allocated).