diff options
author | marha <marha@users.sourceforge.net> | 2012-04-30 11:11:16 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2012-04-30 11:11:16 +0200 |
commit | 0f0386d4e90cb0769eddc04b18742d5a9a72ea05 (patch) | |
tree | a8a5fb11e78c4afe6637c5adfa0d2224208f7314 /mesalib/src/mesa/state_tracker/st_context.c | |
parent | cd27f58626705bcb561115b8e5b0d1430df83fa6 (diff) | |
parent | 762b7fde3d57d3a151f98535fd31516b7e823bc0 (diff) | |
download | vcxsrv-0f0386d4e90cb0769eddc04b18742d5a9a72ea05.tar.gz vcxsrv-0f0386d4e90cb0769eddc04b18742d5a9a72ea05.tar.bz2 vcxsrv-0f0386d4e90cb0769eddc04b18742d5a9a72ea05.zip |
Merge remote-tracking branch 'origin/released'
Conflicts:
pixman/pixman/pixman-mmx.c
xorg-server/glx/glapi_gentable.c
Diffstat (limited to 'mesalib/src/mesa/state_tracker/st_context.c')
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_context.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/mesalib/src/mesa/state_tracker/st_context.c b/mesalib/src/mesa/state_tracker/st_context.c index 0245fd92b..19d9da131 100644 --- a/mesalib/src/mesa/state_tracker/st_context.c +++ b/mesalib/src/mesa/state_tracker/st_context.c @@ -65,6 +65,7 @@ #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) @@ -111,6 +112,29 @@ 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 ) { @@ -134,6 +158,7 @@ st_create_context_priv( struct gl_context *ctx, struct pipe_context *pipe ) st->uploader = u_upload_create(st->pipe, 65536, 4, PIPE_BIND_VERTEX_BUFFER); st->cso_context = cso_create_context(pipe); + st_init_vbuf(st); st_init_atoms( st ); st_init_bitmap(st); st_init_clear(st); @@ -245,6 +270,7 @@ 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; @@ -275,7 +301,13 @@ void st_destroy_context( struct st_context *st ) _mesa_free_context_data(ctx); + /* This will free the st_context too, so 'st' must not be accessed + * afterwards. */ st_destroy_context_priv(st); + st = NULL; + + if (vbuf) + u_vbuf_destroy(vbuf); cso_destroy_context(cso); |