From: Chad Versace Date: Thu, 28 May 2015 16:50:26 +0000 (-0700) Subject: vk: Add anv_minify() X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f7fb7575ef6ebdcb88d4e62d48730a88de999410;p=mesa.git vk: Add anv_minify() --- diff --git a/src/vulkan/private.h b/src/vulkan/private.h index db7f5f30af3..6693a288866 100644 --- a/src/vulkan/private.h +++ b/src/vulkan/private.h @@ -72,6 +72,15 @@ ALIGN_I32(int32_t v, int32_t a) return (v + a - 1) & ~(a - 1); } +static inline uint32_t +anv_minify(uint32_t n, uint32_t levels) +{ + if (unlikely(n == 0)) + return 0; + else + return MAX(n >> levels, 1); +} + #define for_each_bit(b, dword) \ for (uint32_t __dword = (dword); \ (b) = __builtin_ffs(__dword) - 1, __dword; \