diff --git a/src/dawn_native/vulkan/NativeSwapChainImplVk.cpp b/src/dawn_native/vulkan/NativeSwapChainImplVk.cpp index ada090f7de..11bf0899eb 100644 --- a/src/dawn_native/vulkan/NativeSwapChainImplVk.cpp +++ b/src/dawn_native/vulkan/NativeSwapChainImplVk.cpp @@ -83,8 +83,8 @@ namespace dawn_native { namespace vulkan { } void NativeSwapChainImpl::UpdateSurfaceConfig() { - if (mDevice->ConsumedError( - GatherSurfaceInfo(*ToBackend(mDevice->GetAdapter()), mSurface, &mInfo))) { + if (mDevice->ConsumedError(GatherSurfaceInfo(*ToBackend(mDevice->GetAdapter()), mSurface), + &mInfo)) { ASSERT(false); } diff --git a/src/dawn_native/vulkan/VulkanInfo.cpp b/src/dawn_native/vulkan/VulkanInfo.cpp index 9bc68ee0cb..61e1c19bc6 100644 --- a/src/dawn_native/vulkan/VulkanInfo.cpp +++ b/src/dawn_native/vulkan/VulkanInfo.cpp @@ -324,21 +324,22 @@ namespace dawn_native { namespace vulkan { return info; } - MaybeError GatherSurfaceInfo(const Adapter& adapter, - VkSurfaceKHR surface, - VulkanSurfaceInfo* info) { + ResultOrError GatherSurfaceInfo(const Adapter& adapter, + VkSurfaceKHR surface) { + VulkanSurfaceInfo info = {}; + VkPhysicalDevice physicalDevice = adapter.GetPhysicalDevice(); const VulkanFunctions& vkFunctions = adapter.GetBackend()->GetFunctions(); // Get the surface capabilities DAWN_TRY(CheckVkSuccess(vkFunctions.GetPhysicalDeviceSurfaceCapabilitiesKHR( - physicalDevice, surface, &info->capabilities), + physicalDevice, surface, &info.capabilities), "vkGetPhysicalDeviceSurfaceCapabilitiesKHR")); // Query which queue families support presenting this surface { size_t nQueueFamilies = adapter.GetDeviceInfo().queueFamilies.size(); - info->supportedQueueFamilies.resize(nQueueFamilies, false); + info.supportedQueueFamilies.resize(nQueueFamilies, false); for (uint32_t i = 0; i < nQueueFamilies; ++i) { VkBool32 supported = VK_FALSE; @@ -346,7 +347,7 @@ namespace dawn_native { namespace vulkan { physicalDevice, i, surface, &supported), "vkGetPhysicalDeviceSurfaceSupportKHR")); - info->supportedQueueFamilies[i] = (supported == VK_TRUE); + info.supportedQueueFamilies[i] = (supported == VK_TRUE); } } @@ -359,9 +360,9 @@ namespace dawn_native { namespace vulkan { return DAWN_DEVICE_LOST_ERROR("vkGetPhysicalDeviceSurfaceFormatsKHR"); } - info->formats.resize(count); + info.formats.resize(count); DAWN_TRY(CheckVkSuccess(vkFunctions.GetPhysicalDeviceSurfaceFormatsKHR( - physicalDevice, surface, &count, info->formats.data()), + physicalDevice, surface, &count, info.formats.data()), "vkGetPhysicalDeviceSurfaceFormatsKHR")); } @@ -375,13 +376,13 @@ namespace dawn_native { namespace vulkan { return DAWN_DEVICE_LOST_ERROR("vkGetPhysicalDeviceSurfacePresentModesKHR"); } - info->presentModes.resize(count); + info.presentModes.resize(count); DAWN_TRY(CheckVkSuccess(vkFunctions.GetPhysicalDeviceSurfacePresentModesKHR( - physicalDevice, surface, &count, info->presentModes.data()), + physicalDevice, surface, &count, info.presentModes.data()), "vkGetPhysicalDeviceSurfacePresentModesKHR")); } - return {}; + return info; } }} // namespace dawn_native::vulkan diff --git a/src/dawn_native/vulkan/VulkanInfo.h b/src/dawn_native/vulkan/VulkanInfo.h index 13a0fdd270..00254cfd56 100644 --- a/src/dawn_native/vulkan/VulkanInfo.h +++ b/src/dawn_native/vulkan/VulkanInfo.h @@ -122,9 +122,8 @@ namespace dawn_native { namespace vulkan { ResultOrError GatherGlobalInfo(const Backend& backend); ResultOrError> GetPhysicalDevices(const Backend& backend); ResultOrError GatherDeviceInfo(const Adapter& adapter); - MaybeError GatherSurfaceInfo(const Adapter& adapter, - VkSurfaceKHR surface, - VulkanSurfaceInfo* info); + ResultOrError GatherSurfaceInfo(const Adapter& adapter, + VkSurfaceKHR surface); }} // namespace dawn_native::vulkan #endif // DAWNNATIVE_VULKAN_VULKANINFO_H_