}
void brw_draw_prims( struct gl_context *ctx,
- const struct gl_client_array *arrays[],
const struct _mesa_prim *prim,
GLuint nr_prims,
const struct _mesa_index_buffer *ib,
GLuint max_index,
struct gl_transform_feedback_object *tfb_vertcount )
{
+ const struct gl_client_array **arrays = ctx->Array._DrawArrays;
bool retval;
if (!_mesa_check_conditional_render(ctx))
void brw_draw_prims( struct gl_context *ctx,
- const struct gl_client_array *arrays[],
const struct _mesa_prim *prims,
GLuint nr_prims,
const struct _mesa_index_buffer *ib,
}
static void
-TAG(vbo_render_prims)(struct gl_context *ctx, const struct gl_client_array **arrays,
+TAG(vbo_render_prims)(struct gl_context *ctx,
const struct _mesa_prim *prims, GLuint nr_prims,
const struct _mesa_index_buffer *ib,
GLboolean index_bounds_valid,
static void
TAG(vbo_render_prims)(struct gl_context *ctx,
- const struct gl_client_array **arrays,
const struct _mesa_prim *prims, GLuint nr_prims,
const struct _mesa_index_buffer *ib,
GLboolean index_bounds_valid,
struct gl_transform_feedback_object *tfb_vertcount)
{
struct nouveau_render_state *render = to_render_state(ctx);
+ const struct gl_client_array **arrays = ctx->Array._DrawArrays;
if (!index_bounds_valid)
vbo_get_minmax_indices(ctx, prims, ib, &min_index, &max_index,
static void
TAG(vbo_check_render_prims)(struct gl_context *ctx,
- const struct gl_client_array **arrays,
const struct _mesa_prim *prims, GLuint nr_prims,
const struct _mesa_index_buffer *ib,
GLboolean index_bounds_valid,
nouveau_validate_framebuffer(ctx);
if (nctx->fallback == HWTNL)
- TAG(vbo_render_prims)(ctx, arrays, prims, nr_prims, ib,
+ TAG(vbo_render_prims)(ctx, prims, nr_prims, ib,
index_bounds_valid, min_index, max_index,
tfb_vertcount);
if (nctx->fallback == SWTNL)
- _tnl_vbo_draw_prims(ctx, arrays, prims, nr_prims, ib,
+ _tnl_vbo_draw_prims(ctx, prims, nr_prims, ib,
index_bounds_valid, min_index, max_index,
tfb_vertcount);
}
/* GL_ARB_vertex_buffer_object */
struct gl_buffer_object *ArrayBufferObj;
+
+ /**
+ * Vertex arrays as consumed by a driver.
+ * The array pointer is set up only by the VBO module. */
+ const struct gl_client_array **_DrawArrays; /**< 0..VERT_ATTRIB_MAX-1 */
};
struct st_context *st = st_context(ctx);
struct draw_context *draw = st->draw;
struct rastpos_stage *rs;
+ const struct gl_client_array **saved_arrays = ctx->Array._DrawArrays;
if (st->rastpos_stage) {
/* get rastpos stage info */
rs->array[0].Ptr = (GLubyte *) v;
/* draw the point */
- st_feedback_draw_vbo(ctx, rs->arrays, &rs->prim, 1, NULL, GL_TRUE, 0, 1,
+ ctx->Array._DrawArrays = rs->arrays;
+ st_feedback_draw_vbo(ctx, &rs->prim, 1, NULL, GL_TRUE, 0, 1,
NULL);
+ ctx->Array._DrawArrays = saved_arrays;
/* restore draw's rasterization stage depending on rendermode */
if (ctx->RenderMode == GL_FEEDBACK) {
*/
void
st_draw_vbo(struct gl_context *ctx,
- const struct gl_client_array **arrays,
const struct _mesa_prim *prims,
GLuint nr_prims,
const struct _mesa_index_buffer *ib,
struct pipe_context *pipe = st->pipe;
struct pipe_index_buffer ibuffer;
struct pipe_draw_info info;
+ const struct gl_client_array **arrays = ctx->Array._DrawArrays;
unsigned i, num_instances = 1;
unsigned max_index_plus_base;
GLboolean new_array =
extern void
st_draw_vbo(struct gl_context *ctx,
- const struct gl_client_array **arrays,
const struct _mesa_prim *prims,
GLuint nr_prims,
const struct _mesa_index_buffer *ib,
extern void
st_feedback_draw_vbo(struct gl_context *ctx,
- const struct gl_client_array **arrays,
const struct _mesa_prim *prims,
GLuint nr_prims,
const struct _mesa_index_buffer *ib,
*/
void
st_feedback_draw_vbo(struct gl_context *ctx,
- const struct gl_client_array **arrays,
const struct _mesa_prim *prims,
GLuint nr_prims,
const struct _mesa_index_buffer *ib,
struct pipe_index_buffer ibuffer;
struct pipe_transfer *vb_transfer[PIPE_MAX_ATTRIBS];
struct pipe_transfer *ib_transfer = NULL;
+ const struct gl_client_array **arrays = ctx->Array._DrawArrays;
GLuint attr, i;
const GLubyte *low_addr = NULL;
const void *mapped_indices = NULL;
void _tnl_vbo_draw_prims(struct gl_context *ctx,
- const struct gl_client_array *arrays[],
const struct _mesa_prim *prim,
GLuint nr_prims,
const struct _mesa_index_buffer *ib,
GLuint max_index,
struct gl_transform_feedback_object *tfb_vertcount)
{
+ const struct gl_client_array **arrays = ctx->Array._DrawArrays;
+
if (!index_bounds_valid)
vbo_get_minmax_indices(ctx, prim, ib, &min_index, &max_index, nr_prims);
void
_tnl_vbo_draw_prims( struct gl_context *ctx,
- const struct gl_client_array *arrays[],
const struct _mesa_prim *prim,
GLuint nr_prims,
const struct _mesa_index_buffer *ib,
typedef void (*vbo_draw_func)( struct gl_context *ctx,
- const struct gl_client_array **arrays,
const struct _mesa_prim *prims,
GLuint nr_prims,
const struct _mesa_index_buffer *ib,
{
if (vbo->last_draw_method != method) {
struct gl_context *ctx = vbo->exec.ctx;
+
+ switch (method) {
+ case DRAW_ARRAYS:
+ ctx->Array._DrawArrays = vbo->exec.array.inputs;
+ break;
+ case DRAW_BEGIN_END:
+ ctx->Array._DrawArrays = vbo->exec.vtx.inputs;
+ break;
+ case DRAW_DISPLAY_LIST:
+ ctx->Array._DrawArrays = vbo->save.inputs;
+ break;
+ default:
+ ASSERT(0);
+ }
+
ctx->Driver.UpdateState(ctx, _NEW_ARRAY);
vbo->last_draw_method = method;
}
if (primCount > 0) {
/* draw one or two prims */
check_buffers_are_unmapped(exec->array.inputs);
- vbo->draw_prims(ctx, exec->array.inputs, prim, primCount, NULL,
+ vbo->draw_prims(ctx, prim, primCount, NULL,
GL_TRUE, start, start + count - 1, NULL);
}
}
prim[0].count = count;
check_buffers_are_unmapped(exec->array.inputs);
- vbo->draw_prims(ctx, exec->array.inputs, prim, 1, NULL,
+ vbo->draw_prims(ctx, prim, 1, NULL,
GL_TRUE, start, start + count - 1,
NULL);
}
*/
check_buffers_are_unmapped(exec->array.inputs);
- vbo->draw_prims( ctx, exec->array.inputs, prim, 1, &ib,
+ vbo->draw_prims( ctx, prim, 1, &ib,
index_bounds_valid, start, end, NULL );
}
}
check_buffers_are_unmapped(exec->array.inputs);
- vbo->draw_prims(ctx, exec->array.inputs, prim, primcount, &ib,
+ vbo->draw_prims(ctx, prim, primcount, &ib,
GL_FALSE, ~0, ~0, NULL);
} else {
/* render one prim at a time */
prim[0].basevertex = 0;
check_buffers_are_unmapped(exec->array.inputs);
- vbo->draw_prims(ctx, exec->array.inputs, prim, 1, &ib,
+ vbo->draw_prims(ctx, prim, 1, &ib,
GL_FALSE, ~0, ~0, NULL);
}
}
* will be rendered. */
check_buffers_are_unmapped(exec->array.inputs);
- vbo->draw_prims(ctx, exec->array.inputs, prim, 1, NULL,
+ vbo->draw_prims(ctx, prim, 1, NULL,
GL_TRUE, 0, 0, obj);
}
exec->vtx.vert_count);
vbo_context(ctx)->draw_prims( ctx,
- exec->vtx.inputs,
- exec->vtx.prim,
+ exec->vtx.prim,
exec->vtx.prim_count,
NULL,
GL_TRUE,
struct _mesa_index_buffer tmp_ib;
struct _mesa_prim *tmp_prims = NULL;
+ const struct gl_client_array **saved_arrays = ctx->Array._DrawArrays;
void *tmp_indices = NULL;
GLuint i;
/* Re-issue the draw call.
*/
+ ctx->Array._DrawArrays = tmp_array_pointers;
+
draw( ctx,
- tmp_array_pointers,
- prim,
+ prim,
nr_prims,
ib,
GL_TRUE,
0,
max_index - min_index,
NULL );
+
+ ctx->Array._DrawArrays = saved_arrays;
if (tmp_indices)
free(tmp_indices);
if (node->count > 0) {
vbo_context(ctx)->draw_prims(ctx,
- save->inputs,
- node->prim,
+ node->prim,
node->prim_count,
NULL,
GL_TRUE,
static void
flush( struct copy_context *copy )
{
+ struct gl_context *ctx = copy->ctx;
+ const struct gl_client_array **saved_arrays = ctx->Array._DrawArrays;
GLuint i;
/* Set some counters:
(void) dump_draw_info;
#endif
- copy->draw( copy->ctx,
- copy->dstarray_ptr,
+ ctx->Array._DrawArrays = copy->dstarray_ptr;
+
+ copy->draw( ctx,
copy->dstprim,
copy->dstprim_nr,
©->dstib,
copy->dstbuf_nr - 1,
NULL );
+ ctx->Array._DrawArrays = saved_arrays;
+
/* Reset all pointers:
*/
copy->dstprim_nr = 0;
static void flush_vertex( struct split_context *split )
{
+ struct gl_context *ctx = split->ctx;
+ const struct gl_client_array **saved_arrays = ctx->Array._DrawArrays;
struct _mesa_index_buffer ib;
GLuint i;
assert(split->max_index >= split->min_index);
- split->draw(split->ctx,
- split->array,
+ ctx->Array._DrawArrays = split->array;
+
+ split->draw(ctx,
split->dstprim,
split->dstprim_nr,
split->ib ? &ib : NULL,
split->max_index,
NULL);
+ ctx->Array._DrawArrays = saved_arrays;
+
split->dstprim_nr = 0;
split->min_index = ~0;
split->max_index = 0;