diff options
author | Kenneth Graunke <[email protected]> | 2017-05-04 01:08:25 -0700 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2017-05-06 15:43:43 -0700 |
commit | 8c5a938171d0566b087fdfb5c422464aa005e8ed (patch) | |
tree | ce851732103161f4d8df39ee31b6cc9c3a5c401b | |
parent | 314657dc11db651268ce5a0c9713337ddc68fe31 (diff) |
mesa: Simplify _mesa_primitive_restart_index().
We can use a simple shift equation rather than a switch statement.
Reviewed-by: Rafael Antognolli <[email protected]>
Reviewed-by: Marek Olšák <[email protected]>
-rw-r--r-- | src/mesa/main/varray.c | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c index eda86ec6a82..9497090e88a 100644 --- a/src/mesa/main/varray.c +++ b/src/mesa/main/varray.c @@ -1959,16 +1959,8 @@ _mesa_primitive_restart_index(const struct gl_context *ctx, * is used." */ if (ctx->Array.PrimitiveRestartFixedIndex) { - switch (index_size) { - case 1: - return 0xff; - case 2: - return 0xffff; - case 4: - return 0xffffffff; - default: - assert(!"_mesa_primitive_restart_index: Invalid index size."); - } + /* 1 -> 0xff, 2 -> 0xffff, 4 -> 0xffffffff */ + return 0xffffffffu >> 8 * (4 - index_size); } return ctx->Array.RestartIndex; |