Peter Clifton wrote:
On Wed, 2009-09-30 at 00:32 +0100, Peter Clifton wrote:

[snip]

After a bit of a false lead, I finally tracked the behaviour change to:

50d8b295f6c950da3b8783ff6e1803bdfbb5c7cc is first bad commit
commit 50d8b295f6c950da3b8783ff6e1803bdfbb5c7cc
Author: Brian Paul <bri...@vmware.com>
Date:   Tue Sep 1 12:05:41 2009 -0600

    intel: use _mesa_meta_clear(), it's a bit faster

:040000 040000 81f24fd1186fda701bd343d7e3c4428c10494477
40f6ebb2f756d7054fb2ea940183bc8ad5154ed0 M      src

[snip]

Reverting the change from the old meta-ops code fixes the issue on
master, but I can't determine any real differences between the old / new
code.

One clue I managed to find though..

[snip]

The attached diff "fixes" the issue for me. Does this yield any clues as
to the source of the problem?

We've had some bugs related to VBO data replacement and glDrawArrays but I thought Eric had fixed the last of them.

Strictly speaking, we should get better performance by using a new VBO for each draw, but in my measurements it was actually a little faster to re-use VBOs on i965. Probably misc overhead.

(I've still not had any chance to distil a test-case yet, and will be
away the rest of the week!)

Do you have time to test the attached patch (a clean-up of your patch basically)?

-Brian
diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index a152087..a9953aa 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -216,7 +216,6 @@ struct blit_state
 struct clear_state
 {
    GLuint ArrayObj;
-   GLuint VBO;
 };
 
 
@@ -318,7 +317,6 @@ _mesa_meta_free(GLcontext *ctx)
       _mesa_DeletePrograms(1, &meta->Blit.DepthFP);
 
       /* glClear */
-      _mesa_DeleteBuffersARB(1, & meta->Clear.VBO);
       _mesa_DeleteVertexArraysAPPLE(1, &meta->Clear.ArrayObj);
 
       /* glCopyPixels */
@@ -1216,6 +1214,7 @@ _mesa_meta_Clear(GLcontext *ctx, GLbitfield buffers)
    struct vertex verts[4];
    /* save all state but scissor, pixel pack/unpack */
    GLbitfield metaSave = META_ALL - META_SCISSOR - META_PIXEL_STORE;
+   GLuint vbo;
 
    if (buffers & BUFFER_BITS_COLOR) {
       /* if clearing color buffers, don't save/restore colormask */
@@ -1224,30 +1223,6 @@ _mesa_meta_Clear(GLcontext *ctx, GLbitfield buffers)
 
    _mesa_meta_begin(ctx, metaSave);
 
-   if (clear->ArrayObj == 0) {
-      /* one-time setup */
-
-      /* create vertex array object */
-      _mesa_GenVertexArrays(1, &clear->ArrayObj);
-      _mesa_BindVertexArray(clear->ArrayObj);
-
-      /* create vertex array buffer */
-      _mesa_GenBuffersARB(1, &clear->VBO);
-      _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, clear->VBO);
-      _mesa_BufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(verts),
-                          NULL, GL_DYNAMIC_DRAW_ARB);
-
-      /* setup vertex arrays */
-      _mesa_VertexPointer(3, GL_FLOAT, sizeof(struct vertex), OFFSET(x));
-      _mesa_ColorPointer(4, GL_FLOAT, sizeof(struct vertex), OFFSET(r));
-      _mesa_EnableClientState(GL_VERTEX_ARRAY);
-      _mesa_EnableClientState(GL_COLOR_ARRAY);
-   }
-   else {
-      _mesa_BindVertexArray(clear->ArrayObj);
-      _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, clear->VBO);
-   }
-
    /* GL_COLOR_BUFFER_BIT */
    if (buffers & BUFFER_BITS_COLOR) {
       /* leave colormask, glDrawBuffer state as-is */
@@ -1309,14 +1284,32 @@ _mesa_meta_Clear(GLcontext *ctx, GLbitfield buffers)
          verts[i].b = ctx->Color.ClearColor[2];
          verts[i].a = ctx->Color.ClearColor[3];
       }
+   }
 
-      /* upload new vertex data */
-      _mesa_BufferSubDataARB(GL_ARRAY_BUFFER_ARB, 0, sizeof(verts), verts);
+   if (clear->ArrayObj == 0) {
+      /* one-time setup - create vertex array object, enable arrays */
+      _mesa_GenVertexArrays(1, &clear->ArrayObj);
+      _mesa_BindVertexArray(clear->ArrayObj);
+      _mesa_EnableClientState(GL_VERTEX_ARRAY);
+      _mesa_EnableClientState(GL_COLOR_ARRAY);
    }
+   else {
+      _mesa_BindVertexArray(clear->ArrayObj);
+   }
+
+   /* create vertex buffer object, load data, setup arrays */
+   _mesa_GenBuffersARB(1, &vbo);
+   _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, vbo);
+   _mesa_BufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(verts), verts,
+                       GL_STATIC_DRAW_ARB);
+   _mesa_VertexPointer(3, GL_FLOAT, sizeof(struct vertex), OFFSET(x));
+   _mesa_ColorPointer(4, GL_FLOAT, sizeof(struct vertex), OFFSET(r));
 
    /* draw quad */
    _mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4);
 
+   _mesa_DeleteBuffersARB(1, &vbo);
+
    _mesa_meta_end(ctx);
 }
 
------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Mesa3d-dev mailing list
Mesa3d-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Reply via email to