forked from suyu/suyu
vk_device: Use an array to report lacking device limits
This makes easier to add and tune the required device limits.
This commit is contained in:
parent
f687392e6f
commit
7344a7c447
1 changed files with 17 additions and 13 deletions
|
@ -567,20 +567,24 @@ void VKDevice::CheckSuitability() const {
|
||||||
LOG_ERROR(Render_Vulkan, "Missing required extension: {}", REQUIRED_EXTENSIONS[i]);
|
LOG_ERROR(Render_Vulkan, "Missing required extension: {}", REQUIRED_EXTENSIONS[i]);
|
||||||
throw vk::Exception(VK_ERROR_EXTENSION_NOT_PRESENT);
|
throw vk::Exception(VK_ERROR_EXTENSION_NOT_PRESENT);
|
||||||
}
|
}
|
||||||
// TODO(Rodrigo): Check if the device matches all requeriments.
|
struct LimitTuple {
|
||||||
|
u32 minimum;
|
||||||
|
u32 value;
|
||||||
|
const char* name;
|
||||||
|
};
|
||||||
const VkPhysicalDeviceLimits& limits{properties.limits};
|
const VkPhysicalDeviceLimits& limits{properties.limits};
|
||||||
|
const std::array limits_report{
|
||||||
constexpr u32 required_ubo_size = 65536;
|
LimitTuple{65536, limits.maxUniformBufferRange, "maxUniformBufferRange"},
|
||||||
if (limits.maxUniformBufferRange < required_ubo_size) {
|
LimitTuple{16, limits.maxViewports, "maxViewports"},
|
||||||
LOG_ERROR(Render_Vulkan, "Device UBO size {} is too small, {} is required",
|
LimitTuple{8, limits.maxColorAttachments, "maxColorAttachments"},
|
||||||
limits.maxUniformBufferRange, required_ubo_size);
|
LimitTuple{8, limits.maxClipDistances, "maxClipDistances"},
|
||||||
throw vk::Exception(VK_ERROR_FEATURE_NOT_PRESENT);
|
};
|
||||||
}
|
for (const auto& tuple : limits_report) {
|
||||||
constexpr u32 required_num_viewports = 16;
|
if (tuple.value < tuple.minimum) {
|
||||||
if (limits.maxViewports < required_num_viewports) {
|
LOG_ERROR(Render_Vulkan, "{} has to be {} or greater but it is {}", tuple.name,
|
||||||
LOG_INFO(Render_Vulkan, "Device number of viewports {} is too small, {} is required",
|
tuple.minimum, tuple.value);
|
||||||
limits.maxViewports, required_num_viewports);
|
throw vk::Exception(VK_ERROR_FEATURE_NOT_PRESENT);
|
||||||
throw vk::Exception(VK_ERROR_FEATURE_NOT_PRESENT);
|
}
|
||||||
}
|
}
|
||||||
const VkPhysicalDeviceFeatures features{physical.GetFeatures()};
|
const VkPhysicalDeviceFeatures features{physical.GetFeatures()};
|
||||||
const std::array feature_report{
|
const std::array feature_report{
|
||||||
|
|
Loading…
Reference in a new issue