vulkan/image: Make MSVC C++ compiler happy

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>
This commit is contained in:
Boris Brezillon 2022-03-25 05:17:21 -07:00 committed by Marge Bot
parent 0312ca0175
commit bb1fb07ecd

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