Skip to content

Commit 7e471b4

Browse files
committed
video: fix remaining limits/features/checks
Signed-off-by: Ali Cheraghi <alichraghi@proton.me>
1 parent c8cf8f4 commit 7e471b4

File tree

4 files changed

+106
-92
lines changed

4 files changed

+106
-92
lines changed

src/nbl/video/CVulkanPhysicalDevice.cpp

Lines changed: 40 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -304,9 +304,7 @@ std::unique_ptr<CVulkanPhysicalDevice> CVulkanPhysicalDevice::create(core::smart
304304
//VkPhysicalDeviceGraphicsPipelineLibraryPropertiesEXT graphicsPipelineLibraryProperties = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GRAPHICS_PIPELINE_LIBRARY_PROPERTIES_EXT };
305305
VkPhysicalDeviceFragmentDensityMap2PropertiesEXT fragmentDensityMap2Properties = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_2_PROPERTIES_EXT };
306306
VkPhysicalDeviceRayTracingPipelinePropertiesKHR rayTracingPipelineProperties = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_PIPELINE_PROPERTIES_KHR };
307-
#if 0 // TODO
308307
VkPhysicalDeviceCooperativeMatrixPropertiesKHR cooperativeMatrixProperties = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COOPERATIVE_MATRIX_PROPERTIES_KHR };
309-
#endif
310308
VkPhysicalDeviceShaderSMBuiltinsPropertiesNV shaderSMBuiltinsPropertiesNV = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_SM_BUILTINS_PROPERTIES_NV };
311309
VkPhysicalDeviceShaderCoreProperties2AMD shaderCoreProperties2AMD = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CORE_PROPERTIES_2_AMD };
312310
//! Because Renderdoc is special and instead of ignoring extensions it whitelists them
@@ -331,10 +329,8 @@ std::unique_ptr<CVulkanPhysicalDevice> CVulkanPhysicalDevice::create(core::smart
331329
addToPNextChain(&fragmentDensityMap2Properties);
332330
if (isExtensionSupported(VK_KHR_RAY_TRACING_PIPELINE_EXTENSION_NAME))
333331
addToPNextChain(&rayTracingPipelineProperties);
334-
#if 0 // TODO
335332
if (isExtensionSupported(VK_KHR_COOPERATIVE_MATRIX_EXTENSION_NAME))
336333
addToPNextChain(&cooperativeMatrixProperties);
337-
#endif
338334
if (isExtensionSupported(VK_NV_SHADER_SM_BUILTINS_EXTENSION_NAME))
339335
addToPNextChain(&shaderSMBuiltinsPropertiesNV);
340336
if (isExtensionSupported(VK_AMD_SHADER_CORE_PROPERTIES_2_EXTENSION_NAME))
@@ -398,19 +394,32 @@ std::unique_ptr<CVulkanPhysicalDevice> CVulkanPhysicalDevice::create(core::smart
398394
return nullptr;
399395
if (!vulkan12Properties.shaderSignedZeroInfNanPreserveFloat32)
400396
return nullptr;
401-
properties.limits.shaderSignedZeroInfNanPreserveFloat64 = vulkan12Properties.shaderSignedZeroInfNanPreserveFloat64;
402-
properties.limits.shaderDenormPreserveFloat16 = vulkan12Properties.shaderDenormPreserveFloat16;
403-
properties.limits.shaderDenormPreserveFloat32 = vulkan12Properties.shaderDenormPreserveFloat32;
404-
properties.limits.shaderDenormPreserveFloat64 = vulkan12Properties.shaderDenormPreserveFloat64;
405-
properties.limits.shaderDenormFlushToZeroFloat16 = vulkan12Properties.shaderDenormFlushToZeroFloat16;
406-
properties.limits.shaderDenormFlushToZeroFloat32 = vulkan12Properties.shaderDenormFlushToZeroFloat32;
407-
properties.limits.shaderDenormFlushToZeroFloat64 = vulkan12Properties.shaderDenormFlushToZeroFloat64;
408-
properties.limits.shaderRoundingModeRTEFloat16 = vulkan12Properties.shaderRoundingModeRTEFloat16;
409-
properties.limits.shaderRoundingModeRTEFloat32 = vulkan12Properties.shaderRoundingModeRTEFloat32;
410-
properties.limits.shaderRoundingModeRTEFloat64 = vulkan12Properties.shaderRoundingModeRTEFloat64;
411-
properties.limits.shaderRoundingModeRTZFloat16 = vulkan12Properties.shaderRoundingModeRTZFloat16;
412-
properties.limits.shaderRoundingModeRTZFloat32 = vulkan12Properties.shaderRoundingModeRTZFloat32;
413-
properties.limits.shaderRoundingModeRTZFloat64 = vulkan12Properties.shaderRoundingModeRTZFloat64;
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;
414423

415424
// descriptor indexing
416425
properties.limits.maxUpdateAfterBindDescriptorsInAllPools = vulkan12Properties.maxUpdateAfterBindDescriptorsInAllPools;
@@ -439,8 +448,9 @@ std::unique_ptr<CVulkanPhysicalDevice> CVulkanPhysicalDevice::create(core::smart
439448

440449
properties.limits.supportedDepthResolveModes = static_cast<SPhysicalDeviceLimits::RESOLVE_MODE_FLAGS>(vulkan12Properties.supportedDepthResolveModes);
441450
properties.limits.supportedStencilResolveModes = static_cast<SPhysicalDeviceLimits::RESOLVE_MODE_FLAGS>(vulkan12Properties.supportedStencilResolveModes);
442-
properties.limits.independentResolveNone = vulkan12Properties.independentResolveNone;
443-
properties.limits.independentResolve = vulkan12Properties.independentResolve;
451+
452+
if (!vulkan12Properties.independentResolve || !vulkan12Properties.independentResolveNone)
453+
return nullptr;
444454

445455
// not dealing with vulkan12Properties.filterMinmaxSingleComponentFormats, TODO report in usage
446456
properties.limits.filterMinmaxImageComponentMapping = vulkan12Properties.filterMinmaxImageComponentMapping;
@@ -608,10 +618,9 @@ std::unique_ptr<CVulkanPhysicalDevice> CVulkanPhysicalDevice::create(core::smart
608618
properties.limits.shaderGroupHandleAlignment = rayTracingPipelineProperties.shaderGroupHandleAlignment;
609619
properties.limits.maxRayHitAttributeSize = rayTracingPipelineProperties.maxRayHitAttributeSize;
610620
}
611-
#if 0 //TODO
621+
612622
if (isExtensionSupported(VK_KHR_COOPERATIVE_MATRIX_EXTENSION_NAME))
613623
properties.limits.cooperativeMatrixSupportedStages = static_cast<asset::IShader::E_SHADER_STAGE>(cooperativeMatrixProperties.cooperativeMatrixSupportedStages);
614-
#endif
615624

616625

617626
//! Nabla
@@ -707,9 +716,8 @@ std::unique_ptr<CVulkanPhysicalDevice> CVulkanPhysicalDevice::create(core::smart
707716
VkPhysicalDeviceRasterizationOrderAttachmentAccessFeaturesARM rasterizationOrderAttachmentAccessFeatures = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RASTERIZATION_ORDER_ATTACHMENT_ACCESS_FEATURES_ARM };
708717
VkPhysicalDeviceRayTracingPositionFetchFeaturesKHR rayTracingPositionFetchFeatures = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_POSITION_FETCH_FEATURES_KHR };
709718
VkPhysicalDeviceColorWriteEnableFeaturesEXT colorWriteEnableFeatures = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COLOR_WRITE_ENABLE_FEATURES_EXT };
710-
#if 0
711719
VkPhysicalDeviceCooperativeMatrixFeaturesKHR cooperativeMatrixFeatures = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COOPERATIVE_MATRIX_FEATURES_KHR };
712-
#endif
720+
713721
if (isExtensionSupported(VK_EXT_CONDITIONAL_RENDERING_EXTENSION_NAME))
714722
addToPNextChain(&conditionalRenderingFeatures);
715723
if (isExtensionSupported(VK_KHR_PERFORMANCE_QUERY_EXTENSION_NAME))
@@ -1126,10 +1134,9 @@ std::unique_ptr<CVulkanPhysicalDevice> CVulkanPhysicalDevice::create(core::smart
11261134
features.rasterizationOrderDepthAttachmentAccess = rasterizationOrderAttachmentAccessFeatures.rasterizationOrderDepthAttachmentAccess;
11271135
features.rasterizationOrderStencilAttachmentAccess = rasterizationOrderAttachmentAccessFeatures.rasterizationOrderStencilAttachmentAccess;
11281136
}
1129-
#if 0
1137+
11301138
if (isExtensionSupported(VK_KHR_COOPERATIVE_MATRIX_EXTENSION_NAME))
11311139
features.cooperativeMatrixRobustBufferAccess = cooperativeMatrixFeatures.cooperativeMatrixRobustBufferAccess;
1132-
#endif
11331140

11341141

11351142
/* Vulkan Extensions Features as Limits */
@@ -1202,10 +1209,9 @@ std::unique_ptr<CVulkanPhysicalDevice> CVulkanPhysicalDevice::create(core::smart
12021209

12031210
if (isExtensionSupported(VK_EXT_COLOR_WRITE_ENABLE_EXTENSION_NAME))
12041211
properties.limits.colorWriteEnable = colorWriteEnableFeatures.colorWriteEnable;
1205-
#if 0 //TODO
1212+
12061213
if (isExtensionSupported(VK_KHR_COOPERATIVE_MATRIX_EXTENSION_NAME))
1207-
properties.limits.cooperativeMatrixRobustness = cooperativeMatrixFeatures.robustness;
1208-
#endif
1214+
properties.limits.cooperativeMatrixRobustBufferAccess = cooperativeMatrixFeatures.cooperativeMatrixRobustBufferAccess;
12091215
}
12101216

12111217
// we compare all limits against the defaults easily!
@@ -1575,10 +1581,9 @@ core::smart_refctd_ptr<ILogicalDevice> CVulkanPhysicalDevice::createLogicalDevic
15751581

15761582
VkPhysicalDeviceColorWriteEnableFeaturesEXT colorWriteEnableFeatures = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COLOR_WRITE_ENABLE_FEATURES_EXT,nullptr };
15771583
enableExtensionIfAvailable(VK_EXT_COLOR_WRITE_ENABLE_EXTENSION_NAME,&colorWriteEnableFeatures);
1578-
#if 0
1584+
15791585
VkPhysicalDeviceCooperativeMatrixFeaturesKHR cooperativeMatrixFeatures = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COOPERATIVE_MATRIX_FEATURES_KHR,nullptr };
15801586
REQUIRE_EXTENSION_IF(enabledFeatures.cooperativeMatrixRobustBufferAccess,VK_KHR_COOPERATIVE_MATRIX_EXTENSION_NAME,&cooperativeMatrixFeatures);
1581-
#endif
15821587

15831588
#undef REQUIRE_EXTENSION_IF
15841589

@@ -1821,10 +1826,11 @@ core::smart_refctd_ptr<ILogicalDevice> CVulkanPhysicalDevice::createLogicalDevic
18211826
rasterizationOrderAttachmentAccessFeatures.rasterizationOrderStencilAttachmentAccess = enabledFeatures.rasterizationOrderStencilAttachmentAccess;
18221827

18231828
//colorWriteEnableFeatures [LIMIT SO ENABLE EVERYTHING BY DEFAULT]
1824-
#if 0
1825-
cooperativeMatrixFeatures.cooperativeMatrix = true;
1826-
cooperativeMatrixFeatures.cooperativeMatrixRobustBufferAccess = enabledFeatures.cooperativeMatrixRobustBufferAccess;
1827-
#endif
1829+
1830+
if (limits.cooperativeMatrix) {
1831+
cooperativeMatrixFeatures.cooperativeMatrix = enabledFeatures.cooperativeMatrix;
1832+
cooperativeMatrixFeatures.cooperativeMatrixRobustBufferAccess = enabledFeatures.cooperativeMatrixRobustBufferAccess;
1833+
}
18281834

18291835
// convert a set into a vector
18301836
core::vector<const char*> extensionStrings(extensionsToEnable.size());

src/nbl/video/ILogicalDevice.cpp

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -673,8 +673,6 @@ core::smart_refctd_ptr<IGPURenderpass> ILogicalDevice::createRenderpass(const IG
673673
const auto mixedAttachmentSamples = getEnabledFeatures().mixedAttachmentSamples;
674674
const auto supportedDepthResolveModes = getPhysicalDeviceLimits().supportedDepthResolveModes;
675675
const auto supportedStencilResolveModes = getPhysicalDeviceLimits().supportedStencilResolveModes;
676-
const auto independentResolve = getPhysicalDeviceLimits().independentResolve;
677-
const auto independentResolveNone = getPhysicalDeviceLimits().independentResolveNone;
678676
const auto maxColorAttachments = getPhysicalDeviceLimits().maxColorAttachments;
679677
const int32_t maxMultiviewViewCount = getPhysicalDeviceLimits().maxMultiviewViewCount;
680678
for (auto i=0u; i<validation.subpassCount; i++)
@@ -713,30 +711,6 @@ core::smart_refctd_ptr<IGPURenderpass> ILogicalDevice::createRenderpass(const IG
713711
return nullptr;
714712
}
715713

716-
if (hasDepth && hasStencil)
717-
{
718-
if (!independentResolve && depthResolve!=stencilResolve)
719-
{
720-
if (independentResolveNone)
721-
{
722-
// https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkSubpassDescriptionDepthStencilResolve-pDepthStencilResolveAttachment-03186
723-
// https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkSubpassDescriptionDepthStencilResolve-pNext-06877
724-
if (depthResolve != resolve_flag_t::NONE && stencilResolve != resolve_flag_t::NONE)
725-
{
726-
NBL_LOG_ERROR("Invalid stencil attachment's resolve mode (subpasses[%u])", i);
727-
return nullptr;
728-
}
729-
}
730-
// https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkSubpassDescriptionDepthStencilResolve-pDepthStencilResolveAttachment-03185
731-
// https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkSubpassDescriptionDepthStencilResolve-pNext-06876
732-
else
733-
{
734-
NBL_LOG_ERROR("Invalid stencil attachment's resolve mode (subpasses[%u])", i);
735-
return nullptr;
736-
}
737-
}
738-
}
739-
740714
// https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkSubpassDescriptionDepthStencilResolve-pNext-06873
741715
if (/*multisampledToSingleSampledUsed*/false && depthResolve == resolve_flag_t::NONE && stencilResolve == resolve_flag_t::NONE)
742716
{

src/nbl/video/device_capabilities/device_features.json

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -980,7 +980,7 @@
980980
{
981981
"type": "bool",
982982
"name": "robustImageAccess",
983-
"value": true,
983+
"value": false,
984984
"comment": [
985985
"This feature adds stricter requirements for how out of bounds reads from images are handled.",
986986
"Rather than returning undefined values,",
@@ -1106,7 +1106,7 @@
11061106
{
11071107
"type": "bool",
11081108
"name": "dynamicRendering",
1109-
"value": true,
1109+
"value": false,
11101110
"expose": "DISABLE",
11111111
"comment": [
11121112
"[DO NOT EXPOSE] EVIL",
@@ -4138,13 +4138,20 @@
41384138
]
41394139
},
41404140
{
4141-
"type": "bool",
4142-
"name": "cooperativeMatrixRobustBufferAccess",
4143-
"value": false,
41444141
"comment": [
4145-
"[EXPOSE AS LIMIT] redundant",
4146-
"bool cooperativeMatrix = limits.cooperativeMatrixSupportedStages.any();",
4147-
"leaving as a feature because of overhead"
4142+
"VK_KHR_cooperative_matrix"
4143+
],
4144+
"entries": [
4145+
{
4146+
"type": "bool",
4147+
"name": "cooperativeMatrix",
4148+
"value": false
4149+
},
4150+
{
4151+
"type": "bool",
4152+
"name": "cooperativeMatrixRobustBufferAccess",
4153+
"value": false
4154+
}
41484155
]
41494156
},
41504157
{

0 commit comments

Comments
 (0)