diff options
author | Eric Anholt <[email protected]> | 2009-11-04 14:54:09 -0800 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2009-11-06 11:37:32 -0800 |
commit | 75bdbdd90b15c8704d87ca195a364ff6a42edbb1 (patch) | |
tree | 094ceea5dffc1057641e2488944df20a111e234c | |
parent | 6b68482e6869bdc03339ef5380d7273e14a61a56 (diff) |
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.
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_fbo.c | 18 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_tex_obj.h | 1 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_tex_validate.c | 7 |
3 files changed, 15 insertions, 11 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c index d8ac4d36637..5615040946f 100644 --- a/src/mesa/drivers/dri/intel/intel_fbo.c +++ b/src/mesa/drivers/dri/intel/intel_fbo.c @@ -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; } diff --git a/src/mesa/drivers/dri/intel/intel_tex_obj.h b/src/mesa/drivers/dri/intel/intel_tex_obj.h index 5a934615259..3ad10d3d238 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_obj.h +++ b/src/mesa/drivers/dri/intel/intel_tex_obj.h @@ -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 * diff --git a/src/mesa/drivers/dri/intel/intel_tex_validate.c b/src/mesa/drivers/dri/intel/intel_tex_validate.c index dbef2886159..c9a24ac3983 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_validate.c +++ b/src/mesa/drivers/dri/intel/intel_tex_validate.c @@ -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); } } |