Removed check_and_add functions for instance layers and extensions

This commit is contained in:
Charles Giessen 2020-03-07 02:53:54 -07:00
parent 9561e30373
commit d58b099da8
2 changed files with 6 additions and 29 deletions

View File

@ -342,29 +342,17 @@ InstanceBuilder& InstanceBuilder::set_api_version (uint32_t major, uint32_t mino
info.api_version = VK_MAKE_VERSION (major, minor, patch);
return *this;
}
InstanceBuilder& InstanceBuilder::must_enable_layer (const char* layer_name) {
InstanceBuilder& InstanceBuilder::enable_layer (const char* layer_name) {
if (!layer_name) return *this;
info.layers.push_back (layer_name);
return *this;
}
InstanceBuilder& InstanceBuilder::request_layer (const char* layer_name) {
if (!layer_name) return *this;
if (detail::check_layer_supported (system.available_layers, layer_name))
info.layers.push_back (layer_name);
return *this;
}
InstanceBuilder& InstanceBuilder::must_enable_extension (const char* extension_name) {
InstanceBuilder& InstanceBuilder::enable_extension (const char* extension_name) {
if (!extension_name) return *this;
info.extensions.push_back (extension_name);
return *this;
}
InstanceBuilder& InstanceBuilder::request_extension (const char* extension_name) {
if (!extension_name) return *this;
if (detail::check_extension_supported (system.available_extensions, extension_name))
info.extensions.push_back (extension_name);
return *this;
}
InstanceBuilder& InstanceBuilder::must_enable_validation_layers (bool enable_validation) {
InstanceBuilder& InstanceBuilder::enable_validation_layers (bool enable_validation) {
info.enable_validation_layers = enable_validation;
return *this;
}
@ -374,7 +362,6 @@ InstanceBuilder& InstanceBuilder::request_validation_layers (bool enable_validat
detail::check_extension_supported (system.available_extensions, detail::validation_layer_name);
return *this;
}
InstanceBuilder& InstanceBuilder::use_default_debug_messenger () {
info.use_debug_messenger = true;
info.debug_callback = default_debug_callback;

View File

@ -117,7 +117,6 @@ enum class InstanceError {
requested_extensions_not_present
};
const char* to_string (InstanceError err);
class InstanceBuilder;
class PhysicalDeviceSelector;
@ -134,8 +133,6 @@ struct Instance {
void destroy_instance (Instance instance); // release instance resources
// TODO utility function for users to check if layer/extension is supported
class InstanceBuilder {
public:
// contains useful information about the available vulkan capabilities, like layers and instance extensions.
@ -155,21 +152,16 @@ class InstanceBuilder {
// Sets the vulkan API version to use.
InstanceBuilder& set_api_version (uint32_t major, uint32_t minor, uint32_t patch);
// Loads the specified layer if it is available.
InstanceBuilder& request_layer (const char* layer_name);
// Adds a layer to be enabled. Will fail to create an instance if the layer isn't available.
InstanceBuilder& must_enable_layer (const char* layer_name);
// Enables the specified extension if it is available.
InstanceBuilder& request_extension (const char* extension_name);
InstanceBuilder& enable_layer (const char* layer_name);
// Adds an extension to be enabled. Will fail to create an instance if the extension isn't available.
InstanceBuilder& must_enable_extension (const char* extension_name);
InstanceBuilder& enable_extension (const char* extension_name);
// Headless Mode does not load the required extensions for presentation. Defaults to false.
InstanceBuilder& set_headless (bool headless = false);
// Enables the validation layers. Will fail to create an instance if the validation layers aren't available.
InstanceBuilder& must_enable_validation_layers (bool require_validation = true);
InstanceBuilder& enable_validation_layers (bool require_validation = true);
// Checks if the validation layers are available and loads them if they are.
InstanceBuilder& request_validation_layers (bool enable_validation = true);
@ -226,8 +218,6 @@ class InstanceBuilder {
std::vector<VkValidationFeatureEnableEXT> enabled_validation_features;
std::vector<VkValidationFeatureDisableEXT> disabled_validation_features;
// booleans
bool ignore_non_critical_issues = true;
bool enable_validation_layers = false;
bool use_debug_messenger = false;
bool headless_context = false;