From f7fb7575ef6ebdcb88d4e62d48730a88de999410 Mon Sep 17 00:00:00 2001 From: Chad Versace Date: Thu, 28 May 2015 09:50:26 -0700 Subject: [PATCH] vk: Add anv_minify() --- src/vulkan/private.h | 9 +++++++++ 1 file changed, 9 insertions(+) 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; \ -- 2.30.2