[Mesa-dev] [PATCH 09/11] meta: Drop the src == dst restriction on meta glBlitFramebuffer().

Eric Anholt eric at anholt.net
Wed Feb 5 17:20:12 PST 2014


>From the GL_ARB_fbo spec:

    If the source and destination buffers are identical, and the
    source and destination rectangles overlap, the result of the blit
    operation is undefined.

As far as I know, that's the only thing that would have been of concern
for this.
---
 src/mesa/drivers/common/meta_blit.c | 24 +-----------------------
 1 file changed, 1 insertion(+), 23 deletions(-)

diff --git a/src/mesa/drivers/common/meta_blit.c b/src/mesa/drivers/common/meta_blit.c
index 973ee1b..9c3ff9b 100644
--- a/src/mesa/drivers/common/meta_blit.c
+++ b/src/mesa/drivers/common/meta_blit.c
@@ -267,8 +267,7 @@ setup_glsl_blit_framebuffer(struct gl_context *ctx,
  * Try to do a color-only glBlitFramebuffer using texturing.
  *
  * We can do this when the src renderbuffer is actually a texture, or when the
- * driver expposes BindRenderbufferTexImage().  But if the src buffer == dst
- * buffer we cannot do this.
+ * driver expposes BindRenderbufferTexImage().
  */
 static bool
 blitframebuffer_texture(struct gl_context *ctx,
@@ -277,9 +276,7 @@ blitframebuffer_texture(struct gl_context *ctx,
                         GLenum filter, GLint flipX, GLint flipY,
                         GLboolean glsl_version)
 {
-   const struct gl_framebuffer *drawFb = ctx->DrawBuffer;
    const struct gl_framebuffer *readFb = ctx->ReadBuffer;
-   const struct gl_renderbuffer_attachment *drawAtt;
    const struct gl_renderbuffer_attachment *readAtt =
       &readFb->Attachment[readFb->_ColorReadBufferIndex];
    struct blit_state *blit = &ctx->Meta->Blit;
@@ -295,7 +292,6 @@ blitframebuffer_texture(struct gl_context *ctx,
    GLuint sampler, samplerSave =
       ctx->Texture.Unit[ctx->Texture.CurrentUnit].Sampler ?
       ctx->Texture.Unit[ctx->Texture.CurrentUnit].Sampler->Name : 0;
-   int i;
    GLuint tempTex = 0;
 
    if (readAtt && readAtt->Texture) {
@@ -346,24 +342,6 @@ blitframebuffer_texture(struct gl_context *ctx,
    baseLevelSave = texObj->BaseLevel;
    maxLevelSave = texObj->MaxLevel;
 
-   /* Iterate through all draw buffers */
-   for (i = 0; i < ctx->DrawBuffer->_NumColorDrawBuffers; i++) {
-      int idx = ctx->DrawBuffer->_ColorDrawBufferIndexes[i];
-      if (idx == -1)
-         continue;
-      drawAtt = &drawFb->Attachment[idx];
-
-      if (drawAtt->Texture == readAtt->Texture) {
-         /* Can't use same texture as both the source and dest.  We need
-          * to handle overlapping blits and besides, some hw may not
-          * support this.
-          */
-         if (tempTex)
-            _mesa_DeleteTextures(1, &tempTex);
-         return false;
-      }
-   }
-
    /* Choose between glsl version and fixed function version of
     * BlitFramebuffer function.
     */
-- 
1.9.rc1



More information about the mesa-dev mailing list