aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker
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
commita8a478999c366cd08be2910ea83465d9b69181e8 (patch)
tree49e05e3e71e3d9ecfc0e89c3919ef91810dce98d /src/mesa/state_tracker
parent2b151bbb957284e7a1a272c1b5ec6c9307e6e623 (diff)
st/mesa: write vertices directly into the buffer for glClear fallback
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r--src/mesa/state_tracker/st_cb_clear.c40
-rw-r--r--src/mesa/state_tracker/st_context.h1
2 files changed, 21 insertions, 20 deletions
diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c
index f0c30b65ba2..3cd8756f2ee 100644
--- a/src/mesa/state_tracker/st_cb_clear.c
+++ b/src/mesa/state_tracker/st_cb_clear.c
@@ -139,35 +139,37 @@ draw_quad(struct st_context *st,
struct pipe_context *pipe = st->pipe;
struct pipe_resource *vbuf = NULL;
GLuint i, offset;
+ float (*vertices)[2][4]; /**< vertex pos + color */
+
+ u_upload_alloc(st->uploader, 0, 4 * sizeof(vertices[0]), &offset, &vbuf,
+ (void**)&vertices);
+ if (!vbuf) {
+ return;
+ }
/* positions */
- st->clear.vertices[0][0][0] = x0;
- st->clear.vertices[0][0][1] = y0;
+ vertices[0][0][0] = x0;
+ vertices[0][0][1] = y0;
- st->clear.vertices[1][0][0] = x1;
- st->clear.vertices[1][0][1] = y0;
+ vertices[1][0][0] = x1;
+ vertices[1][0][1] = y0;
- st->clear.vertices[2][0][0] = x1;
- st->clear.vertices[2][0][1] = y1;
+ vertices[2][0][0] = x1;
+ vertices[2][0][1] = y1;
- st->clear.vertices[3][0][0] = x0;
- st->clear.vertices[3][0][1] = y1;
+ vertices[3][0][0] = x0;
+ vertices[3][0][1] = y1;
/* same for all verts: */
for (i = 0; i < 4; i++) {
- st->clear.vertices[i][0][2] = z;
- st->clear.vertices[i][0][3] = 1.0;
- st->clear.vertices[i][1][0] = color->f[0];
- st->clear.vertices[i][1][1] = color->f[1];
- st->clear.vertices[i][1][2] = color->f[2];
- st->clear.vertices[i][1][3] = color->f[3];
+ vertices[i][0][2] = z;
+ vertices[i][0][3] = 1.0;
+ vertices[i][1][0] = color->f[0];
+ vertices[i][1][1] = color->f[1];
+ vertices[i][1][2] = color->f[2];
+ vertices[i][1][3] = color->f[3];
}
- u_upload_data(st->uploader, 0, sizeof(st->clear.vertices),
- st->clear.vertices, &offset, &vbuf);
- if (!vbuf) {
- return;
- }
u_upload_unmap(st->uploader);
/* draw */
diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h
index f1342a64615..dbcc2b1a3ea 100644
--- a/src/mesa/state_tracker/st_context.h
+++ b/src/mesa/state_tracker/st_context.h
@@ -170,7 +170,6 @@ struct st_context
struct pipe_viewport_state viewport;
void *vs;
void *fs;
- float vertices[4][2][4]; /**< vertex pos + color */
boolean enable_ds_separate;
} clear;