When using generated mip-maps (via GL_GENERATE_MIPMAP), glTexSubImage2D does not work correctly (sometimes clearing the texture before updating the sub-region, or producing other odd behaviour). This seems to occasionally affect the GL state of subsequently launched applications too, but I have no 100% reproducible test-case for this.
Attached is a demo app that exhibits this error. It creates a blue 512x512 texture with GL_GEN_TEXTURES set to true and displays this in the centre of the window. When you press the space bar, it updates a sub-region of that texture with a fully opaque red texture. This red sub-texture is treated as if it wasn't fully opaque.
If you build it with NO_MIPMAP defined, it will not use GL_GEN_TEXTURES and work correctly. Running this on nvidia hardware with the binary nvidia drivers works correctly.
The failure behaviour is not consistent, more complex test-cases produce different failures. Text in Clutter (http://clutter-project.org/) for example, disappears, as at some point, a sub-region update clears the entire glyph-cache texture to black.
I'm running mesa checked out on 7th August 2008, I've not seen any commit logs that look like they fixed this feature since then.
Created attachment 18217 [details]
This test-case exhibits the described bug
Just a note, I obviously meant GL_GENERATE_MIPMAP, not GL_GEN_TEXTURES in the second and third paragraphs.
The part about text disappearing caught my attention, as I'm experiencing the same issue in World of Warcraft (opengl mode) with mesa 7.1 while it was working fine with mesa 7.0. I tried a bisection, but the git repository is a bit of a mess due to various DRM changes for the intel driver between the two versions, so I couldn't pinpoint the bad commit.
Anyway, I have tried your testcase. It works fine with mesa 7.0, but the red square is not opaque with mesa 7.1, as you describe.
The other mipmap levels aren't being updated on the first subimage call, though they get updated on subsequent ones. The transparent effect is just that you're blending two mipmap levels in the rendering. I'm cooking up a piglit regression test and then I'll fix the issue.
Fixed in master, and regression test (gen-texsubimage) added to piglit. Thanks for the easy-to-reproduce testcase!
Thanks, this is fixed, but I still see the bug with text in Clutter... I'm trying to produce another test-case that shows this regression.
Mass version move, cvs -> git