[Mesa-dev] [PATCH 07/28] anv/image: Add a return value to bind_memory_plane

Jason Ekstrand jason at jlekstrand.net
Thu Nov 16 21:28:55 UTC 2017


---
 src/intel/vulkan/anv_image.c | 28 +++++++++++++++++++---------
 1 file changed, 19 insertions(+), 9 deletions(-)

diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c
index ba932ba..41fe3d8 100644
--- a/src/intel/vulkan/anv_image.c
+++ b/src/intel/vulkan/anv_image.c
@@ -599,22 +599,25 @@ anv_DestroyImage(VkDevice _device, VkImage _image,
    vk_free2(&device->alloc, pAllocator, image);
 }
 
-static void anv_image_bind_memory_plane(struct anv_device *device,
-                                        struct anv_image *image,
-                                        uint32_t plane,
-                                        struct anv_device_memory *memory,
-                                        uint32_t memory_offset)
+static VkResult
+anv_image_bind_memory_plane(struct anv_device *device,
+                            struct anv_image *image,
+                            uint32_t plane,
+                            struct anv_device_memory *memory,
+                            uint32_t memory_offset)
 {
    assert(!image->planes[plane].bo_is_owned);
 
    if (!memory) {
       image->planes[plane].bo = NULL;
       image->planes[plane].bo_offset = 0;
-      return;
+      return VK_SUCCESS;
    }
 
    image->planes[plane].bo = memory->bo;
    image->planes[plane].bo_offset = memory_offset;
+
+   return VK_SUCCESS;
 }
 
 VkResult anv_BindImageMemory(
@@ -626,12 +629,16 @@ VkResult anv_BindImageMemory(
    ANV_FROM_HANDLE(anv_device, device, _device);
    ANV_FROM_HANDLE(anv_device_memory, mem, _memory);
    ANV_FROM_HANDLE(anv_image, image, _image);
+   VkResult result;
 
    uint32_t aspect_bit;
    anv_foreach_image_aspect_bit(aspect_bit, image, image->aspects) {
       uint32_t plane =
          anv_image_aspect_to_plane(image->aspects, 1UL << aspect_bit);
-      anv_image_bind_memory_plane(device, image, plane, mem, memoryOffset);
+      result = anv_image_bind_memory_plane(device, image, plane, mem,
+                                           memoryOffset);
+      if (result != VK_SUCCESS)
+         return result;
    }
 
    return VK_SUCCESS;
@@ -643,6 +650,7 @@ VkResult anv_BindImageMemory2KHR(
     const VkBindImageMemoryInfoKHR*             pBindInfos)
 {
    ANV_FROM_HANDLE(anv_device, device, _device);
+   VkResult result;
 
    for (uint32_t i = 0; i < bindInfoCount; i++) {
       const VkBindImageMemoryInfoKHR *bind_info = &pBindInfos[i];
@@ -669,8 +677,10 @@ VkResult anv_BindImageMemory2KHR(
       anv_foreach_image_aspect_bit(aspect_bit, image, aspects) {
          uint32_t plane =
             anv_image_aspect_to_plane(image->aspects, 1UL << aspect_bit);
-         anv_image_bind_memory_plane(device, image, plane,
-                                     mem, bind_info->memoryOffset);
+         result = anv_image_bind_memory_plane(device, image, plane,
+                                              mem, bind_info->memoryOffset);
+         if (result != VK_SUCCESS)
+            return result;
       }
    }
 
-- 
2.5.0.400.gff86faf



More information about the mesa-dev mailing list