X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fvbo%2Fvbo_private.h;h=97cd277640051b0a3acee089a0f9dfd961e666b9;hb=9005c9cae40b93dee36a57cbf2a2917fd6902235;hp=2640f3e21f9cd6079687feb5d85821d200bb657f;hpb=c757e416ce9547d3335f350fc02c0261d9e006de;p=mesa.git diff --git a/src/mesa/vbo/vbo_private.h b/src/mesa/vbo/vbo_private.h index 2640f3e21f9..97cd2776400 100644 --- a/src/mesa/vbo/vbo_private.h +++ b/src/mesa/vbo/vbo_private.h @@ -35,39 +35,23 @@ #include "vbo/vbo_attrib.h" #include "vbo/vbo_exec.h" #include "vbo/vbo_save.h" -#include "main/mtypes.h" #include "main/varray.h" +#include "main/macros.h" struct _glapi_table; -struct _mesa_prim; - - -struct vbo_context { - struct gl_vertex_array currval[VBO_ATTRIB_MAX]; - /* The array of inputs used for _DrawVAO draws. */ - struct vbo_inputs draw_arrays; - - struct vbo_exec_context exec; - struct vbo_save_context save; - - /* Callback into the driver. This must always succeed, the driver - * is responsible for initiating any fallback actions required: - */ - vbo_draw_func draw_prims; - - /* Optional callback for indirect draws. This allows multidraws to not be - * broken up, as well as for the actual count to be passed in as a separate - * indirect parameter. - */ - vbo_indirect_draw_func draw_indirect_prims; -}; - static inline struct vbo_context * vbo_context(struct gl_context *ctx) { - return ctx->vbo_context; + return &ctx->vbo_context; +} + + +static inline const struct vbo_context * +vbo_context_const(const struct gl_context *ctx) +{ + return &ctx->vbo_context; } @@ -108,8 +92,8 @@ vbo_attrtype_to_double_flag(GLenum format) case GL_FLOAT: case GL_INT: case GL_UNSIGNED_INT: - case GL_UNSIGNED_INT64_ARB: return GL_FALSE; + case GL_UNSIGNED_INT64_ARB: case GL_DOUBLE: return GL_TRUE; default: @@ -119,6 +103,16 @@ vbo_attrtype_to_double_flag(GLenum format) } +static inline void +vbo_set_vertex_format(struct gl_vertex_format* vertex_format, + GLubyte size, GLenum16 type) +{ + _mesa_set_vertex_format(vertex_format, size, type, GL_RGBA, GL_FALSE, + vbo_attrtype_to_integer_flag(type), + vbo_attrtype_to_double_flag(type)); +} + + /** * Return default component values for the given format. * The return type is an array of fi_types, because that's how we declare @@ -129,6 +123,8 @@ vbo_get_default_vals_as_union(GLenum format) { static const GLfloat default_float[4] = { 0, 0, 0, 1 }; static const GLint default_int[4] = { 0, 0, 0, 1 }; + static const GLdouble default_double[4] = { 0, 0, 0, 1 }; + static const uint64_t default_uint64[4] = { 0, 0, 0, 1 }; switch (format) { case GL_FLOAT: @@ -136,6 +132,10 @@ vbo_get_default_vals_as_union(GLenum format) case GL_INT: case GL_UNSIGNED_INT: return (fi_type *)default_int; + case GL_DOUBLE: + return (fi_type *)default_double; + case GL_UNSIGNED_INT64_ARB: + return (fi_type *)default_uint64; default: unreachable("Bad vertex format"); return NULL; @@ -151,8 +151,9 @@ vbo_get_default_vals_as_union(GLenum format) static inline unsigned vbo_compute_max_verts(const struct vbo_exec_context *exec) { - unsigned n = (VBO_VERT_BUFFER_SIZE - exec->vtx.buffer_used) / - (exec->vtx.vertex_size * sizeof(GLfloat)); + unsigned n = (exec->ctx->Const.glBeginEndBufferSize - + exec->vtx.buffer_used) / + (exec->vtx.vertex_size * sizeof(GLfloat)); if (n == 0) return 0; /* Subtract one so we're always sure to have room for an extra @@ -167,11 +168,17 @@ void vbo_try_prim_conversion(struct _mesa_prim *p); bool -vbo_can_merge_prims(const struct _mesa_prim *p0, const struct _mesa_prim *p1); - -void -vbo_merge_prims(struct _mesa_prim *p0, const struct _mesa_prim *p1); - +vbo_merge_draws(struct gl_context *ctx, bool in_dlist, + struct _mesa_prim *p0, const struct _mesa_prim *p1); + +unsigned +vbo_copy_vertices(struct gl_context *ctx, + GLenum mode, + struct _mesa_prim *last_prim, + unsigned vertex_size, + bool in_dlist, + fi_type *dst, + const fi_type *src); /** * Get the filter mask for vbo draws depending on the vertex_processing_mode. @@ -218,9 +225,12 @@ _vbo_set_attrib_format(struct gl_context *ctx, { const GLboolean integer = vbo_attrtype_to_integer_flag(type); const GLboolean doubles = vbo_attrtype_to_double_flag(type); + + if (doubles) + size /= 2; _mesa_update_array_format(ctx, vao, attr, size, type, GL_RGBA, GL_FALSE, integer, doubles, offset); - /* Ptr for userspace arrays */ + vao->NewArrays |= vao->Enabled & VERT_BIT(attr); vao->VertexAttrib[attr].Ptr = ADD_POINTERS(buffer_offset, offset); }