Browse Source

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.
tags/mesa_7_7_rc1
Eric Anholt 16 years ago
parent
commit
75bdbdd90b

+ 8
- 10
src/mesa/drivers/dri/intel/intel_fbo.c 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;
}



+ 1
- 0
src/mesa/drivers/dri/intel/intel_tex_obj.h 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 *

+ 6
- 1
src/mesa/drivers/dri/intel/intel_tex_validate.c 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);
}
}

Loading…
Cancel
Save