mesa: Make _mesa_primitive_restart_index a static inline in the header.
authorKenneth Graunke <kenneth@whitecape.org>
Sat, 6 May 2017 23:11:03 +0000 (16:11 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Tue, 9 May 2017 19:07:34 +0000 (12:07 -0700)
It's now basically a single expression, so it probably makes sense to
have it inlined into the callers.

Suggested by Marek.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/mesa/main/varray.c
src/mesa/main/varray.h

index 9497090e88a77f3bc5d3adb0709343a2dd00f1d4..0eb8e623dccf0e2a0e80a16861f422428b418170 100644 (file)
@@ -1949,24 +1949,6 @@ _mesa_VertexAttribDivisor(GLuint index, GLuint divisor)
 }
 
 
-unsigned
-_mesa_primitive_restart_index(const struct gl_context *ctx,
-                              unsigned index_size)
-{
-   /* From the OpenGL 4.3 core specification, page 302:
-    * "If both PRIMITIVE_RESTART and PRIMITIVE_RESTART_FIXED_INDEX are
-    *  enabled, the index value determined by PRIMITIVE_RESTART_FIXED_INDEX
-    *  is used."
-    */
-   if (ctx->Array.PrimitiveRestartFixedIndex) {
-      /* 1 -> 0xff, 2 -> 0xffff, 4 -> 0xffffffff */
-      return 0xffffffffu >> 8 * (4 - index_size);
-   }
-
-   return ctx->Array.RestartIndex;
-}
-
-
 /**
  * GL_ARB_vertex_attrib_binding
  */
index ac49434ab900ec816d02792d0b1f83540229b1c3..2d184adf8bc0c8f380193c106bd55b79b1b140bb 100644 (file)
@@ -343,9 +343,22 @@ _mesa_VertexAttribDivisor_no_error(GLuint index, GLuint divisor);
 extern void GLAPIENTRY
 _mesa_VertexAttribDivisor(GLuint index, GLuint divisor);
 
-extern unsigned
+static inline unsigned
 _mesa_primitive_restart_index(const struct gl_context *ctx,
-                              unsigned index_size);
+                              unsigned index_size)
+{
+   /* From the OpenGL 4.3 core specification, page 302:
+    * "If both PRIMITIVE_RESTART and PRIMITIVE_RESTART_FIXED_INDEX are
+    *  enabled, the index value determined by PRIMITIVE_RESTART_FIXED_INDEX
+    *  is used."
+    */
+   if (ctx->Array.PrimitiveRestartFixedIndex) {
+      /* 1 -> 0xff, 2 -> 0xffff, 4 -> 0xffffffff */
+      return 0xffffffffu >> 8 * (4 - index_size);
+   }
+
+   return ctx->Array.RestartIndex;
+}
 
 extern void GLAPIENTRY
 _mesa_BindVertexBuffer(GLuint bindingIndex, GLuint buffer, GLintptr offset,