From 0e3699334faf92f508b6c187a261548b656b0dd3 Mon Sep 17 00:00:00 2001 From: marha Date: Fri, 20 Apr 2012 17:07:15 +0200 Subject: fontconfig libX11 mesa pixman xserver git update 20 april 2012 --- mesalib/src/mesa/state_tracker/st_cb_clear.c | 95 +++++++--------------------- 1 file changed, 24 insertions(+), 71 deletions(-) (limited to 'mesalib/src/mesa/state_tracker/st_cb_clear.c') diff --git a/mesalib/src/mesa/state_tracker/st_cb_clear.c b/mesalib/src/mesa/state_tracker/st_cb_clear.c index 193583372..3cd8756f2 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_clear.c +++ b/mesalib/src/mesa/state_tracker/st_cb_clear.c @@ -53,6 +53,7 @@ #include "util/u_inlines.h" #include "util/u_simple_shaders.h" #include "util/u_draw_quad.h" +#include "util/u_upload_mgr.h" #include "cso_cache/cso_context.h" @@ -87,10 +88,6 @@ st_destroy_clear(struct st_context *st) cso_delete_vertex_shader(st->cso_context, st->clear.vs); st->clear.vs = NULL; } - if (st->clear.vbuf) { - pipe_resource_reference(&st->clear.vbuf, NULL); - st->clear.vbuf = NULL; - } } @@ -140,78 +137,50 @@ draw_quad(struct st_context *st, const union pipe_color_union *color) { struct pipe_context *pipe = st->pipe; + struct pipe_resource *vbuf = NULL; + GLuint i, offset; + float (*vertices)[2][4]; /**< vertex pos + color */ - /* XXX: Need to improve buffer_write to allow NO_WAIT (as well as - * no_flush) updates to buffers where we know there is no conflict - * with previous data. Currently using max_slots > 1 will cause - * synchronous rendering if the driver flushes its command buffers - * between one bitmap and the next. Our flush hook below isn't - * sufficient to catch this as the driver doesn't tell us when it - * flushes its own command buffers. Until this gets fixed, pay the - * price of allocating a new buffer for each bitmap cache-flush to - * avoid synchronous rendering. - */ - const GLuint max_slots = 1; /* 1024 / sizeof(st->clear.vertices); */ - GLuint i; - - if (st->clear.vbuf_slot >= max_slots) { - pipe_resource_reference(&st->clear.vbuf, NULL); - st->clear.vbuf_slot = 0; - } - - if (!st->clear.vbuf) { - st->clear.vbuf = pipe_buffer_create(pipe->screen, - PIPE_BIND_VERTEX_BUFFER, - PIPE_USAGE_STREAM, - max_slots * sizeof(st->clear.vertices)); - } - - if (!st->clear.vbuf) { - /* ran out of memory */ + 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]; } - /* put vertex data into vbuf */ - pipe_buffer_write_nooverlap(st->pipe, st->clear.vbuf, - st->clear.vbuf_slot - * sizeof(st->clear.vertices), - sizeof(st->clear.vertices), - st->clear.vertices); + u_upload_unmap(st->uploader); /* draw */ util_draw_vertex_buffer(pipe, st->cso_context, - st->clear.vbuf, - st->clear.vbuf_slot * sizeof(st->clear.vertices), + vbuf, offset, PIPE_PRIM_TRIANGLE_FAN, 4, /* verts */ 2); /* attribs/vert */ - /* Increment slot */ - st->clear.vbuf_slot++; + pipe_resource_reference(&vbuf, NULL); } @@ -465,22 +434,6 @@ check_clear_stencil_with_quad(struct gl_context *ctx, struct gl_renderbuffer *rb } - -/** - * Called when we need to flush. - */ -void -st_flush_clear(struct st_context *st) -{ - /* Release vertex buffer to avoid synchronous rendering if we were - * to map it in the next frame. - */ - pipe_resource_reference(&st->clear.vbuf, NULL); - st->clear.vbuf_slot = 0; -} - - - /** * Called via ctx->Driver.Clear() */ -- cgit v1.2.3