anv: Make anv_get_layerCount a macro
authorJason Ekstrand <jason.ekstrand@intel.com>
Fri, 24 Mar 2017 23:20:18 +0000 (16:20 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Tue, 28 Mar 2017 21:41:47 +0000 (14:41 -0700)
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: "13.0 17.0" <mesa-stable@lists.freedesktop.org>
src/intel/vulkan/anv_private.h

index 27c887c65cc41e5111ba229e9a236ef29c0d36b5..74e80e8d537c9dc138d2d63b5d7440bc80611840 100644 (file)
@@ -1828,13 +1828,13 @@ anv_layout_to_aux_usage(const struct gen_device_info * const devinfo,
                         const struct anv_image *image,
                         const VkImageAspectFlags aspects,
                         const VkImageLayout layout);
-static inline uint32_t
-anv_get_layerCount(const struct anv_image *image,
-                   const VkImageSubresourceRange *range)
-{
-   return range->layerCount == VK_REMAINING_ARRAY_LAYERS ?
-          image->array_size - range->baseArrayLayer : range->layerCount;
-}
+
+/* This is defined as a macro so that it works for both
+ * VkImageSubresourceRange and VkImageSubresourceLayers
+ */
+#define anv_get_layerCount(_image, _range) \
+   ((_range)->layerCount == VK_REMAINING_ARRAY_LAYERS ? \
+    (_image)->array_size - (_range)->baseArrayLayer : (_range)->layerCount)
 
 static inline uint32_t
 anv_get_levelCount(const struct anv_image *image,