yuzu-emu
/
yuzu
Archived
1
0
Fork 0

MoltenVK: restrict number of vertex attributes/bindings to 16

This commit is contained in:
TellowKrinkle 2023-01-09 19:01:09 -05:00 committed by Liam
parent fda0e7e989
commit eaf425bd32
1 changed files with 25 additions and 10 deletions

View File

@ -298,9 +298,25 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR
const vk::InstanceDispatch& dld_) const vk::InstanceDispatch& dld_)
: instance{instance_}, dld{dld_}, physical{physical_}, : instance{instance_}, dld{dld_}, physical{physical_},
format_properties(GetFormatProperties(physical)) { format_properties(GetFormatProperties(physical)) {
if (!GetSuitability(surface != nullptr)) { // Get suitability and device properties.
const bool is_suitable = GetSuitability(surface != nullptr);
const VkDriverId driver_id = properties.driver.driverID;
const bool is_radv = driver_id == VK_DRIVER_ID_MESA_RADV;
const bool is_amd_driver =
driver_id == VK_DRIVER_ID_AMD_PROPRIETARY || driver_id == VK_DRIVER_ID_AMD_OPEN_SOURCE;
const bool is_amd = is_amd_driver || is_radv;
const bool is_intel_windows = driver_id == VK_DRIVER_ID_INTEL_PROPRIETARY_WINDOWS;
const bool is_intel_anv = driver_id == VK_DRIVER_ID_INTEL_OPEN_SOURCE_MESA;
const bool is_nvidia = driver_id == VK_DRIVER_ID_NVIDIA_PROPRIETARY;
const bool is_mvk = driver_id == VK_DRIVER_ID_MOLTENVK;
if (is_mvk && !is_suitable) {
LOG_WARNING(Render_Vulkan, "Unsuitable driver is MoltenVK, continuing anyway");
} else if (!is_suitable) {
throw vk::Exception(VK_ERROR_INCOMPATIBLE_DRIVER); throw vk::Exception(VK_ERROR_INCOMPATIBLE_DRIVER);
} }
SetupFamilies(surface); SetupFamilies(surface);
const auto queue_cis = GetDeviceQueueCreateInfos(); const auto queue_cis = GetDeviceQueueCreateInfos();
@ -339,15 +355,6 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR
CollectPhysicalMemoryInfo(); CollectPhysicalMemoryInfo();
CollectToolingInfo(); CollectToolingInfo();
const VkDriverId driver_id = properties.driver.driverID;
const bool is_radv = driver_id == VK_DRIVER_ID_MESA_RADV;
const bool is_amd_driver =
driver_id == VK_DRIVER_ID_AMD_PROPRIETARY || driver_id == VK_DRIVER_ID_AMD_OPEN_SOURCE;
const bool is_amd = is_amd_driver || is_radv;
const bool is_intel_windows = driver_id == VK_DRIVER_ID_INTEL_PROPRIETARY_WINDOWS;
const bool is_intel_anv = driver_id == VK_DRIVER_ID_INTEL_OPEN_SOURCE_MESA;
const bool is_nvidia = driver_id == VK_DRIVER_ID_NVIDIA_PROPRIETARY;
if (is_nvidia) { if (is_nvidia) {
const u32 nv_major_version = (properties.properties.driverVersion >> 22) & 0x3ff; const u32 nv_major_version = (properties.properties.driverVersion >> 22) & 0x3ff;
const auto arch = GetNvidiaArchitecture(physical, supported_extensions); const auto arch = GetNvidiaArchitecture(physical, supported_extensions);
@ -449,6 +456,14 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR
LOG_WARNING(Render_Vulkan, "ANV driver does not support native BGR format"); LOG_WARNING(Render_Vulkan, "ANV driver does not support native BGR format");
must_emulate_bgr565 = true; must_emulate_bgr565 = true;
} }
if (is_mvk) {
LOG_WARNING(Render_Vulkan,
"MVK driver breaks when using more than 16 vertex attributes/bindings");
properties.properties.limits.maxVertexInputAttributes =
std::min(properties.properties.limits.maxVertexInputAttributes, 16U);
properties.properties.limits.maxVertexInputBindings =
std::min(properties.properties.limits.maxVertexInputBindings, 16U);
}
logical = vk::Device::Create(physical, queue_cis, ExtensionListForVulkan(loaded_extensions), logical = vk::Device::Create(physical, queue_cis, ExtensionListForVulkan(loaded_extensions),
first_next, dld); first_next, dld);