diff options
author | Marek Olšák <[email protected]> | 2012-04-10 05:14:26 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2012-04-24 01:39:22 +0200 |
commit | 7fe3631a7a0ad7602b4e947ac87ef86875c8bb3f (patch) | |
tree | c526a63498a4b98f65ee02998b0e9655c52ae602 /src/gallium/drivers | |
parent | 978c1aa1d0f6fd9a188762a8534de33fc63eeea0 (diff) |
u_vbuf: make use of the new CAPs to determine what to do
This adds the ability to initialize u_vbuf_caps before creating u_vbuf itself.
It will be useful for determining if u_vbuf should be used or not.
Also adapt r300g and r600g.
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r-- | src/gallium/drivers/r300/r300_context.c | 11 | ||||
-rw-r--r-- | src/gallium/drivers/r300/r300_screen.c | 4 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_pipe.c | 18 |
3 files changed, 23 insertions, 10 deletions
diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c index 74d5e8ed36c..fd464f32afd 100644 --- a/src/gallium/drivers/r300/r300_context.c +++ b/src/gallium/drivers/r300/r300_context.c @@ -428,13 +428,16 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen, r300->context.create_video_buffer = vl_video_buffer_create; if (r300->screen->caps.has_tcl) { - r300->vbuf_mgr = u_vbuf_create(&r300->context, 1024 * 1024, 4, + struct u_vbuf_caps caps; + + u_vbuf_get_caps(screen, &caps); + caps.format_fixed32 = 0; + + r300->vbuf_mgr = u_vbuf_create(&r300->context, &caps, 1024 * 1024, 4, PIPE_BIND_VERTEX_BUFFER | - PIPE_BIND_INDEX_BUFFER, - U_VERTEX_FETCH_DWORD_ALIGNED); + PIPE_BIND_INDEX_BUFFER); if (!r300->vbuf_mgr) goto fail; - r300->vbuf_mgr->caps.format_fixed32 = 0; } r300->blitter = util_blitter_create(&r300->context); diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c index d12fa4e8249..8c12865e9ce 100644 --- a/src/gallium/drivers/r300/r300_screen.c +++ b/src/gallium/drivers/r300/r300_screen.c @@ -103,6 +103,9 @@ static int r300_get_param(struct pipe_screen* pscreen, enum pipe_cap param) case PIPE_CAP_TGSI_CAN_COMPACT_VARYINGS: case PIPE_CAP_TGSI_CAN_COMPACT_CONSTANTS: case PIPE_CAP_VERTEX_COLOR_CLAMPED: + case PIPE_CAP_VERTEX_BUFFER_OFFSET_4BYTE_ALIGNED_ONLY: + case PIPE_CAP_VERTEX_BUFFER_STRIDE_4BYTE_ALIGNED_ONLY: + case PIPE_CAP_VERTEX_ELEMENT_SRC_OFFSET_4BYTE_ALIGNED_ONLY: return 1; case PIPE_CAP_GLSL_FEATURE_LEVEL: @@ -141,6 +144,7 @@ static int r300_get_param(struct pipe_screen* pscreen, enum pipe_cap param) case PIPE_CAP_STREAM_OUTPUT_PAUSE_RESUME: case PIPE_CAP_FRAGMENT_COLOR_CLAMPED: case PIPE_CAP_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION: + case PIPE_CAP_USER_VERTEX_BUFFERS: return 0; /* SWTCL-only features. */ diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c index bfe413c1786..c4c27ab526b 100644 --- a/src/gallium/drivers/r600/r600_pipe.c +++ b/src/gallium/drivers/r600/r600_pipe.c @@ -212,6 +212,7 @@ static struct pipe_context *r600_create_context(struct pipe_screen *screen, void { struct r600_context *rctx = CALLOC_STRUCT(r600_context); struct r600_screen* rscreen = (struct r600_screen *)screen; + struct u_vbuf_caps vbuf_caps; if (rctx == NULL) return NULL; @@ -293,14 +294,15 @@ static struct pipe_context *r600_create_context(struct pipe_screen *screen, void rctx->ws->cs_set_flush_callback(rctx->cs, r600_flush_from_winsys, rctx); r600_emit_atom(rctx, &rctx->start_cs_cmd.atom); - rctx->vbuf_mgr = u_vbuf_create(&rctx->context, 1024 * 1024, 256, - PIPE_BIND_VERTEX_BUFFER | - PIPE_BIND_INDEX_BUFFER | - PIPE_BIND_CONSTANT_BUFFER, - U_VERTEX_FETCH_DWORD_ALIGNED); + u_vbuf_get_caps(screen, &vbuf_caps); + vbuf_caps.format_fixed32 = 0; + rctx->vbuf_mgr = u_vbuf_create(&rctx->context, &vbuf_caps, + 1024 * 1024, 256, + PIPE_BIND_VERTEX_BUFFER | + PIPE_BIND_INDEX_BUFFER | + PIPE_BIND_CONSTANT_BUFFER); if (!rctx->vbuf_mgr) goto fail; - rctx->vbuf_mgr->caps.format_fixed32 = 0; rctx->blitter = util_blitter_create(&rctx->context); if (rctx->blitter == NULL) @@ -402,6 +404,9 @@ static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param) case PIPE_CAP_VERTEX_COLOR_UNCLAMPED: case PIPE_CAP_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION: case PIPE_CAP_TGSI_INSTANCEID: + case PIPE_CAP_VERTEX_BUFFER_OFFSET_4BYTE_ALIGNED_ONLY: + case PIPE_CAP_VERTEX_BUFFER_STRIDE_4BYTE_ALIGNED_ONLY: + case PIPE_CAP_VERTEX_ELEMENT_SRC_OFFSET_4BYTE_ALIGNED_ONLY: return 1; case PIPE_CAP_GLSL_FEATURE_LEVEL: @@ -425,6 +430,7 @@ static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param) case PIPE_CAP_TGSI_CAN_COMPACT_CONSTANTS: case PIPE_CAP_FRAGMENT_COLOR_CLAMPED: case PIPE_CAP_VERTEX_COLOR_CLAMPED: + case PIPE_CAP_USER_VERTEX_BUFFERS: return 0; /* Stream output. */ |