diff options
author | Marek Olšák <[email protected]> | 2012-04-10 06:00:17 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2012-04-24 01:39:22 +0200 |
commit | e0773da1e897164ed7597437070e32b867734ee5 (patch) | |
tree | 1653bdb8fab0d8e250f7fcc0ca225e7245043184 /src/mesa/state_tracker | |
parent | 79eafc14ca70a684b4ea8b89723c1dad3e61eb3d (diff) |
gallium: make user vertex buffers optional
This couldn't be split because it would break bisecting.
Summary:
* r300g,r600g: stop using u_vbuf
* r300g,r600g: also report that the FIXED vertex type is unsupported
* u_vbuf: refactor for use in the state tracker
* cso: wire up u_vbuf with cso_context
* st/mesa: conditionally install u_vbuf
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r-- | src/mesa/state_tracker/st_context.c | 26 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_context.h | 3 |
2 files changed, 29 insertions, 0 deletions
diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index 0245fd92b3e..b27f2f677b6 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/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,27 @@ 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.fetch_dword_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 +156,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); @@ -277,6 +300,9 @@ void st_destroy_context( struct st_context *st ) st_destroy_context_priv(st); + if (st->vbuf) + u_vbuf_destroy(st->vbuf); + cso_destroy_context(cso); pipe->destroy( pipe ); diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h index e3d65d97aa5..3ec98ada196 100644 --- a/src/mesa/state_tracker/st_context.h +++ b/src/mesa/state_tracker/st_context.h @@ -41,6 +41,7 @@ struct gen_mipmap_state; struct st_context; struct st_fragment_program; struct u_upload_mgr; +struct u_vbuf; #define ST_NEW_MESA (1 << 0) /* Mesa state has changed */ @@ -73,6 +74,8 @@ struct st_context struct pipe_context *pipe; struct u_upload_mgr *uploader; + struct u_vbuf *vbuf; + struct draw_context *draw; /**< For selection/feedback/rastpos only */ struct draw_stage *feedback_stage; /**< For GL_FEEDBACK rendermode */ struct draw_stage *selection_stage; /**< For GL_SELECT rendermode */ |