mirror of
https://github.com/charles-lunarg/vk-bootstrap.git
synced 2024-11-22 15:24:34 +00:00
Rename set_api_version to required_api_version and make the PhysicalDeviceSelector use the provided value as the required minimum for devices
This commit is contained in:
parent
bb312e8c92
commit
1160b19a5c
@ -406,6 +406,7 @@ detail::Expected<Instance, detail::Error<InstanceError>> InstanceBuilder::build
|
||||
instance.headless = true;
|
||||
}
|
||||
instance.allocation_callbacks = info.allocation_callbacks;
|
||||
instance.instance_version = info.api_version;
|
||||
return instance;
|
||||
}
|
||||
|
||||
@ -427,7 +428,7 @@ InstanceBuilder& InstanceBuilder::set_engine_version (uint32_t major, uint32_t m
|
||||
info.engine_version = VK_MAKE_VERSION (major, minor, patch);
|
||||
return *this;
|
||||
}
|
||||
InstanceBuilder& InstanceBuilder::set_api_version (uint32_t major, uint32_t minor, uint32_t patch) {
|
||||
InstanceBuilder& InstanceBuilder::require_api_version (uint32_t major, uint32_t minor, uint32_t patch) {
|
||||
info.api_version = VK_MAKE_VERSION (major, minor, patch);
|
||||
return *this;
|
||||
}
|
||||
@ -750,6 +751,7 @@ PhysicalDeviceSelector::PhysicalDeviceSelector (Instance const& instance) {
|
||||
system_info.instance = instance.instance;
|
||||
system_info.headless = instance.headless;
|
||||
criteria.require_present = !instance.headless;
|
||||
criteria.required_version = instance.instance_version;
|
||||
}
|
||||
|
||||
detail::Expected<PhysicalDevice, detail::Error<PhysicalDeviceError>> PhysicalDeviceSelector::select () const {
|
||||
|
@ -159,6 +159,7 @@ struct Instance {
|
||||
|
||||
private:
|
||||
bool headless = false;
|
||||
uint32_t instance_version = VK_MAKE_VERSION (1, 0, 0);
|
||||
|
||||
friend class InstanceBuilder;
|
||||
friend class PhysicalDeviceSelector;
|
||||
@ -182,8 +183,8 @@ class InstanceBuilder {
|
||||
InstanceBuilder& set_app_version (uint32_t major, uint32_t minor, uint32_t patch);
|
||||
// Sets the (major, minor, patch) version of the engine.
|
||||
InstanceBuilder& set_engine_version (uint32_t major, uint32_t minor, uint32_t patch);
|
||||
// Sets the vulkan API version to use.
|
||||
InstanceBuilder& set_api_version (uint32_t major, uint32_t minor, uint32_t patch);
|
||||
// Require a minimum vulkan instance API version.
|
||||
InstanceBuilder& require_api_version (uint32_t major, uint32_t minor, uint32_t patch);
|
||||
|
||||
// Adds a layer to be enabled. Will fail to create an instance if the layer isn't available.
|
||||
InstanceBuilder& enable_layer (const char* layer_name);
|
||||
|
@ -55,7 +55,7 @@ int test_instance_basic () {
|
||||
printf ("[%s: %s](user defined)\n%s\n", ms, mt, pCallbackData->pMessage);
|
||||
return VK_FALSE;
|
||||
})
|
||||
.set_api_version (1, 2, 111)
|
||||
.require_api_version (1, 2, 111)
|
||||
.build ();
|
||||
if (!instance_ret.has_value ()) {
|
||||
return 1;
|
||||
@ -76,7 +76,7 @@ int test_instance_headless () {
|
||||
.set_app_version (4, 5, 6)
|
||||
.set_app_name ("headless")
|
||||
.set_engine_name ("nick")
|
||||
.set_api_version (1, 0, 34)
|
||||
.require_api_version (1, 0, 34)
|
||||
.use_default_debug_messenger ()
|
||||
.add_validation_feature_enable (VkValidationFeatureEnableEXT::VK_VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_EXT)
|
||||
.add_validation_feature_disable (VkValidationFeatureDisableEXT::VK_VALIDATION_FEATURE_DISABLE_OBJECT_LIFETIMES_EXT)
|
||||
|
Loading…
Reference in New Issue
Block a user