[Mesa-dev] [PATCH 1/3] mesa: Simplify _mesa_primitive_restart_index().
Rafael Antognolli
rafael.antognolli at intel.com
Thu May 4 18:32:58 UTC 2017
Reviewed-by: Rafael Antognolli <rafael.antognolli at intel.com>
On Thu, May 04, 2017 at 08:13:05AM -0700, Kenneth Graunke wrote:
> We can use a simple shift equation rather than a switch statement.
> ---
> src/mesa/main/varray.c | 12 ++----------
> 1 file 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;
> --
> 2.12.2
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list