mirror of
https://github.com/charles-lunarg/vk-bootstrap.git
synced 2024-11-22 07:24:34 +00:00
Add new error condition for DeviceBuilder
If an application uses add_required_extension_features but also adds a VkPhysicalDeviceFeatures2 to the pNext chain of VkDeviceCreateInfo, this will now result in an error. The reason is that Vk-Bootstrap is perfectly capable of adding VkPhysicalDeviceFeatures to the pNext chain itself but only if the user didn't already add their own.
This commit is contained in:
parent
9b3e648141
commit
0c459dca6f
@ -1519,8 +1519,7 @@ Result<Device> DeviceBuilder::build() const {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
printf("User provided VkPhysicalDeviceFeatures2 instance found in pNext chain. All "
|
||||
"requirements added via 'add_required_extension_features' will be ignored.");
|
||||
return { DeviceError::VkPhysicalDeviceFeatures2_in_pNext_chain_while_using_add_required_extension_features };
|
||||
}
|
||||
|
||||
if (!user_defined_phys_dev_features_2 && !has_phys_dev_features_2) {
|
||||
@ -1772,8 +1771,7 @@ Result<Swapchain> SwapchainBuilder::build() const {
|
||||
image_count = surface_support.capabilities.maxImageCount;
|
||||
}
|
||||
|
||||
VkSurfaceFormatKHR surface_format =
|
||||
detail::find_best_surface_format(surface_support.formats, desired_formats);
|
||||
VkSurfaceFormatKHR surface_format = detail::find_best_surface_format(surface_support.formats, desired_formats);
|
||||
|
||||
VkExtent2D extent = detail::find_extent(surface_support.capabilities, info.desired_width, info.desired_height);
|
||||
|
||||
|
@ -205,6 +205,7 @@ enum class QueueError {
|
||||
};
|
||||
enum class DeviceError {
|
||||
failed_create_device,
|
||||
VkPhysicalDeviceFeatures2_in_pNext_chain_while_using_add_required_extension_features,
|
||||
};
|
||||
enum class SwapchainError {
|
||||
surface_handle_not_provided,
|
||||
@ -594,6 +595,8 @@ class PhysicalDeviceSelector {
|
||||
PhysicalDeviceSelector& disable_portability_subset();
|
||||
|
||||
// Require a physical device which supports a specific set of general/extension features.
|
||||
// If this function is used, the user should not put their own VkPhysicalDeviceFeatures2 in
|
||||
// the pNext chain of VkDeviceCreateInfo.
|
||||
#if defined(VKB_VK_API_VERSION_1_1)
|
||||
template <typename T> PhysicalDeviceSelector& add_required_extension_features(T const& features) {
|
||||
criteria.extended_features_chain.push_back(features);
|
||||
|
Loading…
Reference in New Issue
Block a user