mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Clean scaling pre-filter for formspec/HUD.
This commit is contained in:
parent
b4247dff2e
commit
6d61375cc7
20 changed files with 524 additions and 102 deletions
|
@ -411,5 +411,16 @@ inline bool is_power_of_two(u32 n)
|
|||
return n != 0 && (n & (n-1)) == 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
// Compute next-higher power of 2 efficiently, e.g. for power-of-2 texture sizes.
|
||||
// Public Domain: https://graphics.stanford.edu/~seander/bithacks.html#RoundUpPowerOf2
|
||||
inline u32 npot2(u32 orig) {
|
||||
orig--;
|
||||
orig |= orig >> 1;
|
||||
orig |= orig >> 2;
|
||||
orig |= orig >> 4;
|
||||
orig |= orig >> 8;
|
||||
orig |= orig >> 16;
|
||||
return orig + 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue