mesa: fix a render to texture FBO validation bug

When glTexImage() is called we need to re-validate any FBOs that point to
the texture (i.e. render-to-texture) since changing the texture's size/format
will effect FBO completeness.

We don't keep a list of all FBOs rendering into each texture (which would be
a bit messy) so we check all FBOs in existance.  To optimize this, the
gl_texture_object->_RenderToTexture flag is used to avoid checking textures
that have never been used as renderbuffers.  So, we only walk over all FBOs
(there's usually only a few) when glTexImage() modifies a RTT texture.

Fixes a bug seen in shadowtex.c when toggling packed depth/stencil mode.
This commit is contained in:
Brian Paul
2009-01-29 09:20:18 -07:00
parent 425c803c03
commit 2897cee99f
3 changed files with 55 additions and 10 deletions

View File

@@ -1469,6 +1469,15 @@ framebuffer_texture(GLcontext *ctx, const char *caller, GLenum target,
if (texObj) {
_mesa_set_texture_attachment(ctx, fb, att, texObj, textarget,
level, zoffset);
/* Set the render-to-texture flag. We'll check this flag in
* glTexImage() and friends to determine if we need to revalidate
* any FBOs that might be rendering into this texture.
* This flag never gets cleared since it's non-trivial to determine
* when all FBOs might be done rendering to this texture. That's OK
* though since it's uncommon to render to a texture then repeatedly
* call glTexImage() to change images in the texture.
*/
texObj->_RenderToTexture = GL_TRUE;
}
else {
_mesa_remove_attachment(ctx, att);