2929
3030static VERBOSITY g_Verbosity = VERBOSITY::DEFAULT;
3131
32+ static const uint32_t VULKAN_API_VERSION = VK_API_VERSION_1_1;
33+
3234namespace DetailedStats
3335{
3436
@@ -668,7 +670,6 @@ static uint32_t g_PhysicalDeviceIndex = 0;
668670static RangeSequence<size_t > g_LineRanges;
669671static bool g_UserDataEnabled = true ;
670672static bool g_MemStatsEnabled = false ;
671- VULKAN_EXTENSION_REQUEST g_VK_KHR_dedicated_allocation_request = VULKAN_EXTENSION_REQUEST::DEFAULT;
672673VULKAN_EXTENSION_REQUEST g_VK_LAYER_LUNARG_standard_validation = VULKAN_EXTENSION_REQUEST::DEFAULT;
673674VULKAN_EXTENSION_REQUEST g_VK_EXT_memory_budget_request = VULKAN_EXTENSION_REQUEST::DEFAULT;
674675
@@ -689,7 +690,7 @@ static size_t g_DefragmentAfterLineNextIndex = 0;
689690static bool ValidateFileVersion ()
690691{
691692 if (GetVersionMajor (g_FileVersion) == 1 &&
692- GetVersionMinor (g_FileVersion) <= 7 )
693+ GetVersionMinor (g_FileVersion) <= 8 )
693694 {
694695 return true ;
695696 }
@@ -1064,12 +1065,13 @@ class ConfigurationParser
10641065 void Compare (
10651066 const VkPhysicalDeviceProperties& currDevProps,
10661067 const VkPhysicalDeviceMemoryProperties& currMemProps,
1067- bool currDedicatedAllocationExtensionEnabled ,
1068+ uint32_t vulkanApiVersion ,
10681069 bool currMemoryBudgetEnabled);
10691070
10701071private:
10711072 enum class OPTION
10721073 {
1074+ VulkanApiVersion,
10731075 PhysicalDevice_apiVersion,
10741076 PhysicalDevice_driverVersion,
10751077 PhysicalDevice_vendorID,
@@ -1159,7 +1161,11 @@ bool ConfigurationParser::Parse(LineSplit& lineSplit)
11591161 }
11601162
11611163 const StrRange optionName = csvSplit.GetRange (0 );
1162- if (StrRangeEq (optionName, " PhysicalDevice" ))
1164+ if (StrRangeEq (optionName, " VulkanApiVersion" ))
1165+ {
1166+ SetOption (currLineNumber, OPTION::VulkanApiVersion, StrRange{csvSplit.GetRange (1 ).beg , csvSplit.GetRange (2 ).end });
1167+ }
1168+ else if (StrRangeEq (optionName, " PhysicalDevice" ))
11631169 {
11641170 if (csvSplit.GetCount () >= 3 )
11651171 {
@@ -1205,7 +1211,9 @@ bool ConfigurationParser::Parse(LineSplit& lineSplit)
12051211 {
12061212 const StrRange subOptionName = csvSplit.GetRange (1 );
12071213 if (StrRangeEq (subOptionName, " VK_KHR_dedicated_allocation" ))
1208- SetOption (currLineNumber, OPTION::Extension_VK_KHR_dedicated_allocation, csvSplit.GetRange (2 ));
1214+ {
1215+ // Ignore because this extension is promoted to Vulkan 1.1.
1216+ }
12091217 else if (StrRangeEq (subOptionName, " VK_KHR_bind_memory2" ))
12101218 SetOption (currLineNumber, OPTION::Extension_VK_KHR_bind_memory2, csvSplit.GetRange (2 ));
12111219 else if (StrRangeEq (subOptionName, " VK_EXT_memory_budget" ))
@@ -1305,9 +1313,14 @@ bool ConfigurationParser::Parse(LineSplit& lineSplit)
13051313void ConfigurationParser::Compare (
13061314 const VkPhysicalDeviceProperties& currDevProps,
13071315 const VkPhysicalDeviceMemoryProperties& currMemProps,
1308- bool currDedicatedAllocationExtensionEnabled ,
1316+ uint32_t vulkanApiVersion ,
13091317 bool currMemoryBudgetEnabled)
13101318{
1319+ char vulkanApiVersionStr[32 ];
1320+ sprintf_s (vulkanApiVersionStr, " %u,%u" , VK_VERSION_MAJOR (vulkanApiVersion), VK_VERSION_MINOR (vulkanApiVersion));
1321+ CompareOption (VERBOSITY::DEFAULT, " VulkanApiVersion" ,
1322+ OPTION::VulkanApiVersion, vulkanApiVersionStr);
1323+
13111324 CompareOption (VERBOSITY::MAXIMUM, " PhysicalDevice apiVersion" ,
13121325 OPTION::PhysicalDevice_apiVersion, currDevProps.apiVersion );
13131326 CompareOption (VERBOSITY::MAXIMUM, " PhysicalDevice driverVersion" ,
@@ -1327,8 +1340,6 @@ void ConfigurationParser::Compare(
13271340 OPTION::PhysicalDeviceLimits_bufferImageGranularity, currDevProps.limits .bufferImageGranularity );
13281341 CompareOption (VERBOSITY::DEFAULT, " PhysicalDeviceLimits nonCoherentAtomSize" ,
13291342 OPTION::PhysicalDeviceLimits_nonCoherentAtomSize, currDevProps.limits .nonCoherentAtomSize );
1330- CompareOption (VERBOSITY::DEFAULT, " Extension VK_KHR_dedicated_allocation" ,
1331- OPTION::Extension_VK_EXT_memory_budget, currMemoryBudgetEnabled);
13321343
13331344 CompareMemProps (currMemProps);
13341345}
@@ -1588,7 +1599,6 @@ class Player
15881599 VmaAllocator m_Allocator = VK_NULL_HANDLE;
15891600 VkCommandPool m_CommandPool = VK_NULL_HANDLE;
15901601 VkCommandBuffer m_CommandBuffer = VK_NULL_HANDLE;
1591- bool m_DedicatedAllocationEnabled = false ;
15921602 bool m_MemoryBudgetEnabled = false ;
15931603 const VkPhysicalDeviceProperties* m_DevProps = nullptr ;
15941604 const VkPhysicalDeviceMemoryProperties* m_MemProps = nullptr ;
@@ -1711,7 +1721,7 @@ Player::~Player()
17111721void Player::ApplyConfig (ConfigurationParser& configParser)
17121722{
17131723 configParser.Compare (*m_DevProps, *m_MemProps,
1714- m_DedicatedAllocationEnabled ,
1724+ VULKAN_API_VERSION ,
17151725 m_MemoryBudgetEnabled);
17161726}
17171727
@@ -2055,7 +2065,7 @@ int Player::InitVulkan()
20552065 appInfo.applicationVersion = VK_MAKE_VERSION (2 , 2 , 0 );
20562066 appInfo.pEngineName = " Vulkan Memory Allocator" ;
20572067 appInfo.engineVersion = VK_MAKE_VERSION (2 , 2 , 0 );
2058- appInfo.apiVersion = VK_API_VERSION_1_0 ;
2068+ appInfo.apiVersion = VULKAN_API_VERSION ;
20592069
20602070 VkInstanceCreateInfo instInfo = { VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO };
20612071 instInfo.pApplicationInfo = &appInfo;
@@ -2163,7 +2173,6 @@ int Player::InitVulkan()
21632173 InitVulkanFeatures (enabledFeatures, supportedFeatures);
21642174
21652175 bool VK_KHR_get_memory_requirements2_available = false ;
2166- bool VK_KHR_dedicated_allocation_available = false ;
21672176
21682177 // Determine list of device extensions to enable.
21692178 std::vector<const char *> enabledDeviceExtensions;
@@ -2186,10 +2195,6 @@ int Player::InitVulkan()
21862195 {
21872196 VK_KHR_get_memory_requirements2_available = true ;
21882197 }
2189- else if (strcmp (properties[i].extensionName , VK_KHR_DEDICATED_ALLOCATION_EXTENSION_NAME) == 0 )
2190- {
2191- VK_KHR_dedicated_allocation_available = true ;
2192- }
21932198 else if (strcmp (properties[i].extensionName , VK_EXT_MEMORY_BUDGET_EXTENSION_NAME) == 0 )
21942199 {
21952200 if (VK_KHR_get_physical_device_properties2_enabled)
@@ -2201,26 +2206,6 @@ int Player::InitVulkan()
22012206 }
22022207 }
22032208
2204- const bool dedicatedAllocationAvailable =
2205- VK_KHR_get_memory_requirements2_available && VK_KHR_dedicated_allocation_available;
2206-
2207- switch (g_VK_KHR_dedicated_allocation_request)
2208- {
2209- case VULKAN_EXTENSION_REQUEST::DISABLED:
2210- break ;
2211- case VULKAN_EXTENSION_REQUEST::DEFAULT:
2212- m_DedicatedAllocationEnabled = dedicatedAllocationAvailable;
2213- break ;
2214- case VULKAN_EXTENSION_REQUEST::ENABLED:
2215- m_DedicatedAllocationEnabled = dedicatedAllocationAvailable;
2216- if (!dedicatedAllocationAvailable)
2217- {
2218- printf (" WARNING: VK_KHR_dedicated_allocation extension cannot be enabled.\n " );
2219- }
2220- break ;
2221- default : assert (0 );
2222- }
2223-
22242209 switch (g_VK_EXT_memory_budget_request)
22252210 {
22262211 case VULKAN_EXTENSION_REQUEST::DISABLED:
@@ -2238,11 +2223,6 @@ int Player::InitVulkan()
22382223 default : assert (0 );
22392224 }
22402225
2241- if (m_DedicatedAllocationEnabled)
2242- {
2243- enabledDeviceExtensions.push_back (VK_KHR_GET_MEMORY_REQUIREMENTS_2_EXTENSION_NAME);
2244- enabledDeviceExtensions.push_back (VK_KHR_DEDICATED_ALLOCATION_EXTENSION_NAME);
2245- }
22462226 if (m_MemoryBudgetEnabled)
22472227 {
22482228 enabledDeviceExtensions.push_back (VK_EXT_MEMORY_BUDGET_EXTENSION_NAME);
@@ -2278,11 +2258,8 @@ int Player::InitVulkan()
22782258 allocatorInfo.device = m_Device;
22792259 allocatorInfo.flags = VMA_ALLOCATOR_CREATE_EXTERNALLY_SYNCHRONIZED_BIT;
22802260 allocatorInfo.pDeviceMemoryCallbacks = &deviceMemoryCallbacks;
2261+ allocatorInfo.vulkanApiVersion = VULKAN_API_VERSION;
22812262
2282- if (m_DedicatedAllocationEnabled)
2283- {
2284- allocatorInfo.flags |= VMA_ALLOCATOR_CREATE_KHR_DEDICATED_ALLOCATION_BIT;
2285- }
22862263 if (m_MemoryBudgetEnabled)
22872264 {
22882265 allocatorInfo.flags |= VMA_ALLOCATOR_CREATE_EXT_MEMORY_BUDGET_BIT;
@@ -4005,8 +3982,6 @@ static void PrintCommandLineSyntax()
40053982 " Default is 1. Affects both creation of buffers and images, as well as calls to vmaSetAllocationUserData.\n "
40063983 " --VK_LAYER_LUNARG_standard_validation <Value> - 0 to disable or 1 to enable validation layers.\n "
40073984 " By default the layers are silently enabled if available.\n "
4008- " --VK_KHR_dedicated_allocation <Value> - 0 to disable or 1 to enable this extension.\n "
4009- " By default the extension is silently enabled if available.\n "
40103985 " --VK_EXT_memory_budget <Value> - 0 to disable or 1 to enable this extension.\n "
40113986 " By default the extension is silently enabled if available.\n "
40123987 );
@@ -4227,7 +4202,6 @@ static int main2(int argc, char** argv)
42274202 cmdLineParser.RegisterOpt (CMD_LINE_OPT_LINES, " Lines" , true );
42284203 cmdLineParser.RegisterOpt (CMD_LINE_OPT_PHYSICAL_DEVICE, " PhysicalDevice" , true );
42294204 cmdLineParser.RegisterOpt (CMD_LINE_OPT_USER_DATA, " UserData" , true );
4230- cmdLineParser.RegisterOpt (CMD_LINE_OPT_VK_KHR_DEDICATED_ALLOCATION, " VK_KHR_dedicated_allocation" , true );
42314205 cmdLineParser.RegisterOpt (CMD_LINE_OPT_VK_EXT_MEMORY_BUDGET, " VK_EXT_memory_budget" , true );
42324206 cmdLineParser.RegisterOpt (CMD_LINE_OPT_VK_LAYER_LUNARG_STANDARD_VALIDATION, VALIDATION_LAYER_NAME, true );
42334207 cmdLineParser.RegisterOpt (CMD_LINE_OPT_MEM_STATS, " MemStats" , true );
@@ -4287,22 +4261,6 @@ static int main2(int argc, char** argv)
42874261 return RESULT_ERROR_COMMAND_LINE;
42884262 }
42894263 break ;
4290- case CMD_LINE_OPT_VK_KHR_DEDICATED_ALLOCATION:
4291- {
4292- bool newValue;
4293- if (StrRangeToBool (StrRange (cmdLineParser.GetParameter ()), newValue))
4294- {
4295- g_VK_KHR_dedicated_allocation_request = newValue ?
4296- VULKAN_EXTENSION_REQUEST::ENABLED :
4297- VULKAN_EXTENSION_REQUEST::DISABLED;
4298- }
4299- else
4300- {
4301- PrintCommandLineSyntax ();
4302- return RESULT_ERROR_COMMAND_LINE;
4303- }
4304- }
4305- break ;
43064264 case CMD_LINE_OPT_VK_EXT_MEMORY_BUDGET:
43074265 {
43084266 bool newValue;
0 commit comments