diff options
author | Marek Olšák <[email protected]> | 2012-04-29 21:24:39 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2012-04-30 01:18:49 +0200 |
commit | 46fe17930ec71be3489fbb844de2bf16d877437e (patch) | |
tree | 7e1bd330a3ccf95d2bbd84dc2875af0e05b9884e /src/gallium/auxiliary/cso_cache | |
parent | f656607c35c80250f0217b6c03b9312987450f13 (diff) |
cso: cso_context should install u_vbuf by itself and not st/mesa
so that it's installed in the other state trackers too
Diffstat (limited to 'src/gallium/auxiliary/cso_cache')
-rw-r--r-- | src/gallium/auxiliary/cso_cache/cso_context.c | 28 | ||||
-rw-r--r-- | src/gallium/auxiliary/cso_cache/cso_context.h | 2 |
2 files changed, 23 insertions, 7 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 ); } } diff --git a/src/gallium/auxiliary/cso_cache/cso_context.h b/src/gallium/auxiliary/cso_cache/cso_context.h index 79279343c39..4de08a8364c 100644 --- a/src/gallium/auxiliary/cso_cache/cso_context.h +++ b/src/gallium/auxiliary/cso_cache/cso_context.h @@ -43,8 +43,6 @@ struct u_vbuf; struct cso_context *cso_create_context( struct pipe_context *pipe ); -void cso_install_vbuf(struct cso_context *ctx, struct u_vbuf *vbuf); - void cso_release_all( struct cso_context *ctx ); void cso_destroy_context( struct cso_context *cso ); |