Mesa (master): mesa: split _mesa_primitive_restart_index into a function without gl_context
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Apr 6 15:04:57 UTC 2020
Module: Mesa
Branch: master
Commit: e69e59778c53c7176519c63fb961952e4596dfa0
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=e69e59778c53c7176519c63fb961952e4596dfa0
Author: Marek Olšák <marek.olsak at amd.com>
Date: Fri Mar 20 23:58:33 2020 -0400
mesa: split _mesa_primitive_restart_index into a function without gl_context
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4466>
---
src/mesa/main/varray.h | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/src/mesa/main/varray.h b/src/mesa/main/varray.h
index 6a549d2a5f0..c596c277cf6 100644
--- a/src/mesa/main/varray.h
+++ b/src/mesa/main/varray.h
@@ -321,10 +321,10 @@ extern void GLAPIENTRY
_mesa_VertexArrayVertexAttribDivisorEXT(GLuint vaobj, GLuint index, GLuint divisor);
static inline unsigned
-_mesa_primitive_restart_index(const struct gl_context *ctx,
- unsigned index_size)
+_mesa_get_prim_restart_index(bool fixed_index, unsigned restart_index,
+ unsigned index_size)
{
- /* The index_size parameter is menat to be in bytes. */
+ /* The index_size parameter is meant to be in bytes. */
assert(index_size == 1 || index_size == 2 || index_size == 4);
/* From the OpenGL 4.3 core specification, page 302:
@@ -332,12 +332,20 @@ _mesa_primitive_restart_index(const struct gl_context *ctx,
* enabled, the index value determined by PRIMITIVE_RESTART_FIXED_INDEX
* is used."
*/
- if (ctx->Array.PrimitiveRestartFixedIndex) {
+ if (fixed_index) {
/* 1 -> 0xff, 2 -> 0xffff, 4 -> 0xffffffff */
return 0xffffffffu >> 8 * (4 - index_size);
}
- return ctx->Array.RestartIndex;
+ return restart_index;
+}
+
+static inline unsigned
+_mesa_primitive_restart_index(const struct gl_context *ctx,
+ unsigned index_size)
+{
+ return _mesa_get_prim_restart_index(ctx->Array.PrimitiveRestartFixedIndex,
+ ctx->Array.RestartIndex, index_size);
}
extern void GLAPIENTRY
More information about the mesa-commit
mailing list