From: Brian Paul Date: Tue, 22 Sep 2009 22:06:18 +0000 (-0600) Subject: Merge branch 'mesa_7_6_branch' X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=02f2bcdf1d28f2bd6382fb6048c497ef76ba86b2;p=mesa.git Merge branch 'mesa_7_6_branch' --- 02f2bcdf1d28f2bd6382fb6048c497ef76ba86b2 diff --cc src/mesa/drivers/common/meta.c index 532b2c92635,2741a41bf39..21756786c54 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@@ -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_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(verts[0]), - (void *) (0 * sizeof(GLfloat))); - _mesa_TexCoordPointer(2, GL_FLOAT, sizeof(verts[0]), - (void *) (3 * sizeof(GLfloat))); ++ _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; @@@ -1790,8 -1627,10 +1780,10 @@@ _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;