diff options
Diffstat (limited to 'src/gallium/auxiliary/cso_cache/cso_context.c')
-rw-r--r-- | src/gallium/auxiliary/cso_cache/cso_context.c | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c b/src/gallium/auxiliary/cso_cache/cso_context.c index 1cd5f8de184..7f2dc431ae5 100644 --- a/src/gallium/auxiliary/cso_cache/cso_context.c +++ b/src/gallium/auxiliary/cso_cache/cso_context.c @@ -233,6 +233,25 @@ static INLINE void sanitize_hash(struct cso_hash *hash, enum cso_cache_type type } } +static void cso_init_vbuf(struct cso_context *cso) +{ + struct u_vbuf_caps caps; + + u_vbuf_get_caps(cso->pipe->screen, &caps); + + /* Install 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) { + cso->vbuf = u_vbuf_create(cso->pipe, &caps); + } +} struct cso_context *cso_create_context( struct pipe_context *pipe ) { @@ -251,6 +270,8 @@ struct cso_context *cso_create_context( struct pipe_context *pipe ) ctx->pipe = pipe; + cso_init_vbuf(ctx); + /* Enable for testing: */ if (0) cso_set_maximum_cache_size( ctx->cache, 4 ); @@ -270,11 +291,6 @@ out: return NULL; } -void cso_install_vbuf(struct cso_context *ctx, struct u_vbuf *vbuf) -{ - ctx->vbuf = vbuf; -} - /** * Prior to context destruction, this function unbinds all state objects. */ @@ -343,6 +359,8 @@ void cso_release_all( struct cso_context *ctx ) void cso_destroy_context( struct cso_context *ctx ) { if (ctx) { + if (ctx->vbuf) + u_vbuf_destroy(ctx->vbuf); FREE( ctx ); } } |