diff options
author | Brian Paul <[email protected]> | 2006-03-20 18:51:57 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2006-03-20 18:51:57 +0000 |
commit | 519b23b21f9cd6945fd17cdb26e7a6f531cdeec0 (patch) | |
tree | cad1402052d00a0e4140454baa07746336019a75 /src/mesa/main/texrender.c | |
parent | 4991888fa0ea8e31e3cd2a0d87bb7e205ad1dccd (diff) |
Lots of changes/fixes for rendering to framebuffer objects.
- When deleting texture objects, unbind from FBOs if necessary.
- Changed driver hooks for starting/ending render to texture.
- Now properly handle case where gl[Copy]TexImage() is called after
glFramebufferTexture[123]D(). That didn't work before.
Diffstat (limited to 'src/mesa/main/texrender.c')
-rw-r--r-- | src/mesa/main/texrender.c | 49 |
1 files changed, 34 insertions, 15 deletions
diff --git a/src/mesa/main/texrender.c b/src/mesa/main/texrender.c index a4efe640382..dca93a1c04a 100644 --- a/src/mesa/main/texrender.c +++ b/src/mesa/main/texrender.c @@ -200,25 +200,44 @@ wrap_texture(GLcontext *ctx, struct gl_renderbuffer_attachment *att) /** - * Software fallback for ctx->Driver.RenderbufferTexture. - * This is called via the glRenderbufferTexture1D/2D/3D() functions. - * If we're unbinding a texture, texObj will be NULL. - * The framebuffer of interest is ctx->DrawBuffer. + * Called when rendering to a texture image begins. + * This is a fallback routine for software render-to-texture. + * + * Called via the glRenderbufferTexture1D/2D/3D() functions + * and elsewhere (such as glTexImage2D). + * + * The image we're rendering into is + * att->Texture->Image[att->CubeMapFace][att->TextureLevel]; + * It'll never be NULL. + * + * \param fb the framebuffer object the texture is being bound to + * \param att the fb attachment point of the texture + * * \sa _mesa_framebuffer_renderbuffer */ void _mesa_renderbuffer_texture(GLcontext *ctx, - struct gl_renderbuffer_attachment *att, - struct gl_texture_object *texObj, - GLenum texTarget, GLuint level, GLuint zoffset) + struct gl_framebuffer *fb, + struct gl_renderbuffer_attachment *att) { - if (texObj) { - _mesa_set_texture_attachment(ctx, att, texObj, - texTarget, level, zoffset); - if (!att->Renderbuffer) - wrap_texture(ctx, att); - } - else { - _mesa_remove_attachment(ctx, att); + struct gl_texture_image *newImage + = att->Texture->Image[att->CubeMapFace][att->TextureLevel]; + struct texture_renderbuffer *trb + = (struct texture_renderbuffer *) att->Renderbuffer; + struct gl_texture_image *oldImage = trb ? trb->TexImage : NULL; + + (void) fb; + + ASSERT(newImage); + + if (oldImage != newImage) { + if (trb) { + /* get rid of old wrapper */ + /* XXX also if Zoffset changes? */ + trb->Base.Delete(&trb->Base); + } + wrap_texture(ctx, att); } } + + |