anv/dump: Take an aspect in dump_image_to_ppm
authorJason Ekstrand <jason.ekstrand@intel.com>
Tue, 14 Jun 2016 00:08:59 +0000 (17:08 -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
src/intel/vulkan/anv_private.h

index 63ad2cd070a3a6a9a9b1a774095e17b7e82bff53..307e501a593673ce576c4b3118ae8f1c5177eb06 100644 (file)
@@ -30,7 +30,8 @@
 void
 anv_dump_image_to_ppm(struct anv_device *device,
                       struct anv_image *image, unsigned miplevel,
-                      unsigned array_layer, const char *filename)
+                      unsigned array_layer, VkImageAspectFlagBits aspect,
+                      const char *filename)
 {
    VkDevice vk_device = anv_device_to_handle(device);
    MAYBE_UNUSED VkResult result;
@@ -98,12 +99,15 @@ anv_dump_image_to_ppm(struct anv_device *device,
       });
    assert(result == VK_SUCCESS);
 
+   VkImageUsageFlags old_usage = image->usage;
+   image->usage |= VK_IMAGE_USAGE_SAMPLED_BIT;
+
    anv_CmdBlitImage(cmd,
       anv_image_to_handle(image), VK_IMAGE_LAYOUT_GENERAL,
       copy_image, VK_IMAGE_LAYOUT_GENERAL, 1,
       &(VkImageBlit) {
          .srcSubresource = {
-            .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
+            .aspectMask = aspect,
             .mipLevel = miplevel,
             .baseArrayLayer = array_layer,
             .layerCount = 1,
@@ -124,6 +128,8 @@ anv_dump_image_to_ppm(struct anv_device *device,
          },
       }, VK_FILTER_NEAREST);
 
+   image->usage = old_usage;
+
    ANV_CALL(CmdPipelineBarrier)(cmd,
       VK_PIPELINE_STAGE_TRANSFER_BIT,
       VK_PIPELINE_STAGE_TRANSFER_BIT,
index 8c2ffd8a8e9f2f05f01697387e255b59277a41cf..673b4ed061c96d2850c821669b8695f9a3f82b12 100644 (file)
@@ -1845,7 +1845,8 @@ void *anv_lookup_entrypoint(const char *name);
 
 void anv_dump_image_to_ppm(struct anv_device *device,
                            struct anv_image *image, unsigned miplevel,
-                           unsigned array_layer, const char *filename);
+                           unsigned array_layer, VkImageAspectFlagBits aspect,
+                           const char *filename);
 
 #define ANV_DEFINE_HANDLE_CASTS(__anv_type, __VkType)                      \
                                                                            \