From d1698d4311a63e1054e458ae1a27d7684595faee Mon Sep 17 00:00:00 2001 From: Mathias Fröhlich Date: Sun, 1 Apr 2018 20:18:36 +0200 Subject: mesa: Compute effective buffer bindings in the vao. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Compute VAO buffer binding information past the position/generic0 mapping. Scan for duplicate buffer bindings and collapse them into derived effective buffer binding index and effective attribute mask variables. Provide a set of helper functions to access the distilled information in the VAO. All of them prefixed with _mesa_draw_... to indicate that they are meant to query draw information. v2: Also group user space arrays containing interleaved arrays. Add _Eff*Offset to be copied on attribute and binding copy. Update comments. Reviewed-by: Brian Paul Signed-off-by: Mathias Fröhlich --- src/mesa/vbo/vbo_private.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/mesa/vbo/vbo_private.h') diff --git a/src/mesa/vbo/vbo_private.h b/src/mesa/vbo/vbo_private.h index 589c61d675e..b69f836aa0b 100644 --- a/src/mesa/vbo/vbo_private.h +++ b/src/mesa/vbo/vbo_private.h @@ -60,6 +60,13 @@ vbo_context(struct gl_context *ctx) } +static inline const struct vbo_context * +vbo_context_const(const struct gl_context *ctx) +{ + return ctx->vbo_context; +} + + /** * Array to apply the fixed function material aliasing map to * an attribute value used in vbo processing inputs to an attribute @@ -209,7 +216,12 @@ _vbo_set_attrib_format(struct gl_context *ctx, const GLboolean doubles = vbo_attrtype_to_double_flag(type); _mesa_update_array_format(ctx, vao, attr, size, type, GL_RGBA, GL_FALSE, integer, doubles, offset); - /* Ptr for userspace arrays */ + /* Ptr for userspace arrays. + * For updating the pointer we would need to add the vao->NewArrays flag + * to the VAO. But but that is done already unconditionally in + * _mesa_update_array_format called above. + */ + assert((vao->NewArrays | ~vao->_Enabled) & VERT_BIT(attr)); vao->VertexAttrib[attr].Ptr = ADD_POINTERS(buffer_offset, offset); } -- cgit v1.2.3