From 28c2c0fedc947ca1de8f699df19c98b3529890b3 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 20 Aug 2025 07:20:30 -0400 Subject: [PATCH] mesa/varray: inline a bunch of functions this cuts the cpu time of update_array() in viewperf catia by 80% Reviewed-by: Christian Gmeiner Part-of: --- src/mesa/main/varray.c | 8 ++++---- src/mesa/main/varray.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c index 7ab8f9e9503..3bf6dc0e8a0 100644 --- a/src/mesa/main/varray.c +++ b/src/mesa/main/varray.c @@ -671,7 +671,7 @@ static const uint8_t bgra_vertex_formats[4][2] = { /** * Return a PIPE_FORMAT_x for the given GL datatype and size. */ -static enum pipe_format +ALWAYS_INLINE static enum pipe_format vertex_format_to_pipe_format(GLubyte size, GLenum16 type, GLenum16 format, bool normalized, bool integer, bool doubles) { @@ -705,7 +705,7 @@ vertex_format_to_pipe_format(GLubyte size, GLenum16 type, GLenum16 format, return pipe_format; } -static void +ALWAYS_INLINE static void set_vertex_format_user(union gl_vertex_format_user *vertex_format, GLubyte size, GLenum16 type, GLenum16 format, GLboolean normalized, GLboolean integer, @@ -720,7 +720,7 @@ set_vertex_format_user(union gl_vertex_format_user *vertex_format, vertex_format->Doubles = doubles; } -static void +ALWAYS_INLINE static void recompute_vertex_format_fields(struct gl_vertex_format *vertex_format, GLubyte size, GLenum16 type, GLenum16 format, GLboolean normalized, GLboolean integer, @@ -830,7 +830,7 @@ get_array_format(const struct gl_context *ctx, GLint sizeMax, GLint *size) * \param relativeOffset Offset of the first element relative to the binding * offset. */ -void +ALWAYS_INLINE void _mesa_update_array_format(struct gl_context *ctx, struct gl_vertex_array_object *vao, gl_vert_attrib attrib, GLint size, GLenum type, diff --git a/src/mesa/main/varray.h b/src/mesa/main/varray.h index 98412547115..4c64015242e 100644 --- a/src/mesa/main/varray.h +++ b/src/mesa/main/varray.h @@ -186,7 +186,7 @@ _mesa_update_edgeflag_state_vao(struct gl_context *ctx); * \param comps number of components. * \param type data type. */ -static inline int +ALWAYS_INLINE static int _mesa_bytes_per_vertex_attrib(int comps, GLenum type) { /* This has comps = 3, but should return 4, so it's difficult to