diff options
Diffstat (limited to 'mesalib/src/mesa/state_tracker/st_context.c')
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_context.c | 53 |
1 files changed, 21 insertions, 32 deletions
diff --git a/mesalib/src/mesa/state_tracker/st_context.c b/mesalib/src/mesa/state_tracker/st_context.c index ce7dbb3f3..b44976525 100644 --- a/mesalib/src/mesa/state_tracker/st_context.c +++ b/mesalib/src/mesa/state_tracker/st_context.c @@ -65,7 +65,6 @@ #include "util/u_inlines.h" #include "util/u_upload_mgr.h" #include "cso_cache/cso_context.h" -#include "util/u_vbuf.h" DEBUG_GET_ONCE_BOOL_OPTION(mesa_mvp_dp4, "MESA_MVP_DP4", FALSE) @@ -112,32 +111,12 @@ st_get_msaa(void) } -static void st_init_vbuf(struct st_context *st) -{ - struct u_vbuf_caps caps; - - u_vbuf_get_caps(st->pipe->screen, &caps); - - /* Create u_vbuf if there is anything unsupported. */ - if (!caps.buffer_offset_unaligned || - !caps.buffer_stride_unaligned || - !caps.velem_src_offset_unaligned || - !caps.format_fixed32 || - !caps.format_float16 || - !caps.format_float64 || - !caps.format_norm32 || - !caps.format_scaled32 || - !caps.user_vertex_buffers) { - /* XXX user vertex buffers are always uploaded regardless of the CAP. */ - st->vbuf = u_vbuf_create(st->pipe, &caps); - cso_install_vbuf(st->cso_context, st->vbuf); - } -} 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,9 +135,22 @@ 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); + } + + if (!screen->get_param(screen, PIPE_CAP_USER_CONSTANT_BUFFERS)) { + unsigned alignment = + screen->get_param(screen, PIPE_CAP_CONSTANT_BUFFER_OFFSET_ALIGNMENT); + + st->constbuf_uploader = u_upload_create(pipe, 128 * 1024, alignment, + PIPE_BIND_CONSTANT_BUFFER); + } + st->cso_context = cso_create_context(pipe); - st_init_vbuf(st); st_init_atoms( st ); st_init_bitmap(st); st_init_clear(st); @@ -254,11 +246,6 @@ static void st_destroy_context_priv( struct st_context *st ) st_destroy_drawpix(st); st_destroy_drawtex(st); - /* Unreference any user vertex buffers. */ - for (i = 0; i < st->num_user_attribs; i++) { - pipe_resource_reference(&st->user_attrib[i].buffer, NULL); - } - for (i = 0; i < Elements(st->state.sampler_views); i++) { pipe_sampler_view_reference(&st->state.sampler_views[i], NULL); } @@ -269,6 +256,12 @@ 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); + } + if (st->constbuf_uploader) { + u_upload_destroy(st->constbuf_uploader); + } free( st ); } @@ -276,7 +269,6 @@ static void st_destroy_context_priv( struct st_context *st ) void st_destroy_context( struct st_context *st ) { struct pipe_context *pipe = st->pipe; - struct u_vbuf *vbuf = st->vbuf; struct cso_context *cso = st->cso_context; struct gl_context *ctx = st->ctx; GLuint i; @@ -312,9 +304,6 @@ void st_destroy_context( struct st_context *st ) st_destroy_context_priv(st); st = NULL; - if (vbuf) - u_vbuf_destroy(vbuf); - cso_destroy_context(cso); pipe->destroy( pipe ); |