summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar ReinUsesLisp2020-12-26 02:09:55 -0300
committerGravatar ReinUsesLisp2020-12-31 02:07:34 -0300
commit7344a7c447af2591c393e69d39892dab217196d3 (patch)
tree6725b1689cdbf88cbd2b565c7f01ed4b5565974d
parentvk_device: Stop initialization when device is not suitable (diff)
downloadyuzu-7344a7c447af2591c393e69d39892dab217196d3.tar.gz
yuzu-7344a7c447af2591c393e69d39892dab217196d3.tar.xz
yuzu-7344a7c447af2591c393e69d39892dab217196d3.zip
vk_device: Use an array to report lacking device limits
This makes easier to add and tune the required device limits.
-rw-r--r--src/video_core/renderer_vulkan/vk_device.cpp30
1 files changed, 17 insertions, 13 deletions
diff --git a/src/video_core/renderer_vulkan/vk_device.cpp b/src/video_core/renderer_vulkan/vk_device.cpp
index 07edf556d..024d5c2de 100644
--- a/src/video_core/renderer_vulkan/vk_device.cpp
+++ b/src/video_core/renderer_vulkan/vk_device.cpp
@@ -567,20 +567,24 @@ void VKDevice::CheckSuitability() const {
567 LOG_ERROR(Render_Vulkan, "Missing required extension: {}", REQUIRED_EXTENSIONS[i]); 567 LOG_ERROR(Render_Vulkan, "Missing required extension: {}", REQUIRED_EXTENSIONS[i]);
568 throw vk::Exception(VK_ERROR_EXTENSION_NOT_PRESENT); 568 throw vk::Exception(VK_ERROR_EXTENSION_NOT_PRESENT);
569 } 569 }
570 // TODO(Rodrigo): Check if the device matches all requeriments. 570 struct LimitTuple {
571 u32 minimum;
572 u32 value;
573 const char* name;
574 };
571 const VkPhysicalDeviceLimits& limits{properties.limits}; 575 const VkPhysicalDeviceLimits& limits{properties.limits};
572 576 const std::array limits_report{
573 constexpr u32 required_ubo_size = 65536; 577 LimitTuple{65536, limits.maxUniformBufferRange, "maxUniformBufferRange"},
574 if (limits.maxUniformBufferRange < required_ubo_size) { 578 LimitTuple{16, limits.maxViewports, "maxViewports"},
575 LOG_ERROR(Render_Vulkan, "Device UBO size {} is too small, {} is required", 579 LimitTuple{8, limits.maxColorAttachments, "maxColorAttachments"},
576 limits.maxUniformBufferRange, required_ubo_size); 580 LimitTuple{8, limits.maxClipDistances, "maxClipDistances"},
577 throw vk::Exception(VK_ERROR_FEATURE_NOT_PRESENT); 581 };
578 } 582 for (const auto& tuple : limits_report) {
579 constexpr u32 required_num_viewports = 16; 583 if (tuple.value < tuple.minimum) {
580 if (limits.maxViewports < required_num_viewports) { 584 LOG_ERROR(Render_Vulkan, "{} has to be {} or greater but it is {}", tuple.name,
581 LOG_INFO(Render_Vulkan, "Device number of viewports {} is too small, {} is required", 585 tuple.minimum, tuple.value);
582 limits.maxViewports, required_num_viewports); 586 throw vk::Exception(VK_ERROR_FEATURE_NOT_PRESENT);
583 throw vk::Exception(VK_ERROR_FEATURE_NOT_PRESENT); 587 }
584 } 588 }
585 const VkPhysicalDeviceFeatures features{physical.GetFeatures()}; 589 const VkPhysicalDeviceFeatures features{physical.GetFeatures()};
586 const std::array feature_report{ 590 const std::array feature_report{