Mesa (master): vulkan/wsi: Convert usage of -1 to UINT32_MAX.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jul 27 11:41:56 UTC 2020


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

Author: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
Date:   Mon Jul 27 11:52:24 2020 +0200

vulkan/wsi: Convert usage of -1 to UINT32_MAX.

The integers are unsigned so they do the same but this makes it
locally more clear what happened.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6071>

---

 src/vulkan/wsi/wsi_common_wayland.c | 4 ++--
 src/vulkan/wsi/wsi_common_x11.c     | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/vulkan/wsi/wsi_common_wayland.c b/src/vulkan/wsi/wsi_common_wayland.c
index 23f5765c57c..e219b263fc5 100644
--- a/src/vulkan/wsi/wsi_common_wayland.c
+++ b/src/vulkan/wsi/wsi_common_wayland.c
@@ -551,7 +551,7 @@ wsi_wl_surface_get_capabilities(VkIcdSurfaceBase *surface,
    /* There is no real maximum */
    caps->maxImageCount = 0;
 
-   caps->currentExtent = (VkExtent2D) { -1, -1 };
+   caps->currentExtent = (VkExtent2D) { UINT32_MAX, UINT32_MAX };
    caps->minImageExtent = (VkExtent2D) { 1, 1 };
    caps->maxImageExtent = (VkExtent2D) {
       wsi_device->maxImageDimension2D,
@@ -695,7 +695,7 @@ wsi_wl_surface_get_present_rectangles(VkIcdSurfaceBase *surface,
       /* We don't know a size so just return the usual "I don't know." */
       *rect = (VkRect2D) {
          .offset = { 0, 0 },
-         .extent = { -1, -1 },
+         .extent = { UINT32_MAX, UINT32_MAX },
       };
    }
 
diff --git a/src/vulkan/wsi/wsi_common_x11.c b/src/vulkan/wsi/wsi_common_x11.c
index 306dcd9a73e..566926845f9 100644
--- a/src/vulkan/wsi/wsi_common_x11.c
+++ b/src/vulkan/wsi/wsi_common_x11.c
@@ -512,7 +512,7 @@ x11_surface_get_capabilities(VkIcdSurfaceBase *icd_surface,
        * to come back from the compositor.  In that case, we don't know the
        * size of the window so we just return valid "I don't know" stuff.
        */
-      caps->currentExtent = (VkExtent2D) { -1, -1 };
+      caps->currentExtent = (VkExtent2D) { UINT32_MAX, UINT32_MAX };
       caps->minImageExtent = (VkExtent2D) { 1, 1 };
       caps->maxImageExtent = (VkExtent2D) {
          wsi_device->maxImageDimension2D,
@@ -681,7 +681,7 @@ x11_surface_get_present_rectangles(VkIcdSurfaceBase *icd_surface,
           */
          *rect = (VkRect2D) {
             .offset = { 0, 0 },
-            .extent = { -1, -1 },
+            .extent = { UINT32_MAX, UINT32_MAX },
          };
       }
       free(geom);



More information about the mesa-commit mailing list