[Mesa-dev] [RFC v2 10/23] anv/image: Fix return type of make_surface()

2017-08-30 Thread Louis-Francis Ratté-Boulianne
From: Chad Versace 

make_surface() always returns VK_SUCCESS, so change its return type to
'void'. This simplifies the return-code handling in
anv_image_create_info() and removes a goto.
---
 src/intel/vulkan/anv_image.c | 15 ++-
 1 file changed, 2 insertions(+), 13 deletions(-)

diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c
index 313809803a..3d1b3f1e73 100644
--- a/src/intel/vulkan/anv_image.c
+++ b/src/intel/vulkan/anv_image.c
@@ -215,7 +215,7 @@ add_fast_clear_state_buffer(struct anv_image *image,
  *
  * Exactly one bit must be set in \a aspect.
  */
-static VkResult
+static void
 make_surface(const struct anv_device *dev,
  struct anv_image *image,
  const struct anv_image_create_info *anv_info,
@@ -340,8 +340,6 @@ make_surface(const struct anv_device *dev,
  image->aux_usage = ISL_AUX_USAGE_MCS;
   }
}
-
-   return VK_SUCCESS;
 }
 
 VkResult
@@ -353,7 +351,6 @@ anv_image_create(VkDevice _device,
ANV_FROM_HANDLE(anv_device, device, _device);
const VkImageCreateInfo *base_info = anv_info->vk_info;
struct anv_image *image = NULL;
-   VkResult r;
 
assert(base_info->sType == VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO);
 
@@ -382,20 +379,12 @@ anv_image_create(VkDevice _device,
 
uint32_t b;
for_each_bit(b, image->aspects) {
-  r = make_surface(device, image, anv_info, (1 << b));
-  if (r != VK_SUCCESS)
- goto fail;
+  make_surface(device, image, anv_info, (1 << b));
}
 
*pImage = anv_image_to_handle(image);
 
return VK_SUCCESS;
-
-fail:
-   if (image)
-  vk_free2(>alloc, alloc, image);
-
-   return r;
 }
 
 VkResult
-- 
2.13.0

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [RFC v2 10/23] anv/image: Fix return type of make_surface()

2017-07-13 Thread Louis-Francis Ratté-Boulianne
From: Chad Versace 

make_surface() always returns VK_SUCCESS, so change its return type to
'void'. This simplifies the return-code handling in
anv_image_create_info() and removes a goto.
---
 src/intel/vulkan/anv_image.c | 15 ++-
 1 file changed, 2 insertions(+), 13 deletions(-)

diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c
index a440dd391b..de4f9af983 100644
--- a/src/intel/vulkan/anv_image.c
+++ b/src/intel/vulkan/anv_image.c
@@ -138,7 +138,7 @@ add_surface(struct anv_image *image, struct anv_surface 
*surf)
  *
  * Exactly one bit must be set in \a aspect.
  */
-static VkResult
+static void
 make_surface(const struct anv_device *dev,
  struct anv_image *image,
  const struct anv_image_create_info *anv_info,
@@ -246,8 +246,6 @@ make_surface(const struct anv_device *dev,
  image->aux_usage = ISL_AUX_USAGE_MCS;
   }
}
-
-   return VK_SUCCESS;
 }
 
 VkResult
@@ -259,7 +257,6 @@ anv_image_create(VkDevice _device,
ANV_FROM_HANDLE(anv_device, device, _device);
const VkImageCreateInfo *base_info = anv_info->vk_info;
struct anv_image *image = NULL;
-   VkResult r;
 
assert(base_info->sType == VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO);
 
@@ -289,20 +286,12 @@ anv_image_create(VkDevice _device,
 
uint32_t b;
for_each_bit(b, image->aspects) {
-  r = make_surface(device, image, anv_info, (1 << b));
-  if (r != VK_SUCCESS)
- goto fail;
+  make_surface(device, image, anv_info, (1 << b));
}
 
*pImage = anv_image_to_handle(image);
 
return VK_SUCCESS;
-
-fail:
-   if (image)
-  vk_free2(>alloc, alloc, image);
-
-   return r;
 }
 
 VkResult
-- 
2.13.0

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev