vulkan/wsi: fix -Wnarrowing warning

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: d7730fcf22

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22475>
(cherry picked from commit d5871d21a5)
This commit is contained in:
Michel Zou 2023-04-13 19:03:56 +02:00 committed by Eric Engestrom
parent 7dc2f320f3
commit 5d5d1a17fc
2 changed files with 2 additions and 2 deletions

View file

@ -193,7 +193,7 @@
"description": "vulkan/wsi: fix -Wnarrowing warning",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "d7730fcf22adae92b0e7a82e36cfe28200920b5f"
},

View 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 &