aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/main/varray.h
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2017-08-18 15:48:13 -0600
committerBrian Paul <[email protected]>2017-08-21 19:04:51 -0600
commit19e9bd4c117f9f38f4fdec0467a57f0e29e5c0f3 (patch)
treef032bdb79bc1eba94540a7ec9efa32a2cf15a9c0 /src/mesa/main/varray.h
parent0ef5aa4128940f6d60f3442b1cfcbdb8f3614c8e (diff)
mesa: optimize _mesa_attr_zero_aliases_vertex()
After the context is initialized, the API and context flags won't change. So, we can compute whether vertex attribute 0 aliases vertex position just once. This should make the glVertexAttrib*() functions a little quicker. Reviewed-by: Samuel Pitoiset <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/mesa/main/varray.h')
-rw-r--r--src/mesa/main/varray.h14
1 files changed, 2 insertions, 12 deletions
diff --git a/src/mesa/main/varray.h b/src/mesa/main/varray.h
index 730f7cf3588..927a1ada38a 100644
--- a/src/mesa/main/varray.h
+++ b/src/mesa/main/varray.h
@@ -73,19 +73,9 @@ _mesa_update_client_array(struct gl_context *ctx,
}
static inline bool
-_mesa_attr_zero_aliases_vertex(struct gl_context *ctx)
+_mesa_attr_zero_aliases_vertex(const struct gl_context *ctx)
{
- const bool is_forward_compatible_context =
- ctx->Const.ContextFlags & GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT;
-
- /* In OpenGL 3.1 attribute 0 becomes non-magic, just like in OpenGL ES
- * 2.0. Note that we cannot just check for API_OPENGL_COMPAT here because
- * that will erroneously allow this usage in a 3.0 forward-compatible
- * context too.
- */
- return (ctx->API == API_OPENGLES
- || (ctx->API == API_OPENGL_COMPAT
- && !is_forward_compatible_context));
+ return ctx->_AttribZeroAliasesVertex;
}
extern void