intel: Don't validate in a texture image used as a render target.

Otherwise, we could lose track of rendering to that image, which could
easily happen during mipmap generation.
This commit is contained in:
Eric Anholt 2009-11-04 14:54:09 -08:00
parent 6b68482e68
commit 75bdbdd90b
3 changed files with 15 additions and 11 deletions

View file

@ -577,6 +577,7 @@ intel_render_texture(GLcontext * ctx,
dst_x) * intel_image->mt->cpp;
intel_image->mt->region->draw_x = dst_x;
intel_image->mt->region->draw_y = dst_y;
intel_image->used_as_render_target = GL_TRUE;
/* update drawing region, etc */
intel_draw_buffer(ctx, fb);
@ -590,16 +591,13 @@ static void
intel_finish_render_texture(GLcontext * ctx,
struct gl_renderbuffer_attachment *att)
{
/* no-op
* Previously we released the renderbuffer's intel_region but
* that's not necessary and actually caused problems when trying
* to do a glRead/CopyPixels from the renderbuffer later.
* The region will be released later if the texture is replaced
* or the renderbuffer deleted.
*
* The intention of this driver hook is more of a "done rendering
* to texture, please re-twiddle/etc if necessary".
*/
struct gl_texture_object *tex_obj = att->Texture;
struct gl_texture_image *image =
tex_obj->Image[att->CubeMapFace][att->TextureLevel];
struct intel_texture_image *intel_image = intel_texture_image(image);
/* Flag that this image may now be validated into the object's miptree. */
intel_image->used_as_render_target = GL_FALSE;
}

View file

@ -66,6 +66,7 @@ struct intel_texture_image
* Else there is no image data.
*/
struct intel_mipmap_tree *mt;
GLboolean used_as_render_target;
};
static INLINE struct intel_texture_object *

View file

@ -222,8 +222,13 @@ intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit)
intel_texture_image(intelObj->base.Image[face][i]);
/* Need to import images in main memory or held in other trees.
* If it's a render target, then its data isn't needed to be in
* the object tree (otherwise we'd be FBO incomplete), and we need
* to keep track of the image's MT as needing to be pulled in still,
* or we'll lose the rendering that's done to it.
*/
if (intelObj->mt != intelImage->mt) {
if (intelObj->mt != intelImage->mt &&
!intelImage->used_as_render_target) {
copy_image_data_to_tree(intel, intelObj, intelImage);
}
}