vulkan/image: Make MSVC C++ compiler happy
authorBoris Brezillon <boris.brezillon@collabora.com>
Fri, 25 Mar 2022 12:17:21 +0000 (05:17 -0700)
committerMarge Bot <emma+marge@anholt.net>
Fri, 25 Mar 2022 16:21:45 +0000 (16:21 +0000)
Fix 'error C4576: a parenthesized type followed by an initializer
list is a non-standard explicit type conversion syntax' errors by
declaring an actual variable and returning it in
vk_image_view_subresource_range().

All those MSVC/c++ related-constraints are quite annoying to be honest,
but it looks like the D3D12 headers have been updated to plain C
recently, which will allow us to write the driver in C, and hopefully
get all this sort of issues behind us.

Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14766>

src/vulkan/runtime/vk_image.h

index af141fc..f6b3f87 100644 (file)
@@ -227,13 +227,15 @@ void vk_image_view_destroy(struct vk_device *device,
 static inline VkImageSubresourceRange
 vk_image_view_subresource_range(const struct vk_image_view *view)
 {
-   return (VkImageSubresourceRange) {
+   VkImageSubresourceRange range = {
       .aspectMask = view->aspects,
       .baseMipLevel = view->base_mip_level,
       .levelCount = view->level_count,
       .baseArrayLayer = view->base_array_layer,
       .layerCount = view->layer_count,
    };
+
+   return range;
 }
 
 bool vk_image_layout_is_read_only(VkImageLayout layout,