diff options
| -rw-r--r-- | src/video_core/vulkan_common/vulkan_device.cpp | 35 |
1 files changed, 25 insertions, 10 deletions
diff --git a/src/video_core/vulkan_common/vulkan_device.cpp b/src/video_core/vulkan_common/vulkan_device.cpp index 1458ec4c8..23d922e5d 100644 --- a/src/video_core/vulkan_common/vulkan_device.cpp +++ b/src/video_core/vulkan_common/vulkan_device.cpp | |||
| @@ -298,9 +298,25 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR | |||
| 298 | const vk::InstanceDispatch& dld_) | 298 | const vk::InstanceDispatch& dld_) |
| 299 | : instance{instance_}, dld{dld_}, physical{physical_}, | 299 | : instance{instance_}, dld{dld_}, physical{physical_}, |
| 300 | format_properties(GetFormatProperties(physical)) { | 300 | format_properties(GetFormatProperties(physical)) { |
| 301 | if (!GetSuitability(surface != nullptr)) { | 301 | // Get suitability and device properties. |
| 302 | const bool is_suitable = GetSuitability(surface != nullptr); | ||
| 303 | |||
| 304 | const VkDriverId driver_id = properties.driver.driverID; | ||
| 305 | const bool is_radv = driver_id == VK_DRIVER_ID_MESA_RADV; | ||
| 306 | const bool is_amd_driver = | ||
| 307 | driver_id == VK_DRIVER_ID_AMD_PROPRIETARY || driver_id == VK_DRIVER_ID_AMD_OPEN_SOURCE; | ||
| 308 | const bool is_amd = is_amd_driver || is_radv; | ||
| 309 | const bool is_intel_windows = driver_id == VK_DRIVER_ID_INTEL_PROPRIETARY_WINDOWS; | ||
| 310 | const bool is_intel_anv = driver_id == VK_DRIVER_ID_INTEL_OPEN_SOURCE_MESA; | ||
| 311 | const bool is_nvidia = driver_id == VK_DRIVER_ID_NVIDIA_PROPRIETARY; | ||
| 312 | const bool is_mvk = driver_id == VK_DRIVER_ID_MOLTENVK; | ||
| 313 | |||
| 314 | if (is_mvk && !is_suitable) { | ||
| 315 | LOG_WARNING(Render_Vulkan, "Unsuitable driver is MoltenVK, continuing anyway"); | ||
| 316 | } else if (!is_suitable) { | ||
| 302 | throw vk::Exception(VK_ERROR_INCOMPATIBLE_DRIVER); | 317 | throw vk::Exception(VK_ERROR_INCOMPATIBLE_DRIVER); |
| 303 | } | 318 | } |
| 319 | |||
| 304 | SetupFamilies(surface); | 320 | SetupFamilies(surface); |
| 305 | const auto queue_cis = GetDeviceQueueCreateInfos(); | 321 | const auto queue_cis = GetDeviceQueueCreateInfos(); |
| 306 | 322 | ||
| @@ -339,15 +355,6 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR | |||
| 339 | CollectPhysicalMemoryInfo(); | 355 | CollectPhysicalMemoryInfo(); |
| 340 | CollectToolingInfo(); | 356 | CollectToolingInfo(); |
| 341 | 357 | ||
| 342 | const VkDriverId driver_id = properties.driver.driverID; | ||
| 343 | const bool is_radv = driver_id == VK_DRIVER_ID_MESA_RADV; | ||
| 344 | const bool is_amd_driver = | ||
| 345 | driver_id == VK_DRIVER_ID_AMD_PROPRIETARY || driver_id == VK_DRIVER_ID_AMD_OPEN_SOURCE; | ||
| 346 | const bool is_amd = is_amd_driver || is_radv; | ||
| 347 | const bool is_intel_windows = driver_id == VK_DRIVER_ID_INTEL_PROPRIETARY_WINDOWS; | ||
| 348 | const bool is_intel_anv = driver_id == VK_DRIVER_ID_INTEL_OPEN_SOURCE_MESA; | ||
| 349 | const bool is_nvidia = driver_id == VK_DRIVER_ID_NVIDIA_PROPRIETARY; | ||
| 350 | |||
| 351 | if (is_nvidia) { | 358 | if (is_nvidia) { |
| 352 | const u32 nv_major_version = (properties.properties.driverVersion >> 22) & 0x3ff; | 359 | const u32 nv_major_version = (properties.properties.driverVersion >> 22) & 0x3ff; |
| 353 | const auto arch = GetNvidiaArchitecture(physical, supported_extensions); | 360 | const auto arch = GetNvidiaArchitecture(physical, supported_extensions); |
| @@ -449,6 +456,14 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR | |||
| 449 | LOG_WARNING(Render_Vulkan, "ANV driver does not support native BGR format"); | 456 | LOG_WARNING(Render_Vulkan, "ANV driver does not support native BGR format"); |
| 450 | must_emulate_bgr565 = true; | 457 | must_emulate_bgr565 = true; |
| 451 | } | 458 | } |
| 459 | if (is_mvk) { | ||
| 460 | LOG_WARNING(Render_Vulkan, | ||
| 461 | "MVK driver breaks when using more than 16 vertex attributes/bindings"); | ||
| 462 | properties.properties.limits.maxVertexInputAttributes = | ||
| 463 | std::min(properties.properties.limits.maxVertexInputAttributes, 16U); | ||
| 464 | properties.properties.limits.maxVertexInputBindings = | ||
| 465 | std::min(properties.properties.limits.maxVertexInputBindings, 16U); | ||
| 466 | } | ||
| 452 | 467 | ||
| 453 | logical = vk::Device::Create(physical, queue_cis, ExtensionListForVulkan(loaded_extensions), | 468 | logical = vk::Device::Create(physical, queue_cis, ExtensionListForVulkan(loaded_extensions), |
| 454 | first_next, dld); | 469 | first_next, dld); |