OSDN Git Service

vk: Add anv_minify()
authorChad Versace <chad.versace@intel.com>
Thu, 28 May 2015 16:50:26 +0000 (09:50 -0700)
committerChad Versace <chad.versace@intel.com>
Thu, 25 Jun 2015 23:52:05 +0000 (16:52 -0700)
src/vulkan/private.h

index db7f5f3..6693a28 100644 (file)
@@ -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;      \