* structures. */
static int
-get_array_stride(struct gl_context *ctx, const struct gl_vertex_array *a)
+get_array_stride(struct gl_context *ctx, const struct tnl_vertex_array *a)
{
struct nouveau_render_state *render = to_render_state(ctx);
const struct gl_vertex_buffer_binding *binding = a->BufferBinding;
if (render->mode == VBO && !_mesa_is_bufferobj(binding->BufferObj)) {
const struct gl_array_attributes *attrib = a->VertexAttrib;
/* Pack client buffers. */
- return align(_mesa_sizeof_type(attrib->Type) * attrib->Size, 4);
+ return align(attrib->Format._ElementSize, 4);
} else {
return binding->Stride;
}
static void
vbo_init_arrays(struct gl_context *ctx, const struct _mesa_index_buffer *ib,
- const struct gl_vertex_array *arrays)
+ const struct tnl_vertex_array *arrays)
{
struct nouveau_render_state *render = to_render_state(ctx);
GLboolean imm = (render->mode == IMM);
if (ib) {
GLenum ib_type;
- if (ib->index_size == 4)
+ if (ib->index_size_shift == 2)
ib_type = GL_UNSIGNED_INT;
- else if (ib->index_size == 2)
+ else if (ib->index_size_shift == 1)
ib_type = GL_UNSIGNED_SHORT;
else
ib_type = GL_UNSIGNED_BYTE;
}
FOR_EACH_BOUND_ATTR(render, i, attr) {
- const struct gl_vertex_array *array = &arrays[attr];
+ const struct tnl_vertex_array *array = &arrays[attr];
const struct gl_vertex_buffer_binding *binding =
array->BufferBinding;
const struct gl_array_attributes *attrib = array->VertexAttrib;
nouveau_init_array(&render->attrs[attr], attr,
get_array_stride(ctx, array),
- attrib->Size, attrib->Type,
+ attrib->Format.Size, attrib->Format.Type,
imm ? binding->BufferObj : NULL,
p, imm, ctx);
}
static void
vbo_deinit_arrays(struct gl_context *ctx, const struct _mesa_index_buffer *ib,
- const struct gl_vertex_array *arrays)
+ const struct tnl_vertex_array *arrays)
{
struct nouveau_render_state *render = to_render_state(ctx);
int i, attr;
/* Make some rendering decisions from the GL context. */
static void
-vbo_choose_render_mode(struct gl_context *ctx, const struct gl_vertex_array *arrays)
+vbo_choose_render_mode(struct gl_context *ctx, const struct tnl_vertex_array *arrays)
{
struct nouveau_render_state *render = to_render_state(ctx);
int i;
}
static void
-vbo_emit_attr(struct gl_context *ctx, const struct gl_vertex_array *arrays,
+vbo_emit_attr(struct gl_context *ctx, const struct tnl_vertex_array *arrays,
int attr)
{
struct nouveau_pushbuf *push = context_push(ctx);
struct nouveau_render_state *render = to_render_state(ctx);
- const struct gl_vertex_array *array = &arrays[attr];
+ const struct tnl_vertex_array *array = &arrays[attr];
const struct gl_vertex_buffer_binding *binding = array->BufferBinding;
const struct gl_array_attributes *attrib = array->VertexAttrib;
const GLubyte *p = _mesa_vertex_attrib_address(attrib, binding);
return;
/* Constant attribute. */
- nouveau_init_array(a, attr, binding->Stride, attrib->Size,
- attrib->Type, binding->BufferObj, p,
+ nouveau_init_array(a, attr, binding->Stride, attrib->Format.Size,
+ attrib->Format.Type, binding->BufferObj, p,
GL_TRUE, ctx);
EMIT_IMM(ctx, a, 0);
nouveau_deinit_array(a);
if (render->mode == VBO) {
render->map[info->vbo_index] = attr;
- render->vertex_size += attrib->_ElementSize;
+ render->vertex_size += attrib->Format._ElementSize;
render->attr_count = MAX2(render->attr_count,
info->vbo_index + 1);
} else {
#define MAT(a) VERT_ATTRIB_MAT(MAT_ATTRIB_##a)
static void
-vbo_choose_attrs(struct gl_context *ctx, const struct gl_vertex_array *arrays)
+vbo_choose_attrs(struct gl_context *ctx, const struct tnl_vertex_array *arrays)
{
struct nouveau_render_state *render = to_render_state(ctx);
int i;
}
static int
-get_max_client_stride(struct gl_context *ctx, const struct gl_vertex_array *arrays)
+get_max_client_stride(struct gl_context *ctx, const struct tnl_vertex_array *arrays)
{
struct nouveau_render_state *render = to_render_state(ctx);
int i, attr, s = 0;
FOR_EACH_BOUND_ATTR(render, i, attr) {
- const struct gl_vertex_array *a = &arrays[attr];
+ const struct tnl_vertex_array *a = &arrays[attr];
if (!_mesa_is_bufferobj(a->BufferBinding->BufferObj))
s = MAX2(s, get_array_stride(ctx, a));
static void
TAG(vbo_render_prims)(struct gl_context *ctx,
- const struct gl_vertex_array *arrays,
+ const struct tnl_vertex_array *arrays,
const struct _mesa_prim *prims, GLuint nr_prims,
const struct _mesa_index_buffer *ib,
GLboolean index_bounds_valid,
GLuint min_index, GLuint max_index,
+ GLuint num_instances, GLuint base_instance,
struct gl_transform_feedback_object *tfb_vertcount,
- unsigned stream,
- struct gl_buffer_object *indirect);
+ unsigned stream);
static GLboolean
-vbo_maybe_split(struct gl_context *ctx, const struct gl_vertex_array *arrays,
+vbo_maybe_split(struct gl_context *ctx, const struct tnl_vertex_array *arrays,
const struct _mesa_prim *prims, GLuint nr_prims,
const struct _mesa_index_buffer *ib,
- GLuint min_index, GLuint max_index)
+ GLuint min_index, GLuint max_index,
+ GLuint num_instances, GLuint base_instance)
{
struct nouveau_context *nctx = to_nouveau_context(ctx);
struct nouveau_render_state *render = to_render_state(ctx);
.max_vb_size = ~0,
};
- vbo_split_prims(ctx, arrays, prims, nr_prims, ib, min_index,
- max_index, TAG(vbo_render_prims), &limits);
+ _tnl_split_prims(ctx, arrays, prims, nr_prims, ib, min_index,
+ max_index, num_instances, base_instance,
+ TAG(vbo_render_prims), &limits);
return GL_TRUE;
}
}
static void
-vbo_bind_vertices(struct gl_context *ctx, const struct gl_vertex_array *arrays,
+vbo_bind_vertices(struct gl_context *ctx, const struct tnl_vertex_array *arrays,
int base, unsigned min_index, unsigned max_index, int *pdelta)
{
struct nouveau_render_state *render = to_render_state(ctx);
*pdelta = -1;
FOR_EACH_BOUND_ATTR(render, i, attr) {
- const struct gl_vertex_array *array = &arrays[attr];
+ const struct tnl_vertex_array *array = &arrays[attr];
const struct gl_vertex_buffer_binding *binding =
array->BufferBinding;
const struct gl_array_attributes *attrib = array->VertexAttrib;
}
static void
-vbo_draw_vbo(struct gl_context *ctx, const struct gl_vertex_array *arrays,
+vbo_draw_vbo(struct gl_context *ctx, const struct tnl_vertex_array *arrays,
const struct _mesa_prim *prims, GLuint nr_prims,
const struct _mesa_index_buffer *ib, GLuint min_index,
GLuint max_index)
}
static void
-vbo_draw_imm(struct gl_context *ctx, const struct gl_vertex_array *arrays,
+vbo_draw_imm(struct gl_context *ctx, const struct tnl_vertex_array *arrays,
const struct _mesa_prim *prims, GLuint nr_prims,
const struct _mesa_index_buffer *ib, GLuint min_index,
GLuint max_index)
static void
TAG(vbo_render_prims)(struct gl_context *ctx,
- const struct gl_vertex_array *arrays,
+ const struct tnl_vertex_array *arrays,
const struct _mesa_prim *prims, GLuint nr_prims,
const struct _mesa_index_buffer *ib,
GLboolean index_bounds_valid,
GLuint min_index, GLuint max_index,
+ GLuint num_instances, GLuint base_instance,
struct gl_transform_feedback_object *tfb_vertcount,
- unsigned stream,
- struct gl_buffer_object *indirect)
+ unsigned stream)
{
struct nouveau_render_state *render = to_render_state(ctx);
vbo_choose_attrs(ctx, arrays);
if (vbo_maybe_split(ctx, arrays, prims, nr_prims, ib, min_index,
- max_index))
+ max_index, num_instances, base_instance))
return;
vbo_init_arrays(ctx, ib, arrays);
static void
TAG(vbo_check_render_prims)(struct gl_context *ctx,
- const struct gl_vertex_array *arrays,
+ const struct tnl_vertex_array *arrays,
const struct _mesa_prim *prims, GLuint nr_prims,
const struct _mesa_index_buffer *ib,
GLboolean index_bounds_valid,
GLuint min_index, GLuint max_index,
+ GLuint num_instances, GLuint base_instance,
struct gl_transform_feedback_object *tfb_vertcount,
- unsigned stream,
- struct gl_buffer_object *indirect)
+ unsigned stream)
{
struct nouveau_context *nctx = to_nouveau_context(ctx);
if (nctx->fallback == HWTNL)
TAG(vbo_render_prims)(ctx, arrays, prims, nr_prims, ib,
index_bounds_valid, min_index, max_index,
- tfb_vertcount, stream, indirect);
+ num_instances, base_instance,
+ tfb_vertcount, stream);
if (nctx->fallback == SWTNL)
_tnl_draw_prims(ctx, arrays, prims, nr_prims, ib,
index_bounds_valid, min_index, max_index,
- tfb_vertcount, stream, indirect);
+ num_instances, base_instance,
+ tfb_vertcount, stream);
}
static void
const struct _mesa_index_buffer *ib,
GLboolean index_bounds_valid,
GLuint min_index, GLuint max_index,
+ GLuint num_instances, GLuint base_instance,
struct gl_transform_feedback_object *tfb_vertcount,
- unsigned stream,
- struct gl_buffer_object *indirect)
+ unsigned stream)
{
/* Borrow and update the inputs list from the tnl context */
- _tnl_bind_inputs(ctx);
+ const struct tnl_vertex_array* arrays = _tnl_bind_inputs(ctx);
- TAG(vbo_check_render_prims)(ctx, ctx->Array._DrawArrays,
+ TAG(vbo_check_render_prims)(ctx, arrays,
prims, nr_prims, ib,
index_bounds_valid, min_index, max_index,
- tfb_vertcount, stream, indirect);
+ num_instances, base_instance,
+ tfb_vertcount, stream);
}
void
/* Overwrite our draw function */
ctx->Driver.Draw = TAG(vbo_draw);
- vbo_use_buffer_objects(ctx);
}
void