anv/dump: Use anv_minify instead of hand-rolling it
authorJason Ekstrand <jason.ekstrand@intel.com>
Wed, 15 Jun 2016 21:30:07 +0000 (14:30 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Sun, 10 Jul 2016 03:58:33 +0000 (20:58 -0700)
Reviewed-by: Chad Versace <chad.versace@intel.com>
src/intel/vulkan/anv_dump.c

index 307e501a593673ce576c4b3118ae8f1c5177eb06..ffb892c17ac7ca837a35d7c179b64124ae324338 100644 (file)
@@ -36,11 +36,10 @@ anv_dump_image_to_ppm(struct anv_device *device,
    VkDevice vk_device = anv_device_to_handle(device);
    MAYBE_UNUSED VkResult result;
 
-   VkExtent2D extent = { image->extent.width, image->extent.height };
-   for (unsigned i = 0; i < miplevel; i++) {
-      extent.width = MAX2(1, extent.width / 2);
-      extent.height = MAX2(1, extent.height / 2);
-   }
+   VkExtent2D extent = {
+      anv_minify(image->extent.width, miplevel),
+      anv_minify(image->extent.height, miplevel),
+   };
 
    VkImage copy_image;
    result = anv_CreateImage(vk_device,