Skip to content

Commit 6959216

Browse files
committed
video: check for maintenance5 and graphics_pipline_library
Signed-off-by: Ali Cheraghi <alichraghi@proton.me>
1 parent f75cb77 commit 6959216

File tree

3 files changed

+124
-106
lines changed

3 files changed

+124
-106
lines changed

src/nbl/video/CVulkanPhysicalDevice.cpp

Lines changed: 84 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,9 @@ std::unique_ptr<CVulkanPhysicalDevice> CVulkanPhysicalDevice::create(core::smart
259259
return nullptr;
260260
if (!isExtensionSupported(VK_EXT_ROBUSTNESS_2_EXTENSION_NAME))
261261
return nullptr;
262+
// At least one of these two must be available
263+
if (!isExtensionSupported(VK_KHR_MAINTENANCE_5_EXTENSION_NAME) && !isExtensionSupported(VK_EXT_GRAPHICS_PIPELINE_LIBRARY_EXTENSION_NAME))
264+
return nullptr;
262265

263266
// Basic stuff for constructing pNext chains
264267
VkBaseInStructure* pNextTail;
@@ -307,6 +310,8 @@ std::unique_ptr<CVulkanPhysicalDevice> CVulkanPhysicalDevice::create(core::smart
307310
VkPhysicalDeviceCooperativeMatrixPropertiesKHR cooperativeMatrixProperties = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COOPERATIVE_MATRIX_PROPERTIES_KHR };
308311
VkPhysicalDeviceShaderSMBuiltinsPropertiesNV shaderSMBuiltinsPropertiesNV = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_SM_BUILTINS_PROPERTIES_NV };
309312
VkPhysicalDeviceShaderCoreProperties2AMD shaderCoreProperties2AMD = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CORE_PROPERTIES_2_AMD };
313+
VkPhysicalDeviceMaintenance5PropertiesKHR maintenance5Properties = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_5_PROPERTIES_KHR };
314+
VkPhysicalDeviceGraphicsPipelineLibraryPropertiesEXT graphicsPipelineLibraryProperties = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GRAPHICS_PIPELINE_LIBRARY_PROPERTIES_EXT };
310315
//! Because Renderdoc is special and instead of ignoring extensions it whitelists them
311316
if (isExtensionSupported(VK_EXT_EXTERNAL_MEMORY_HOST_EXTENSION_NAME))
312317
addToPNextChain(&externalMemoryHostProperties);
@@ -333,8 +338,10 @@ std::unique_ptr<CVulkanPhysicalDevice> CVulkanPhysicalDevice::create(core::smart
333338
addToPNextChain(&cooperativeMatrixProperties);
334339
if (isExtensionSupported(VK_NV_SHADER_SM_BUILTINS_EXTENSION_NAME))
335340
addToPNextChain(&shaderSMBuiltinsPropertiesNV);
336-
if (isExtensionSupported(VK_AMD_SHADER_CORE_PROPERTIES_2_EXTENSION_NAME))
337-
addToPNextChain(&shaderCoreProperties2AMD);
341+
if (isExtensionSupported(VK_KHR_MAINTENANCE_5_EXTENSION_NAME))
342+
addToPNextChain(&maintenance5Properties);
343+
if (isExtensionSupported(VK_EXT_GRAPHICS_PIPELINE_LIBRARY_EXTENSION_NAME))
344+
addToPNextChain(&graphicsPipelineLibraryProperties);
338345
// call
339346
finalizePNextChain();
340347
vkGetPhysicalDeviceProperties2(vk_physicalDevice,&deviceProperties2);
@@ -390,44 +397,25 @@ std::unique_ptr<CVulkanPhysicalDevice> CVulkanPhysicalDevice::create(core::smart
390397

391398
//vulkan12Properties.denormBehaviorIndependence;
392399
//vulkan12Properties.denormBehaviorIndependence;
393-
if (!vulkan12Properties.shaderSignedZeroInfNanPreserveFloat16)
394-
return nullptr;
395-
if (!vulkan12Properties.shaderSignedZeroInfNanPreserveFloat32)
396-
return nullptr;
397-
if (!vulkan12Properties.shaderSignedZeroInfNanPreserveFloat64)
398-
return nullptr;
399-
if (!vulkan12Properties.shaderDenormPreserveFloat16)
400-
return nullptr;
401-
if (!vulkan12Properties.shaderDenormPreserveFloat32)
402-
return nullptr;
403-
if (!vulkan12Properties.shaderDenormPreserveFloat64)
404-
return nullptr;
405-
if (!vulkan12Properties.shaderDenormFlushToZeroFloat16)
406-
return nullptr;
407-
if (!vulkan12Properties.shaderDenormFlushToZeroFloat32)
408-
return nullptr;
409-
if (!vulkan12Properties.shaderDenormFlushToZeroFloat64)
410-
return nullptr;
411-
if (!vulkan12Properties.shaderRoundingModeRTEFloat16)
412-
return nullptr;
413-
if (!vulkan12Properties.shaderRoundingModeRTEFloat32)
414-
return nullptr;
415-
if (!vulkan12Properties.shaderRoundingModeRTEFloat64)
416-
return nullptr;
417-
if (!vulkan12Properties.shaderRoundingModeRTZFloat16)
418-
return nullptr;
419-
if (!vulkan12Properties.shaderRoundingModeRTZFloat32)
420-
return nullptr;
421-
if (!vulkan12Properties.shaderRoundingModeRTZFloat64)
422-
return nullptr;
423-
400+
properties.limits.shaderSignedZeroInfNanPreserveFloat32 = vulkan12Properties.shaderSignedZeroInfNanPreserveFloat32;
401+
properties.limits.shaderDenormPreserveFloat32 = vulkan12Properties.shaderDenormPreserveFloat32;
402+
properties.limits.shaderDenormFlushToZeroFloat32 = vulkan12Properties.shaderDenormFlushToZeroFloat32;
403+
properties.limits.shaderRoundingModeRTEFloat32 = vulkan12Properties.shaderRoundingModeRTEFloat32;
404+
properties.limits.shaderRoundingModeRTZFloat32 = vulkan12Properties.shaderRoundingModeRTZFloat32;
405+
properties.limits.shaderSignedZeroInfNanPreserveFloat16 = vulkan12Properties.shaderSignedZeroInfNanPreserveFloat16;
406+
properties.limits.shaderDenormPreserveFloat16 = vulkan12Properties.shaderDenormPreserveFloat16;
407+
properties.limits.shaderDenormFlushToZeroFloat16 = vulkan12Properties.shaderDenormFlushToZeroFloat16;
408+
properties.limits.shaderRoundingModeRTEFloat16 = vulkan12Properties.shaderRoundingModeRTEFloat16;
409+
properties.limits.shaderRoundingModeRTZFloat16 = vulkan12Properties.shaderRoundingModeRTZFloat16;
410+
properties.limits.shaderSignedZeroInfNanPreserveFloat64 = vulkan12Properties.shaderSignedZeroInfNanPreserveFloat64;
411+
properties.limits.shaderDenormPreserveFloat64 = vulkan12Properties.shaderDenormPreserveFloat64;
412+
properties.limits.shaderDenormFlushToZeroFloat64 = vulkan12Properties.shaderDenormFlushToZeroFloat64;
413+
properties.limits.shaderRoundingModeRTEFloat64 = vulkan12Properties.shaderRoundingModeRTEFloat64;
414+
properties.limits.shaderRoundingModeRTZFloat64 = vulkan12Properties.shaderRoundingModeRTZFloat64;
415+
416+
424417
// descriptor indexing
425418
properties.limits.maxUpdateAfterBindDescriptorsInAllPools = vulkan12Properties.maxUpdateAfterBindDescriptorsInAllPools;
426-
properties.limits.shaderUniformBufferArrayNonUniformIndexingNative = vulkan12Properties.shaderUniformBufferArrayNonUniformIndexingNative;
427-
properties.limits.shaderSampledImageArrayNonUniformIndexingNative = vulkan12Properties.shaderSampledImageArrayNonUniformIndexingNative;
428-
properties.limits.shaderStorageBufferArrayNonUniformIndexingNative = vulkan12Properties.shaderStorageBufferArrayNonUniformIndexingNative;
429-
properties.limits.shaderStorageImageArrayNonUniformIndexingNative = vulkan12Properties.shaderStorageImageArrayNonUniformIndexingNative;
430-
properties.limits.shaderInputAttachmentArrayNonUniformIndexingNative = vulkan12Properties.shaderInputAttachmentArrayNonUniformIndexingNative;
431419
properties.limits.robustBufferAccessUpdateAfterBind = vulkan12Properties.robustBufferAccessUpdateAfterBind;
432420
properties.limits.quadDivergentImplicitLod = vulkan12Properties.quadDivergentImplicitLod;
433421
properties.limits.maxPerStageDescriptorUpdateAfterBindSamplers = vulkan12Properties.maxPerStageDescriptorUpdateAfterBindSamplers;
@@ -716,7 +704,9 @@ std::unique_ptr<CVulkanPhysicalDevice> CVulkanPhysicalDevice::create(core::smart
716704
VkPhysicalDeviceRasterizationOrderAttachmentAccessFeaturesARM rasterizationOrderAttachmentAccessFeatures = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RASTERIZATION_ORDER_ATTACHMENT_ACCESS_FEATURES_ARM };
717705
VkPhysicalDeviceRayTracingPositionFetchFeaturesKHR rayTracingPositionFetchFeatures = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_POSITION_FETCH_FEATURES_KHR };
718706
VkPhysicalDeviceColorWriteEnableFeaturesEXT colorWriteEnableFeatures = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COLOR_WRITE_ENABLE_FEATURES_EXT };
719-
VkPhysicalDeviceCooperativeMatrixFeaturesKHR cooperativeMatrixFeatures = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COOPERATIVE_MATRIX_FEATURES_KHR };
707+
VkPhysicalDeviceCooperativeMatrixFeaturesKHR cooperativeMatrixFeatures = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COOPERATIVE_MATRIX_FEATURES_KHR };
708+
VkPhysicalDeviceMaintenance5FeaturesKHR maintenance5Features = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_5_FEATURES_KHR };
709+
VkPhysicalDeviceGraphicsPipelineLibraryFeaturesEXT graphicsPipelineLibraryFeatures = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GRAPHICS_PIPELINE_LIBRARY_FEATURES_EXT };
720710

721711
if (isExtensionSupported(VK_EXT_CONDITIONAL_RENDERING_EXTENSION_NAME))
722712
addToPNextChain(&conditionalRenderingFeatures);
@@ -781,6 +771,10 @@ std::unique_ptr<CVulkanPhysicalDevice> CVulkanPhysicalDevice::create(core::smart
781771
addToPNextChain(&rayTracingPositionFetchFeatures);
782772
if (isExtensionSupported(VK_EXT_COLOR_WRITE_ENABLE_EXTENSION_NAME))
783773
addToPNextChain(&colorWriteEnableFeatures);
774+
if (isExtensionSupported(VK_KHR_MAINTENANCE_5_EXTENSION_NAME))
775+
addToPNextChain(&maintenance5Features);
776+
if (isExtensionSupported(VK_EXT_GRAPHICS_PIPELINE_LIBRARY_EXTENSION_NAME))
777+
addToPNextChain(&graphicsPipelineLibraryFeatures);
784778
// call
785779
finalizePNextChain();
786780
vkGetPhysicalDeviceFeatures2(vk_physicalDevice,&deviceFeatures);
@@ -903,6 +897,43 @@ std::unique_ptr<CVulkanPhysicalDevice> CVulkanPhysicalDevice::create(core::smart
903897
properties.limits.shaderFloat16 = vulkan12Features.shaderFloat16;
904898
if (!vulkan12Features.shaderInt8)
905899
return nullptr;
900+
901+
if (!properties.limits.shaderSignedZeroInfNanPreserveFloat32)
902+
return nullptr;
903+
if (!properties.limits.shaderDenormPreserveFloat32)
904+
return nullptr;
905+
if (!properties.limits.shaderDenormFlushToZeroFloat32)
906+
return nullptr;
907+
if (!properties.limits.shaderRoundingModeRTEFloat32)
908+
return nullptr;
909+
if (!properties.limits.shaderRoundingModeRTZFloat32)
910+
return nullptr;
911+
912+
if (vulkan12Features.shaderFloat16) {
913+
if (!properties.limits.shaderSignedZeroInfNanPreserveFloat16)
914+
return nullptr;
915+
if (!properties.limits.shaderDenormPreserveFloat16)
916+
return nullptr;
917+
if (!properties.limits.shaderDenormFlushToZeroFloat16)
918+
return nullptr;
919+
if (!properties.limits.shaderRoundingModeRTEFloat16)
920+
return nullptr;
921+
if (!properties.limits.shaderRoundingModeRTZFloat16)
922+
return nullptr;
923+
}
924+
925+
if (deviceFeatures.features.shaderFloat64) {
926+
if (!properties.limits.shaderSignedZeroInfNanPreserveFloat64)
927+
return nullptr;
928+
if (!properties.limits.shaderDenormPreserveFloat64)
929+
return nullptr;
930+
if (!properties.limits.shaderDenormFlushToZeroFloat64)
931+
return nullptr;
932+
if (!properties.limits.shaderRoundingModeRTEFloat64)
933+
return nullptr;
934+
if (!properties.limits.shaderRoundingModeRTZFloat64)
935+
return nullptr;
936+
}
906937

907938
if (!vulkan12Features.descriptorIndexing)
908939
return nullptr;
@@ -1138,7 +1169,6 @@ std::unique_ptr<CVulkanPhysicalDevice> CVulkanPhysicalDevice::create(core::smart
11381169
if (isExtensionSupported(VK_KHR_COOPERATIVE_MATRIX_EXTENSION_NAME))
11391170
features.cooperativeMatrixRobustBufferAccess = cooperativeMatrixFeatures.cooperativeMatrixRobustBufferAccess;
11401171

1141-
11421172
/* Vulkan Extensions Features as Limits */
11431173
if (isExtensionSupported(VK_NV_SHADER_SM_BUILTINS_EXTENSION_NAME))
11441174
properties.limits.shaderSMBuiltins = shaderSMBuiltinsFeaturesNV.shaderSMBuiltins;
@@ -1211,7 +1241,7 @@ std::unique_ptr<CVulkanPhysicalDevice> CVulkanPhysicalDevice::create(core::smart
12111241
properties.limits.colorWriteEnable = colorWriteEnableFeatures.colorWriteEnable;
12121242

12131243
if (isExtensionSupported(VK_KHR_COOPERATIVE_MATRIX_EXTENSION_NAME))
1214-
properties.limits.cooperativeMatrixRobustBufferAccess = cooperativeMatrixFeatures.cooperativeMatrixRobustBufferAccess;
1244+
properties.limits.cooperativeMatrix = cooperativeMatrixFeatures.cooperativeMatrix;
12151245
}
12161246

12171247
// we compare all limits against the defaults easily!
@@ -1584,6 +1614,16 @@ core::smart_refctd_ptr<ILogicalDevice> CVulkanPhysicalDevice::createLogicalDevic
15841614

15851615
VkPhysicalDeviceCooperativeMatrixFeaturesKHR cooperativeMatrixFeatures = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COOPERATIVE_MATRIX_FEATURES_KHR,nullptr };
15861616
REQUIRE_EXTENSION_IF(enabledFeatures.cooperativeMatrixRobustBufferAccess,VK_KHR_COOPERATIVE_MATRIX_EXTENSION_NAME,&cooperativeMatrixFeatures);
1617+
1618+
VkPhysicalDeviceMaintenance5FeaturesKHR maintenance5Features = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_5_FEATURES_KHR, nullptr };
1619+
VkPhysicalDeviceGraphicsPipelineLibraryFeaturesEXT graphicsPipelineLibraryFeatures = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GRAPHICS_PIPELINE_LIBRARY_FEATURES_EXT, nullptr };
1620+
1621+
// Enable maintenance5 and graphics pipeline libraries as backup if available
1622+
if (!enableExtensionIfAvailable(VK_KHR_MAINTENANCE_5_EXTENSION_NAME, &maintenance5Features))
1623+
{
1624+
enableExtensionIfAvailable(VK_KHR_PIPELINE_LIBRARY_EXTENSION_NAME, nullptr);
1625+
enableExtensionIfAvailable(VK_EXT_GRAPHICS_PIPELINE_LIBRARY_EXTENSION_NAME, &graphicsPipelineLibraryFeatures);
1626+
}
15871627

15881628
#undef REQUIRE_EXTENSION_IF
15891629

@@ -1828,10 +1868,12 @@ core::smart_refctd_ptr<ILogicalDevice> CVulkanPhysicalDevice::createLogicalDevic
18281868
//colorWriteEnableFeatures [LIMIT SO ENABLE EVERYTHING BY DEFAULT]
18291869

18301870
if (limits.cooperativeMatrix) {
1831-
cooperativeMatrixFeatures.cooperativeMatrix = enabledFeatures.cooperativeMatrix;
18321871
cooperativeMatrixFeatures.cooperativeMatrixRobustBufferAccess = enabledFeatures.cooperativeMatrixRobustBufferAccess;
18331872
}
18341873

1874+
maintenance5Features.maintenance5 = true;
1875+
graphicsPipelineLibraryFeatures.graphicsPipelineLibrary = maintenance5Features.maintenance5 == 0;
1876+
18351877
// convert a set into a vector
18361878
core::vector<const char*> extensionStrings(extensionsToEnable.size());
18371879
{

src/nbl/video/device_capabilities/device_features.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -999,7 +999,7 @@
999999
{
10001000
"type": "bool",
10011001
"name": "inlineUniformBlock",
1002-
"value": true,
1002+
"value": false,
10031003
"expose": "DISABLE",
10041004
"comment": ["Vulkan 1.3, Nabla Core Profile:"]
10051005
},
@@ -3202,7 +3202,6 @@
32023202
"value": null,
32033203
"expose": "DISABLE",
32043204
"comment": [
3205-
"[TODO] this one isn't in the headers yet",
32063205
"GraphicsPipelineLibraryFeaturesEXT",
32073206
"VK_EXT_graphics_pipeline_library"
32083207
]
@@ -4145,7 +4144,8 @@
41454144
{
41464145
"type": "bool",
41474146
"name": "cooperativeMatrix",
4148-
"value": false
4147+
"value": false,
4148+
"expose": "MOVE_TO_LIMIT"
41494149
},
41504150
{
41514151
"type": "bool",

0 commit comments

Comments
 (0)