vulkan/wsi: fix -Wnarrowing warning
authorMichel Zou <xantares09@hotmail.com>
Thu, 13 Apr 2023 17:03:56 +0000 (19:03 +0200)
committerMarge Bot <emma+marge@anholt.net>
Thu, 20 Apr 2023 03:33:51 +0000 (03:33 +0000)
else I get this output:

[11/600] Compiling C++ object src/vulkan/wsi/libvulkan_wsi.a.p/wsi_common_win32.cpp.obj
../src/vulkan/wsi/wsi_common_win32.cpp: In function 'VkResult wsi_win32_surface_create_swapchain_dxgi(wsi_win32_surface*, VkDevice, wsi_win32*, const VkSwapchainCreateInfoKHR*, wsi_win32_swapchain*)':
../src/vulkan/wsi/wsi_common_win32.cpp:757:65: warning: narrowing conversion of '((((int)chain->wsi_win32_swapchain::base.wsi_swapchain::present_mode) == ((int)VK_PRESENT_MODE_IMMEDIATE_KHR)) ? ((int)DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING) : 0)' from 'int' to 'UINT' {aka 'unsigned int'} [-Wnarrowing]
  757 |       chain->base.present_mode == VK_PRESENT_MODE_IMMEDIATE_KHR ?
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
  758 |          DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING : 0
      |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

fixes: d7730fcf22adae92b0e7a82e36cfe28200920b5f

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22475>

src/vulkan/wsi/wsi_common_win32.cpp

index 0456666..329e587 100644 (file)
@@ -755,7 +755,7 @@ wsi_win32_surface_create_swapchain_dxgi(
       DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL,
       DXGI_ALPHA_MODE_UNSPECIFIED,
       chain->base.present_mode == VK_PRESENT_MODE_IMMEDIATE_KHR ?
-         DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING : 0
+         DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING : 0u
    };
 
    if (create_info->imageUsage &