mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-04 05:28:05 +02:00
mesa: Simplify _mesa_primitive_restart_index().
We can use a simple shift equation rather than a switch statement. Reviewed-by: Rafael Antognolli <rafael.antognolli@intel.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com>
This commit is contained in:
parent
314657dc11
commit
8c5a938171
1 changed files with 2 additions and 10 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue