diff options
author | Kenneth Graunke <[email protected]> | 2017-05-06 16:11:03 -0700 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2017-05-09 12:07:34 -0700 |
commit | d4fa0a0fa63c538b0c67ec3c46a45c1e4dcf91fc (patch) | |
tree | 5ba591497b62758fa2facd66eef5a9b6c05338ac /src | |
parent | db6f38cb6a43f315f4e2aa613eae02d5a451295c (diff) |
mesa: Make _mesa_primitive_restart_index a static inline in the header.
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 <[email protected]>
Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/main/varray.c | 18 | ||||
-rw-r--r-- | src/mesa/main/varray.h | 17 |
2 files changed, 15 insertions, 20 deletions
diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c index 9497090e88a..0eb8e623dcc 100644 --- a/src/mesa/main/varray.c +++ b/src/mesa/main/varray.c @@ -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 */ diff --git a/src/mesa/main/varray.h b/src/mesa/main/varray.h index ac49434ab90..2d184adf8bc 100644 --- a/src/mesa/main/varray.h +++ b/src/mesa/main/varray.h @@ -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, |