dri/nouveau: Some minor vertex submission fixes.

This commit is contained in:
Francisco Jerez 2010-03-11 21:48:51 +01:00
parent 50be9bc6ce
commit d475eae50b
2 changed files with 11 additions and 11 deletions

View file

@ -254,7 +254,7 @@ get_scratch_vbo(GLcontext *ctx, unsigned size, struct nouveau_bo **bo,
*/
static inline unsigned
get_max_vertices(GLcontext *ctx, const struct _mesa_index_buffer *ib,
unsigned n)
int n)
{
struct nouveau_render_state *render = to_render_state(ctx);

View file

@ -244,17 +244,20 @@ vbo_choose_attrs(GLcontext *ctx, const struct gl_client_array **arrays)
}
static unsigned
get_max_client_stride(GLcontext *ctx)
get_max_client_stride(GLcontext *ctx, const struct gl_client_array **arrays)
{
struct nouveau_render_state *render = to_render_state(ctx);
int i, s = 0;
for (i = 0; i < render->attr_count; i++) {
int attr = render->map[i];
struct nouveau_array_state *a = &render->attrs[attr];
if (attr >= 0 && !a->bo)
s = MAX2(a->stride, s);
if (attr >= 0) {
const struct gl_client_array *a = arrays[attr];
if (!_mesa_is_bufferobj(a->BufferObj))
s = MAX2(a->StrideB, s);
}
}
return s;
@ -275,14 +278,15 @@ vbo_maybe_split(GLcontext *ctx, const struct gl_client_array **arrays,
{
struct nouveau_context *nctx = to_nouveau_context(ctx);
struct nouveau_render_state *render = to_render_state(ctx);
unsigned pushbuf_avail = PUSHBUF_DWORDS - 2 * nctx->bo.count,
unsigned pushbuf_avail = PUSHBUF_DWORDS - 2 * (nctx->bo.count +
render->attr_count),
vert_avail = get_max_vertices(ctx, NULL, pushbuf_avail),
idx_avail = get_max_vertices(ctx, ib, pushbuf_avail);
int stride;
/* Try to keep client buffers smaller than the scratch BOs. */
if (render->mode == VBO &&
(stride = get_max_client_stride(ctx)))
(stride = get_max_client_stride(ctx, arrays)))
vert_avail = MIN2(vert_avail,
RENDER_SCRATCH_SIZE / stride);
@ -371,8 +375,6 @@ vbo_draw_vbo(GLcontext *ctx, const struct gl_client_array **arrays,
dispatch(ctx, start, delta, count);
BATCH_END();
}
FIRE_RING(chan);
}
/* Immediate rendering path. */
@ -416,8 +418,6 @@ vbo_draw_imm(GLcontext *ctx, const struct gl_client_array **arrays,
BATCH_END();
}
FIRE_RING(chan);
}
/* draw_prims entry point when we're doing hw-tnl. */