29
29
30
30
static VERBOSITY g_Verbosity = VERBOSITY::DEFAULT;
31
31
32
+ static const uint32_t VULKAN_API_VERSION = VK_API_VERSION_1_1;
33
+
32
34
namespace DetailedStats
33
35
{
34
36
@@ -668,7 +670,6 @@ static uint32_t g_PhysicalDeviceIndex = 0;
668
670
static RangeSequence<size_t > g_LineRanges;
669
671
static bool g_UserDataEnabled = true ;
670
672
static bool g_MemStatsEnabled = false ;
671
- VULKAN_EXTENSION_REQUEST g_VK_KHR_dedicated_allocation_request = VULKAN_EXTENSION_REQUEST::DEFAULT;
672
673
VULKAN_EXTENSION_REQUEST g_VK_LAYER_LUNARG_standard_validation = VULKAN_EXTENSION_REQUEST::DEFAULT;
673
674
VULKAN_EXTENSION_REQUEST g_VK_EXT_memory_budget_request = VULKAN_EXTENSION_REQUEST::DEFAULT;
674
675
@@ -689,7 +690,7 @@ static size_t g_DefragmentAfterLineNextIndex = 0;
689
690
static bool ValidateFileVersion ()
690
691
{
691
692
if (GetVersionMajor (g_FileVersion) == 1 &&
692
- GetVersionMinor (g_FileVersion) <= 7 )
693
+ GetVersionMinor (g_FileVersion) <= 8 )
693
694
{
694
695
return true ;
695
696
}
@@ -1064,12 +1065,13 @@ class ConfigurationParser
1064
1065
void Compare (
1065
1066
const VkPhysicalDeviceProperties& currDevProps,
1066
1067
const VkPhysicalDeviceMemoryProperties& currMemProps,
1067
- bool currDedicatedAllocationExtensionEnabled ,
1068
+ uint32_t vulkanApiVersion ,
1068
1069
bool currMemoryBudgetEnabled);
1069
1070
1070
1071
private:
1071
1072
enum class OPTION
1072
1073
{
1074
+ VulkanApiVersion,
1073
1075
PhysicalDevice_apiVersion,
1074
1076
PhysicalDevice_driverVersion,
1075
1077
PhysicalDevice_vendorID,
@@ -1159,7 +1161,11 @@ bool ConfigurationParser::Parse(LineSplit& lineSplit)
1159
1161
}
1160
1162
1161
1163
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" ))
1163
1169
{
1164
1170
if (csvSplit.GetCount () >= 3 )
1165
1171
{
@@ -1205,7 +1211,9 @@ bool ConfigurationParser::Parse(LineSplit& lineSplit)
1205
1211
{
1206
1212
const StrRange subOptionName = csvSplit.GetRange (1 );
1207
1213
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
+ }
1209
1217
else if (StrRangeEq (subOptionName, " VK_KHR_bind_memory2" ))
1210
1218
SetOption (currLineNumber, OPTION::Extension_VK_KHR_bind_memory2, csvSplit.GetRange (2 ));
1211
1219
else if (StrRangeEq (subOptionName, " VK_EXT_memory_budget" ))
@@ -1305,9 +1313,14 @@ bool ConfigurationParser::Parse(LineSplit& lineSplit)
1305
1313
void ConfigurationParser::Compare (
1306
1314
const VkPhysicalDeviceProperties& currDevProps,
1307
1315
const VkPhysicalDeviceMemoryProperties& currMemProps,
1308
- bool currDedicatedAllocationExtensionEnabled ,
1316
+ uint32_t vulkanApiVersion ,
1309
1317
bool currMemoryBudgetEnabled)
1310
1318
{
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
+
1311
1324
CompareOption (VERBOSITY::MAXIMUM, " PhysicalDevice apiVersion" ,
1312
1325
OPTION::PhysicalDevice_apiVersion, currDevProps.apiVersion );
1313
1326
CompareOption (VERBOSITY::MAXIMUM, " PhysicalDevice driverVersion" ,
@@ -1327,8 +1340,6 @@ void ConfigurationParser::Compare(
1327
1340
OPTION::PhysicalDeviceLimits_bufferImageGranularity, currDevProps.limits .bufferImageGranularity );
1328
1341
CompareOption (VERBOSITY::DEFAULT, " PhysicalDeviceLimits nonCoherentAtomSize" ,
1329
1342
OPTION::PhysicalDeviceLimits_nonCoherentAtomSize, currDevProps.limits .nonCoherentAtomSize );
1330
- CompareOption (VERBOSITY::DEFAULT, " Extension VK_KHR_dedicated_allocation" ,
1331
- OPTION::Extension_VK_EXT_memory_budget, currMemoryBudgetEnabled);
1332
1343
1333
1344
CompareMemProps (currMemProps);
1334
1345
}
@@ -1588,7 +1599,6 @@ class Player
1588
1599
VmaAllocator m_Allocator = VK_NULL_HANDLE;
1589
1600
VkCommandPool m_CommandPool = VK_NULL_HANDLE;
1590
1601
VkCommandBuffer m_CommandBuffer = VK_NULL_HANDLE;
1591
- bool m_DedicatedAllocationEnabled = false ;
1592
1602
bool m_MemoryBudgetEnabled = false ;
1593
1603
const VkPhysicalDeviceProperties* m_DevProps = nullptr ;
1594
1604
const VkPhysicalDeviceMemoryProperties* m_MemProps = nullptr ;
@@ -1711,7 +1721,7 @@ Player::~Player()
1711
1721
void Player::ApplyConfig (ConfigurationParser& configParser)
1712
1722
{
1713
1723
configParser.Compare (*m_DevProps, *m_MemProps,
1714
- m_DedicatedAllocationEnabled ,
1724
+ VULKAN_API_VERSION ,
1715
1725
m_MemoryBudgetEnabled);
1716
1726
}
1717
1727
@@ -2055,7 +2065,7 @@ int Player::InitVulkan()
2055
2065
appInfo.applicationVersion = VK_MAKE_VERSION (2 , 2 , 0 );
2056
2066
appInfo.pEngineName = " Vulkan Memory Allocator" ;
2057
2067
appInfo.engineVersion = VK_MAKE_VERSION (2 , 2 , 0 );
2058
- appInfo.apiVersion = VK_API_VERSION_1_0 ;
2068
+ appInfo.apiVersion = VULKAN_API_VERSION ;
2059
2069
2060
2070
VkInstanceCreateInfo instInfo = { VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO };
2061
2071
instInfo.pApplicationInfo = &appInfo;
@@ -2163,7 +2173,6 @@ int Player::InitVulkan()
2163
2173
InitVulkanFeatures (enabledFeatures, supportedFeatures);
2164
2174
2165
2175
bool VK_KHR_get_memory_requirements2_available = false ;
2166
- bool VK_KHR_dedicated_allocation_available = false ;
2167
2176
2168
2177
// Determine list of device extensions to enable.
2169
2178
std::vector<const char *> enabledDeviceExtensions;
@@ -2186,10 +2195,6 @@ int Player::InitVulkan()
2186
2195
{
2187
2196
VK_KHR_get_memory_requirements2_available = true ;
2188
2197
}
2189
- else if (strcmp (properties[i].extensionName , VK_KHR_DEDICATED_ALLOCATION_EXTENSION_NAME) == 0 )
2190
- {
2191
- VK_KHR_dedicated_allocation_available = true ;
2192
- }
2193
2198
else if (strcmp (properties[i].extensionName , VK_EXT_MEMORY_BUDGET_EXTENSION_NAME) == 0 )
2194
2199
{
2195
2200
if (VK_KHR_get_physical_device_properties2_enabled)
@@ -2201,26 +2206,6 @@ int Player::InitVulkan()
2201
2206
}
2202
2207
}
2203
2208
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
-
2224
2209
switch (g_VK_EXT_memory_budget_request)
2225
2210
{
2226
2211
case VULKAN_EXTENSION_REQUEST::DISABLED:
@@ -2238,11 +2223,6 @@ int Player::InitVulkan()
2238
2223
default : assert (0 );
2239
2224
}
2240
2225
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
- }
2246
2226
if (m_MemoryBudgetEnabled)
2247
2227
{
2248
2228
enabledDeviceExtensions.push_back (VK_EXT_MEMORY_BUDGET_EXTENSION_NAME);
@@ -2278,11 +2258,8 @@ int Player::InitVulkan()
2278
2258
allocatorInfo.device = m_Device;
2279
2259
allocatorInfo.flags = VMA_ALLOCATOR_CREATE_EXTERNALLY_SYNCHRONIZED_BIT;
2280
2260
allocatorInfo.pDeviceMemoryCallbacks = &deviceMemoryCallbacks;
2261
+ allocatorInfo.vulkanApiVersion = VULKAN_API_VERSION;
2281
2262
2282
- if (m_DedicatedAllocationEnabled)
2283
- {
2284
- allocatorInfo.flags |= VMA_ALLOCATOR_CREATE_KHR_DEDICATED_ALLOCATION_BIT;
2285
- }
2286
2263
if (m_MemoryBudgetEnabled)
2287
2264
{
2288
2265
allocatorInfo.flags |= VMA_ALLOCATOR_CREATE_EXT_MEMORY_BUDGET_BIT;
@@ -4005,8 +3982,6 @@ static void PrintCommandLineSyntax()
4005
3982
" Default is 1. Affects both creation of buffers and images, as well as calls to vmaSetAllocationUserData.\n "
4006
3983
" --VK_LAYER_LUNARG_standard_validation <Value> - 0 to disable or 1 to enable validation layers.\n "
4007
3984
" 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 "
4010
3985
" --VK_EXT_memory_budget <Value> - 0 to disable or 1 to enable this extension.\n "
4011
3986
" By default the extension is silently enabled if available.\n "
4012
3987
);
@@ -4227,7 +4202,6 @@ static int main2(int argc, char** argv)
4227
4202
cmdLineParser.RegisterOpt (CMD_LINE_OPT_LINES, " Lines" , true );
4228
4203
cmdLineParser.RegisterOpt (CMD_LINE_OPT_PHYSICAL_DEVICE, " PhysicalDevice" , true );
4229
4204
cmdLineParser.RegisterOpt (CMD_LINE_OPT_USER_DATA, " UserData" , true );
4230
- cmdLineParser.RegisterOpt (CMD_LINE_OPT_VK_KHR_DEDICATED_ALLOCATION, " VK_KHR_dedicated_allocation" , true );
4231
4205
cmdLineParser.RegisterOpt (CMD_LINE_OPT_VK_EXT_MEMORY_BUDGET, " VK_EXT_memory_budget" , true );
4232
4206
cmdLineParser.RegisterOpt (CMD_LINE_OPT_VK_LAYER_LUNARG_STANDARD_VALIDATION, VALIDATION_LAYER_NAME, true );
4233
4207
cmdLineParser.RegisterOpt (CMD_LINE_OPT_MEM_STATS, " MemStats" , true );
@@ -4287,22 +4261,6 @@ static int main2(int argc, char** argv)
4287
4261
return RESULT_ERROR_COMMAND_LINE;
4288
4262
}
4289
4263
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 ;
4306
4264
case CMD_LINE_OPT_VK_EXT_MEMORY_BUDGET:
4307
4265
{
4308
4266
bool newValue;
0 commit comments