From: Mathias Fröhlich Date: Tue, 11 Dec 2018 17:45:43 +0000 (+0100) Subject: mesa: Provide gl_vertex_format accessors. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=cf929823bf8253388a863fa495844380060f68fb;p=mesa.git mesa: Provide gl_vertex_format accessors. 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: --- 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. */