diff options
author | Marek Olšák <[email protected]> | 2012-04-24 17:04:18 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2012-04-30 01:09:57 +0200 |
commit | 8c655f499cf61211146a3d38f77532541f88aa88 (patch) | |
tree | d8d8fb0d988ac9832793b970e499a075a8b47c5d /src/mesa/state_tracker/st_context.c | |
parent | 989bdaab514cce808eea4b9d792656aaeee8603c (diff) |
st/mesa: make user index buffers optional
v2: use a separate upload buffer for indices
Diffstat (limited to 'src/mesa/state_tracker/st_context.c')
-rw-r--r-- | src/mesa/state_tracker/st_context.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index 19d9da131f3..d50c6be6c4d 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -138,6 +138,7 @@ static void st_init_vbuf(struct st_context *st) static struct st_context * st_create_context_priv( struct gl_context *ctx, struct pipe_context *pipe ) { + struct pipe_screen *screen = pipe->screen; uint i; struct st_context *st = ST_CALLOC_STRUCT( st_context ); @@ -156,6 +157,12 @@ st_create_context_priv( struct gl_context *ctx, struct pipe_context *pipe ) st->dirty.st = ~0; st->uploader = u_upload_create(st->pipe, 65536, 4, PIPE_BIND_VERTEX_BUFFER); + + if (!screen->get_param(screen, PIPE_CAP_USER_INDEX_BUFFERS)) { + st->indexbuf_uploader = u_upload_create(st->pipe, 128 * 1024, 4, + PIPE_BIND_INDEX_BUFFER); + } + st->cso_context = cso_create_context(pipe); st_init_vbuf(st); @@ -263,6 +270,9 @@ static void st_destroy_context_priv( struct st_context *st ) } u_upload_destroy(st->uploader); + if (st->indexbuf_uploader) { + u_upload_destroy(st->indexbuf_uploader); + } free( st ); } |