From cf929823bf8253388a863fa495844380060f68fb Mon Sep 17 00:00:00 2001 From: =?utf8?q?Mathias=20Fr=C3=B6hlich?= Date: Tue, 11 Dec 2018 18:45:43 +0100 Subject: [PATCH] mesa: Provide gl_vertex_format accessors. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Provide the same set of VAO and current value gl_vertex_format accessor functions like we have for the gl_array_attributes. For most purpose the vertex format is what we need. v2: Style fixes. Reviewed-by: Matt Turner Reviewed-by: Ian Romanick Signed-off-by: Mathias Fröhlich Part-of: --- src/mesa/main/arrayobj.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/mesa/main/arrayobj.h b/src/mesa/main/arrayobj.h index c7423f106ff..94e22348248 100644 --- a/src/mesa/main/arrayobj.h +++ b/src/mesa/main/arrayobj.h @@ -262,6 +262,17 @@ _mesa_draw_array_attrib(const struct gl_vertex_array_object *vao, } +/** + * Return a vertex array vertex format provided the attribute number. + */ +static inline const struct gl_vertex_format * +_mesa_draw_array_format(const struct gl_vertex_array_object *vao, + gl_vert_attrib attr) +{ + return &_mesa_draw_array_attrib(vao, attr)->Format; +} + + /** * Return vertex buffer binding provided an attribute number. */ @@ -321,6 +332,16 @@ _mesa_draw_current_attrib(const struct gl_context *ctx, gl_vert_attrib attr) } +/** + * Return a current value vertex format provided the attribute number. + */ +static inline const struct gl_vertex_format * +_mesa_draw_current_format(const struct gl_context *ctx, gl_vert_attrib attr) +{ + return &_vbo_current_attrib(ctx, attr)->Format; +} + + /** * Return true if we have the VERT_ATTRIB_EDGEFLAG array enabled. */ -- 2.30.2