diff options
author | Marek Olšák <[email protected]> | 2017-04-02 19:07:49 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2017-04-22 22:51:15 +0200 |
commit | 070072ad43bb41624d271f10697ea21a776b1ec1 (patch) | |
tree | 2f88efd83530f8a71e4dec1634378020a8826565 /src/mesa/main | |
parent | e137b9eed9501858e2037719a94aafee35179249 (diff) |
mesa: replace _mesa_index_buffer::type with index_size
This avoids repeated translations of the enum.
Reviewed-by: Ilia Mirkin <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa/main')
-rw-r--r-- | src/mesa/main/varray.c | 13 | ||||
-rw-r--r-- | src/mesa/main/varray.h | 3 |
2 files changed, 9 insertions, 7 deletions
diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c index e1d6bc677f5..78dc004637f 100644 --- a/src/mesa/main/varray.c +++ b/src/mesa/main/varray.c @@ -1804,7 +1804,8 @@ _mesa_VertexAttribDivisor(GLuint index, GLuint divisor) unsigned -_mesa_primitive_restart_index(const struct gl_context *ctx, GLenum ib_type) +_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 @@ -1812,15 +1813,15 @@ _mesa_primitive_restart_index(const struct gl_context *ctx, GLenum ib_type) * is used." */ if (ctx->Array.PrimitiveRestartFixedIndex) { - switch (ib_type) { - case GL_UNSIGNED_BYTE: + switch (index_size) { + case 1: return 0xff; - case GL_UNSIGNED_SHORT: + case 2: return 0xffff; - case GL_UNSIGNED_INT: + case 4: return 0xffffffff; default: - assert(!"_mesa_primitive_restart_index: Invalid index buffer type."); + assert(!"_mesa_primitive_restart_index: Invalid index size."); } } diff --git a/src/mesa/main/varray.h b/src/mesa/main/varray.h index 92165710d8e..d274ec55fe7 100644 --- a/src/mesa/main/varray.h +++ b/src/mesa/main/varray.h @@ -312,7 +312,8 @@ extern void GLAPIENTRY _mesa_VertexAttribDivisor(GLuint index, GLuint divisor); extern unsigned -_mesa_primitive_restart_index(const struct gl_context *ctx, GLenum ib_type); +_mesa_primitive_restart_index(const struct gl_context *ctx, + unsigned index_size); extern void GLAPIENTRY _mesa_BindVertexBuffer(GLuint bindingIndex, GLuint buffer, GLintptr offset, |