summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2012-04-13 20:37:41 +0200
committerMarek Olšák <[email protected]>2012-04-18 16:19:39 +0200
commit6c1fbe912f1623cbcf474a0b985841e44122a911 (patch)
tree3ffe8fd7886ae82abcef53f5df7cfcc5e9ca5422 /src/mesa
parentb69dad1683f092e3ce9d0f3f8fb1bdf96bdff0c7 (diff)
st/mesa: write vertices directly into the buffer in glDrawPixels
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/state_tracker/st_cb_drawpixels.c32
1 files changed, 15 insertions, 17 deletions
diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c
index 5229ccee688..5e078a85edf 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -555,7 +555,15 @@ draw_quad(struct gl_context *ctx, GLfloat x0, GLfloat y0, GLfloat z,
{
struct st_context *st = st_context(ctx);
struct pipe_context *pipe = st->pipe;
- GLfloat verts[4][3][4]; /* four verts, three attribs, XYZW */
+ GLfloat (*verts)[3][4]; /* four verts, three attribs, XYZW */
+ struct pipe_resource *buf = NULL;
+ unsigned offset;
+
+ u_upload_alloc(st->uploader, 0, 4 * sizeof(verts[0]), &offset, &buf,
+ (void**)&verts);
+ if (!buf) {
+ return;
+ }
/* setup vertex data */
{
@@ -619,22 +627,12 @@ draw_quad(struct gl_context *ctx, GLfloat x0, GLfloat y0, GLfloat z,
}
}
- {
- struct pipe_resource *buf = NULL;
- unsigned offset;
-
- u_upload_data(st->uploader, 0, sizeof(verts), verts, &offset, &buf);
- if (!buf) {
- return;
- }
-
- u_upload_unmap(st->uploader);
- util_draw_vertex_buffer(pipe, st->cso_context, buf, offset,
- PIPE_PRIM_QUADS,
- 4, /* verts */
- 3); /* attribs/vert */
- pipe_resource_reference(&buf, NULL);
- }
+ u_upload_unmap(st->uploader);
+ util_draw_vertex_buffer(pipe, st->cso_context, buf, offset,
+ PIPE_PRIM_QUADS,
+ 4, /* verts */
+ 3); /* attribs/vert */
+ pipe_resource_reference(&buf, NULL);
}