Merge branch 'mesa_7_6_branch'
authorBrian Paul <brianp@vmware.com>
Tue, 22 Sep 2009 22:06:18 +0000 (16:06 -0600)
committerBrian Paul <brianp@vmware.com>
Tue, 22 Sep 2009 22:06:18 +0000 (16:06 -0600)
1  2 
src/mesa/drivers/common/meta.c

index 532b2c926359ca7ec5b9330947ba9d18e57758dc,2741a41bf395e3e80538d2ed7fa006a41667f6d7..21756786c54e8fc6aa1e3d1286a025e6be5b9fea
@@@ -1698,30 -1518,47 +1673,45 @@@ _mesa_meta_DrawPixels(GLcontext *ctx
        const GLfloat y1 = y + height * ctx->Pixel.ZoomY;
        const GLfloat z = ctx->Current.RasterPos[2];
  
 -      verts[0][0] = x0;
 -      verts[0][1] = y0;
 -      verts[0][2] = z;
 -      verts[0][3] = 0.0F;
 -      verts[0][4] = 0.0F;
 -      verts[1][0] = x1;
 -      verts[1][1] = y0;
 -      verts[1][2] = z;
 -      verts[1][3] = tex->Sright;
 -      verts[1][4] = 0.0F;
 -      verts[2][0] = x1;
 -      verts[2][1] = y1;
 -      verts[2][2] = z;
 -      verts[2][3] = tex->Sright;
 -      verts[2][4] = tex->Ttop;
 -      verts[3][0] = x0;
 -      verts[3][1] = y1;
 -      verts[3][2] = z;
 -      verts[3][3] = 0.0F;
 -      verts[3][4] = tex->Ttop;
 +      verts[0].x = x0;
 +      verts[0].y = y0;
 +      verts[0].z = z;
 +      verts[0].s = 0.0F;
 +      verts[0].t = 0.0F;
 +      verts[1].x = x1;
 +      verts[1].y = y0;
 +      verts[1].z = z;
 +      verts[1].s = tex->Sright;
 +      verts[1].t = 0.0F;
 +      verts[2].x = x1;
 +      verts[2].y = y1;
 +      verts[2].z = z;
 +      verts[2].s = tex->Sright;
 +      verts[2].t = tex->Ttop;
 +      verts[3].x = x0;
 +      verts[3].y = y1;
 +      verts[3].z = z;
 +      verts[3].s = 0.0F;
 +      verts[3].t = tex->Ttop;
+    }
  
-       /* upload new vertex data */
-       _mesa_BufferSubDataARB(GL_ARRAY_BUFFER_ARB, 0, sizeof(verts), verts);
+    if (drawpix->ArrayObj == 0) {
+       /* one-time setup: create vertex array object */
+       _mesa_GenVertexArrays(1, &drawpix->ArrayObj);
     }
 -   _mesa_VertexPointer(3, GL_FLOAT, sizeof(verts[0]),
 -                       (void *) (0 * sizeof(GLfloat)));
 -   _mesa_TexCoordPointer(2, GL_FLOAT, sizeof(verts[0]),
 -                         (void *) (3 * sizeof(GLfloat)));
+    _mesa_BindVertexArray(drawpix->ArrayObj);
+    /* create vertex array buffer */
+    _mesa_GenBuffersARB(1, &vbo);
+    _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, vbo);
+    _mesa_BufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(verts),
+                        verts, GL_DYNAMIC_DRAW_ARB);
+    /* setup vertex arrays */
++   _mesa_VertexPointer(3, GL_FLOAT, sizeof(struct vertex), OFFSET(x));
++   _mesa_TexCoordPointer(2, GL_FLOAT, sizeof(struct vertex), OFFSET(s));
+    _mesa_EnableClientState(GL_VERTEX_ARRAY);
+    _mesa_EnableClientState(GL_TEXTURE_COORD_ARRAY);
  
     /* set given unpack params */
     ctx->Unpack = *unpack;
        _mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4);
     }
  
 -   _mesa_Disable(tex->Target);
 +   _mesa_set_enable(ctx, tex->Target, GL_FALSE);
  
+    _mesa_DeleteBuffersARB(1, &vbo);
     /* restore unpack params */
     ctx->Unpack = unpackSave;