diff options
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r-- | src/mesa/state_tracker/st_cb_clear.c | 71 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_cb_clear.h | 3 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_cb_flush.c | 1 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_context.h | 2 |
4 files changed, 11 insertions, 66 deletions
diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c index 19358337270..f0c30b65ba2 100644 --- a/src/mesa/state_tracker/st_cb_clear.c +++ b/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,36 +137,8 @@ draw_quad(struct st_context *st, const union pipe_color_union *color) { struct pipe_context *pipe = st->pipe; - - /* 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 */ - return; - } + struct pipe_resource *vbuf = NULL; + GLuint i, offset; /* positions */ st->clear.vertices[0][0][0] = x0; @@ -194,24 +163,22 @@ draw_quad(struct st_context *st, st->clear.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_data(st->uploader, 0, sizeof(st->clear.vertices), + st->clear.vertices, &offset, &vbuf); + if (!vbuf) { + return; + } + 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 +432,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() */ diff --git a/src/mesa/state_tracker/st_cb_clear.h b/src/mesa/state_tracker/st_cb_clear.h index b27c09d10e4..e9297de9ce4 100644 --- a/src/mesa/state_tracker/st_cb_clear.h +++ b/src/mesa/state_tracker/st_cb_clear.h @@ -40,9 +40,6 @@ st_init_clear(struct st_context *st); extern void st_destroy_clear(struct st_context *st); -extern void -st_flush_clear(struct st_context *st); - extern void st_init_clear_functions(struct dd_function_table *functions); diff --git a/src/mesa/state_tracker/st_cb_flush.c b/src/mesa/state_tracker/st_cb_flush.c index 0e27cb9a3fd..724bc1971b4 100644 --- a/src/mesa/state_tracker/st_cb_flush.c +++ b/src/mesa/state_tracker/st_cb_flush.c @@ -85,7 +85,6 @@ void st_flush( struct st_context *st, * successive frames: */ st_flush_bitmap(st); - st_flush_clear(st); util_blit_flush(st->blit); util_gen_mipmap_flush(st->gen_mipmap); diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h index 9482ed69969..f1342a64615 100644 --- a/src/mesa/state_tracker/st_context.h +++ b/src/mesa/state_tracker/st_context.h @@ -171,8 +171,6 @@ struct st_context void *vs; void *fs; float vertices[4][2][4]; /**< vertex pos + color */ - struct pipe_resource *vbuf; - unsigned vbuf_slot; boolean enable_ds_separate; } clear; |