Alphabetize features and move them into separate desktop and mobile categories.

This commit is contained in:
Charles Giessen 2021-09-10 21:32:04 -06:00
parent d6d63121e9
commit 24f5559ac6
2 changed files with 67 additions and 47 deletions

View File

@ -25,80 +25,100 @@ struct StructureWrapper {
other.pStructure = nullptr;
}
StructureWrapper& operator=(StructureWrapper&& other) noexcept {
delete pStructure;
if (this != &other) {
if (pStructure) delete pStructure;
pStructure = other.pStructure;
other.pStructure = nullptr;
}
return *this;
}
VkBaseOutStructure* pStructure = nullptr;
};
inline VkPhysicalDeviceFeatures get_common_1_0_features() {
// Only enable features that are on >95% devices
VkPhysicalDeviceFeatures features{};
features.depthBiasClamp = true;
features.fragmentStoresAndAtomics = true;
features.fullDrawIndexUint32 = true;
features.imageCubeArray = true;
features.independentBlend = true;
features.geometryShader = true;
features.tessellationShader = true;
features.largePoints = true;
features.sampleRateShading = true;
features.shaderImageGatherExtended = true;
features.shaderSampledImageArrayDynamicIndexing = true;
features.shaderUniformBufferArrayDynamicIndexing = true;
return features;
}
// Extends get_common_1_0_features with common desktop features
inline VkPhysicalDeviceFeatures get_common_1_0_desktop_features() {
auto features = get_common_1_0_features();
features.depthClamp = true;
features.drawIndirectFirstInstance = true;
features.dualSrcBlend = true;
features.fillModeNonSolid = true;
features.geometryShader = true;
features.logicOp = true;
features.multiDrawIndirect = true;
features.drawIndirectFirstInstance = true;
features.depthClamp = true;
features.depthBiasClamp = true;
features.fillModeNonSolid = true;
features.wideLines = true;
features.largePoints = true;
features.multiViewport = true;
features.samplerAnisotropy = true;
features.pipelineStatisticsQuery = true;
features.textureCompressionBC = true;
features.occlusionQueryPrecise = true;
features.vertexPipelineStoresAndAtomics = true;
features.fragmentStoresAndAtomics = true;
features.shaderTessellationAndGeometryPointSize = true;
features.shaderImageGatherExtended = true;
features.shaderStorageImageExtendedFormats = true;
features.shaderStorageImageWriteWithoutFormat = true;
features.shaderUniformBufferArrayDynamicIndexing = true;
features.shaderSampledImageArrayDynamicIndexing = true;
features.shaderStorageBufferArrayDynamicIndexing = true;
features.shaderStorageImageArrayDynamicIndexing = true;
features.pipelineStatisticsQuery = true;
features.samplerAnisotropy = true;
features.shaderClipDistance = true;
features.shaderCullDistance = true;
features.shaderStorageBufferArrayDynamicIndexing = true;
features.shaderStorageImageArrayDynamicIndexing = true;
features.shaderStorageImageExtendedFormats = true;
features.shaderStorageImageWriteWithoutFormat = true;
features.shaderTessellationAndGeometryPointSize = true;
features.tessellationShader = true;
features.textureCompressionBC = true;
features.variableMultisampleRate = true;
features.vertexPipelineStoresAndAtomics = true;
features.wideLines = true;
return features;
}
inline VkPhysicalDeviceVulkan11Features get_common_1_1_features() {
VkPhysicalDeviceVulkan11Features features;
features.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES;
features.storageBuffer16BitAccess = true;
features.uniformAndStorageBuffer16BitAccess = true;
features.multiview = true;
features.multiviewTessellationShader = true;
features.variablePointersStorageBuffer = true;
features.variablePointers = true;
features.shaderDrawParameters = true;
features.storageBuffer16BitAccess = true;
features.uniformAndStorageBuffer16BitAccess = true;
features.variablePointers = true;
features.variablePointersStorageBuffer = true;
return features;
}
// Extends get_common_1_1_features with common desktop features
inline VkPhysicalDeviceVulkan11Features get_common_1_1_desktop_features() {
auto features = get_common_1_1_features();
// nothing to add
return features;
}
inline VkPhysicalDeviceVulkan12Features get_common_1_2_features() {
VkPhysicalDeviceVulkan12Features features{};
features.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES;
features.samplerMirrorClampToEdge = true;
features.drawIndirectCount = true;
features.descriptorIndexing = true;
features.scalarBlockLayout = true;
features.imagelessFramebuffer = true;
features.uniformBufferStandardLayout = true;
features.shaderSubgroupExtendedTypes = true;
features.separateDepthStencilLayouts = true;
features.hostQueryReset = true;
features.timelineSemaphore = true;
features.bufferDeviceAddress = true;
features.descriptorIndexing = true;
features.drawIndirectCount = true;
features.hostQueryReset = true;
features.imagelessFramebuffer = true;
features.samplerMirrorClampToEdge = true;
features.scalarBlockLayout = true;
features.separateDepthStencilLayouts = true;
features.shaderSubgroupExtendedTypes = true;
features.subgroupBroadcastDynamicId = true;
features.timelineSemaphore = true;
features.uniformBufferStandardLayout = true;
return features;
}
// Extends get_common_1_2_features with common desktop features
inline VkPhysicalDeviceVulkan12Features get_common_1_2_desktop_features() {
auto features = get_common_1_2_features();
// nothing to add
return features;
}
} // namespace detail
@ -128,7 +148,7 @@ struct VulkanFeatureConfig {
Configuration for commonly available features in Vulkan 1.0 devices
*/
static VulkanFeatureConfig& get_feature_config_vulkan_1_0_desktop() {
inline VulkanFeatureConfig& get_feature_config_vulkan_1_0_desktop() {
static VulkanFeatureConfig config{};
config.features_1_0 = detail::get_common_1_0_features();
return config;
@ -137,7 +157,7 @@ static VulkanFeatureConfig& get_feature_config_vulkan_1_0_desktop() {
/*
Configuration for commonly available features in Vulkan 1.1 devices
*/
static VulkanFeatureConfig& get_feature_config_vulkan_1_1_desktop() {
inline VulkanFeatureConfig& get_feature_config_vulkan_1_1_desktop() {
static VulkanFeatureConfig config{};
config.api_minor_version = 1;
config.features_1_0 = detail::get_common_1_0_features();
@ -148,7 +168,7 @@ static VulkanFeatureConfig& get_feature_config_vulkan_1_1_desktop() {
/*
Configuration for commonly available features in Vulkan 1.2 devices
*/
static VulkanFeatureConfig& get_feature_config_vulkan_1_2_desktop() {
inline VulkanFeatureConfig& get_feature_config_vulkan_1_2_desktop() {
static VulkanFeatureConfig config{};
config.api_minor_version = 2;
config.features_1_0 = detail::get_common_1_0_features();
@ -160,7 +180,7 @@ static VulkanFeatureConfig& get_feature_config_vulkan_1_2_desktop() {
/*
Configuration that requests features available only found in the most recent hardware
*/
static VulkanFeatureConfig& get_feature_config_bleeding_edge_desktop() {
inline VulkanFeatureConfig& get_feature_config_bleeding_edge_desktop() {
static VulkanFeatureConfig config{};
config.api_minor_version = 2;
config.required_extensions.push_back("VK_KHR_deferred_host_operations");
@ -175,24 +195,24 @@ static VulkanFeatureConfig& get_feature_config_bleeding_edge_desktop() {
return config;
}
static VulkanFeatureConfig& get_feature_config_vulkan_1_0_mobile() {
inline VulkanFeatureConfig& get_feature_config_vulkan_1_0_mobile() {
static VulkanFeatureConfig config{};
return config;
}
static VulkanFeatureConfig& get_feature_config_vulkan_1_1_mobile() {
inline VulkanFeatureConfig& get_feature_config_vulkan_1_1_mobile() {
static VulkanFeatureConfig config{};
config.api_minor_version = 1;
return config;
}
static VulkanFeatureConfig& get_feature_config_vulkan_1_2_mobile() {
inline VulkanFeatureConfig& get_feature_config_vulkan_1_2_mobile() {
static VulkanFeatureConfig config{};
config.api_minor_version = 2;
return config;
}
static VulkanFeatureConfig& get_feature_config_virtual_reality_base() {
inline VulkanFeatureConfig& get_feature_config_virtual_reality_base() {
static VulkanFeatureConfig config{};
config.api_minor_version = 1;
config.features_1_0 = detail::get_common_1_0_features();

View File

@ -29,7 +29,7 @@ TEST_CASE("TargetBaseVulkanDesktop", "[VkBootstrap.feature_config]") {
}
}
destroy_surface(*instance_ret, surface);
vkb::destroy_surface(instance, surface);
vkb::destroy_instance(instance);
destroy_window_glfw(window);
}