Module: Mesa
Branch: master
Commit: 891d237667175b91e6c1b1a91be494cd30e6f22c
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=891d237667175b91e6c1b1a91be494cd30e6f22c

Author: Chad Versace <[email protected]>
Date:   Fri Nov  3 12:44:34 2017 -0700

anv: Simplify anv_physical_device_get_format_properties()

Now that get_image_format_properties() returns the correct
VkFormatFeatureFlags, we can remove the unneeded if-branch and some
local variables.

Reviewed-by: Jason Ekstrand <[email protected]>
Reviewed-by: Lionel Landwerlin <[email protected]>

---

 src/intel/vulkan/anv_formats.c | 25 +++++++++----------------
 1 file changed, 9 insertions(+), 16 deletions(-)

diff --git a/src/intel/vulkan/anv_formats.c b/src/intel/vulkan/anv_formats.c
index 6ecd32b532..d662e336d8 100644
--- a/src/intel/vulkan/anv_formats.c
+++ b/src/intel/vulkan/anv_formats.c
@@ -657,25 +657,18 @@ anv_physical_device_get_format_properties(struct 
anv_physical_device *physical_d
                                           VkFormatProperties *out_properties)
 {
    const struct gen_device_info *devinfo = &physical_device->info;
-   const struct anv_format *format = anv_get_format(vk_format);
-   VkFormatFeatureFlags linear = 0, tiled = 0;
-
-   if (format == NULL) {
-      /* Nothing to do here */
-   } else {
-      linear = get_image_format_features(&physical_device->info, vk_format,
-                                         format, VK_IMAGE_TILING_LINEAR);
-      tiled = get_image_format_features(&physical_device->info, vk_format,
-                                        format, VK_IMAGE_TILING_OPTIMAL);
-   }
-
-   out_properties->linearTilingFeatures = linear;
-   out_properties->optimalTilingFeatures = tiled;
+   const struct anv_format *anv_format = anv_get_format(vk_format);
+
+   out_properties->linearTilingFeatures =
+      get_image_format_features(devinfo, vk_format, anv_format,
+                                VK_IMAGE_TILING_LINEAR);
+   out_properties->optimalTilingFeatures =
+      get_image_format_features(devinfo, vk_format, anv_format,
+                                VK_IMAGE_TILING_OPTIMAL);
    out_properties->bufferFeatures =
-      get_buffer_format_features(devinfo, vk_format, format);
+      get_buffer_format_features(devinfo, vk_format, anv_format);
 }
 
-
 void anv_GetPhysicalDeviceFormatProperties(
     VkPhysicalDevice                            physicalDevice,
     VkFormat                                    format,

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to