diff options
author | Eric Anholt <eric@anholt.net> | 2011-05-31 15:07:56 -0700 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2011-06-13 15:56:36 -0700 |
commit | d29117752f10d9bcb61e7b26064a872017a64ebe (patch) | |
tree | 4c78534c45592d0b5f063d8a97f726c92f66cfaf | |
parent | b17aab5753a6d14c9e757bedb186963b2dae8823 (diff) |
intel: Clean up intel_render_texture with a rename and a helper function.
The "newImage" isn't particularly new -- it might be the same texture
that was attached to the same attachment point before. This function
also gets called when just rebinding back to an FBO with a texture
attachment.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad@chad-versace.us>
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_fbo.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c index 3e7e0b9a24..591df41020 100644 --- a/src/mesa/drivers/dri/intel/intel_fbo.c +++ b/src/mesa/drivers/dri/intel/intel_fbo.c @@ -579,16 +579,12 @@ intel_render_texture(struct gl_context * ctx, struct gl_framebuffer *fb, struct gl_renderbuffer_attachment *att) { - struct gl_texture_image *newImage - = att->Texture->Image[att->CubeMapFace][att->TextureLevel]; + struct gl_texture_image *image = _mesa_get_attachment_teximage(att); struct intel_renderbuffer *irb = intel_renderbuffer(att->Renderbuffer); - struct intel_texture_image *intel_image; + struct intel_texture_image *intel_image = intel_texture_image(image); (void) fb; - ASSERT(newImage); - - intel_image = intel_texture_image(newImage); if (!intel_image->mt) { /* Fallback on drawing to a texture that doesn't have a miptree * (has a border, width/height 0, etc.) @@ -598,7 +594,7 @@ intel_render_texture(struct gl_context * ctx, return; } else if (!irb) { - irb = intel_wrap_texture(ctx, newImage); + irb = intel_wrap_texture(ctx, image); if (irb) { /* bind the wrapper to the attachment point */ _mesa_reference_renderbuffer(&att->Renderbuffer, &irb->Base); @@ -610,7 +606,7 @@ intel_render_texture(struct gl_context * ctx, } } - if (!intel_update_wrapper(ctx, irb, newImage)) { + if (!intel_update_wrapper(ctx, irb, image)) { _mesa_reference_renderbuffer(&att->Renderbuffer, NULL); _swrast_render_texture(ctx, fb, att); return; @@ -618,7 +614,7 @@ intel_render_texture(struct gl_context * ctx, DBG("Begin render texture tid %lx tex=%u w=%d h=%d refcount=%d\n", _glthread_GetID(), - att->Texture->Name, newImage->Width, newImage->Height, + att->Texture->Name, image->Width, image->Height, irb->Base.RefCount); intel_renderbuffer_set_draw_offset(irb, intel_image, att->Zoffset); @@ -644,7 +640,7 @@ intel_render_texture(struct gl_context * ctx, texel_bytes = _mesa_get_format_bytes(intel_image->base.TexFormat); - new_mt = intel_miptree_create(intel, newImage->TexObject->Target, + new_mt = intel_miptree_create(intel, image->TexObject->Target, intel_image->base._BaseFormat, intel_image->base.InternalFormat, intel_image->level, |