summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarek Olšák <maraeo@gmail.com>2012-04-29 21:24:39 +0200
committerMarek Olšák <maraeo@gmail.com>2012-04-30 01:18:49 +0200
commit46fe17930ec71be3489fbb844de2bf16d877437e (patch)
tree7e1bd330a3ccf95d2bbd84dc2875af0e05b9884e
parentf656607c35c80250f0217b6c03b9312987450f13 (diff)
downloadexternal_mesa3d-46fe17930ec71be3489fbb844de2bf16d877437e.zip
external_mesa3d-46fe17930ec71be3489fbb844de2bf16d877437e.tar.gz
external_mesa3d-46fe17930ec71be3489fbb844de2bf16d877437e.tar.bz2
cso: cso_context should install u_vbuf by itself and not st/mesa
so that it's installed in the other state trackers too
-rw-r--r--src/gallium/auxiliary/cso_cache/cso_context.c28
-rw-r--r--src/gallium/auxiliary/cso_cache/cso_context.h2
-rw-r--r--src/mesa/state_tracker/st_context.c27
-rw-r--r--src/mesa/state_tracker/st_context.h2
4 files changed, 23 insertions, 36 deletions
diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c b/src/gallium/auxiliary/cso_cache/cso_context.c
index 1cd5f8d..7f2dc43 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 7927934..4de08a8 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 );
diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
index d712408..93f4216 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/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,27 +111,6 @@ 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 *
@@ -173,7 +151,6 @@ st_create_context_priv( struct gl_context *ctx, struct pipe_context *pipe )
st->cso_context = cso_create_context(pipe);
- st_init_vbuf(st);
st_init_atoms( st );
st_init_bitmap(st);
st_init_clear(st);
@@ -286,7 +263,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;
@@ -322,9 +298,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 );
diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h
index 8b8d69e..49b8316 100644
--- a/src/mesa/state_tracker/st_context.h
+++ b/src/mesa/state_tracker/st_context.h
@@ -41,7 +41,6 @@ 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 */
@@ -74,7 +73,6 @@ struct st_context
struct pipe_context *pipe;
struct u_upload_mgr *uploader, *indexbuf_uploader, *constbuf_uploader;
- struct u_vbuf *vbuf;
struct draw_context *draw; /**< For selection/feedback/rastpos only */
struct draw_stage *feedback_stage; /**< For GL_FEEDBACK rendermode */