[Mesa-dev] [PATCH 1/3] mesa: Only end render-to-texture at bind time for drawbuffers.

Brian Paul brianp at vmware.com
Fri Feb 10 15:19:14 PST 2012


On 02/10/2012 03:53 PM, Eric Anholt wrote:
> If we're only starting for new draw buffers, why would we end for old
> read buffers along with draw buffers?
> ---
>   src/mesa/main/fbobject.c |    7 ++-----
>   1 files changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
> index 987d687..64c3393 100644
> --- a/src/mesa/main/fbobject.c
> +++ b/src/mesa/main/fbobject.c
> @@ -1758,11 +1758,8 @@ _mesa_BindFramebufferEXT(GLenum target, GLuint framebuffer)
>      if (bindDrawBuf) {
>         FLUSH_VERTICES(ctx, _NEW_BUFFERS);
>
> -      /* check if old read/draw buffers were render-to-texture */
> -      if (!bindReadBuf)
> -         check_end_texture_render(ctx, oldReadFb);
> -
> -      if (oldDrawFb != oldReadFb)
> +      /* check if old framebuffer had any texture attachments */
> +      if (oldDrawFb)
>            check_end_texture_render(ctx, oldDrawFb);
>
>         /* check if newly bound framebuffer has any texture attachments */

This looks OK to me, but it's one of those things that deserves a lot 
of testing.

FWIW, I've never been totally happy with the 
ctx->Driver.RenderTexture() and FinishRenderTexture() hooks.  It's 
been hard to concisely define when RTT starts and stops.

Maybe we should just have a driver hook to create a renderbuffer that 
wraps a texture slice when glFrameBufferTexture() is called.  Then, 
leave it up to the driver to figure out the rest at draw-validation time.

-Brian


More information about the mesa-dev mailing list