Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

video: adjust device_limits/features to the updated profiles #829

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 45 additions & 41 deletions src/nbl/video/CVulkanPhysicalDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -304,9 +304,7 @@ std::unique_ptr<CVulkanPhysicalDevice> CVulkanPhysicalDevice::create(core::smart
//VkPhysicalDeviceGraphicsPipelineLibraryPropertiesEXT graphicsPipelineLibraryProperties = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GRAPHICS_PIPELINE_LIBRARY_PROPERTIES_EXT };
VkPhysicalDeviceFragmentDensityMap2PropertiesEXT fragmentDensityMap2Properties = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_2_PROPERTIES_EXT };
VkPhysicalDeviceRayTracingPipelinePropertiesKHR rayTracingPipelineProperties = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_PIPELINE_PROPERTIES_KHR };
#if 0 // TODO
VkPhysicalDeviceCooperativeMatrixPropertiesKHR cooperativeMatrixProperties = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COOPERATIVE_MATRIX_PROPERTIES_KHR };
#endif
VkPhysicalDeviceShaderSMBuiltinsPropertiesNV shaderSMBuiltinsPropertiesNV = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_SM_BUILTINS_PROPERTIES_NV };
VkPhysicalDeviceShaderCoreProperties2AMD shaderCoreProperties2AMD = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CORE_PROPERTIES_2_AMD };
//! Because Renderdoc is special and instead of ignoring extensions it whitelists them
Expand All @@ -331,10 +329,8 @@ std::unique_ptr<CVulkanPhysicalDevice> CVulkanPhysicalDevice::create(core::smart
addToPNextChain(&fragmentDensityMap2Properties);
if (isExtensionSupported(VK_KHR_RAY_TRACING_PIPELINE_EXTENSION_NAME))
addToPNextChain(&rayTracingPipelineProperties);
#if 0 // TODO
if (isExtensionSupported(VK_KHR_COOPERATIVE_MATRIX_EXTENSION_NAME))
addToPNextChain(&cooperativeMatrixProperties);
#endif
if (isExtensionSupported(VK_NV_SHADER_SM_BUILTINS_EXTENSION_NAME))
addToPNextChain(&shaderSMBuiltinsPropertiesNV);
if (isExtensionSupported(VK_AMD_SHADER_CORE_PROPERTIES_2_EXTENSION_NAME))
Expand Down Expand Up @@ -398,19 +394,32 @@ std::unique_ptr<CVulkanPhysicalDevice> CVulkanPhysicalDevice::create(core::smart
return nullptr;
if (!vulkan12Properties.shaderSignedZeroInfNanPreserveFloat32)
return nullptr;
properties.limits.shaderSignedZeroInfNanPreserveFloat64 = vulkan12Properties.shaderSignedZeroInfNanPreserveFloat64;
properties.limits.shaderDenormPreserveFloat16 = vulkan12Properties.shaderDenormPreserveFloat16;
properties.limits.shaderDenormPreserveFloat32 = vulkan12Properties.shaderDenormPreserveFloat32;
properties.limits.shaderDenormPreserveFloat64 = vulkan12Properties.shaderDenormPreserveFloat64;
properties.limits.shaderDenormFlushToZeroFloat16 = vulkan12Properties.shaderDenormFlushToZeroFloat16;
properties.limits.shaderDenormFlushToZeroFloat32 = vulkan12Properties.shaderDenormFlushToZeroFloat32;
properties.limits.shaderDenormFlushToZeroFloat64 = vulkan12Properties.shaderDenormFlushToZeroFloat64;
properties.limits.shaderRoundingModeRTEFloat16 = vulkan12Properties.shaderRoundingModeRTEFloat16;
properties.limits.shaderRoundingModeRTEFloat32 = vulkan12Properties.shaderRoundingModeRTEFloat32;
properties.limits.shaderRoundingModeRTEFloat64 = vulkan12Properties.shaderRoundingModeRTEFloat64;
properties.limits.shaderRoundingModeRTZFloat16 = vulkan12Properties.shaderRoundingModeRTZFloat16;
properties.limits.shaderRoundingModeRTZFloat32 = vulkan12Properties.shaderRoundingModeRTZFloat32;
properties.limits.shaderRoundingModeRTZFloat64 = vulkan12Properties.shaderRoundingModeRTZFloat64;
if (!vulkan12Properties.shaderSignedZeroInfNanPreserveFloat64)
return nullptr;
if (!vulkan12Properties.shaderDenormPreserveFloat16)
return nullptr;
if (!vulkan12Properties.shaderDenormPreserveFloat32)
return nullptr;
if (!vulkan12Properties.shaderDenormPreserveFloat64)
return nullptr;
if (!vulkan12Properties.shaderDenormFlushToZeroFloat16)
return nullptr;
if (!vulkan12Properties.shaderDenormFlushToZeroFloat32)
return nullptr;
if (!vulkan12Properties.shaderDenormFlushToZeroFloat64)
return nullptr;
if (!vulkan12Properties.shaderRoundingModeRTEFloat16)
return nullptr;
if (!vulkan12Properties.shaderRoundingModeRTEFloat32)
return nullptr;
if (!vulkan12Properties.shaderRoundingModeRTEFloat64)
return nullptr;
if (!vulkan12Properties.shaderRoundingModeRTZFloat16)
return nullptr;
if (!vulkan12Properties.shaderRoundingModeRTZFloat32)
return nullptr;
if (!vulkan12Properties.shaderRoundingModeRTZFloat64)
return nullptr;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the 16 and 32 should only be checked if the float16 and float64 feature is available.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but properties are declared before features (in a different scope). wanna move them out?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you want to move the checks of the limits into where the features are already known, yes


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

properties.limits.supportedDepthResolveModes = static_cast<SPhysicalDeviceLimits::RESOLVE_MODE_FLAGS>(vulkan12Properties.supportedDepthResolveModes);
properties.limits.supportedStencilResolveModes = static_cast<SPhysicalDeviceLimits::RESOLVE_MODE_FLAGS>(vulkan12Properties.supportedStencilResolveModes);
properties.limits.independentResolveNone = vulkan12Properties.independentResolveNone;
properties.limits.independentResolve = vulkan12Properties.independentResolve;

if (!vulkan12Properties.independentResolve || !vulkan12Properties.independentResolveNone)
return nullptr;

// not dealing with vulkan12Properties.filterMinmaxSingleComponentFormats, TODO report in usage
properties.limits.filterMinmaxImageComponentMapping = vulkan12Properties.filterMinmaxImageComponentMapping;
Expand All @@ -458,7 +468,7 @@ std::unique_ptr<CVulkanPhysicalDevice> CVulkanPhysicalDevice::create(core::smart
properties.limits.maxComputeWorkgroupSubgroups = vulkan13Properties.maxComputeWorkgroupSubgroups;
properties.limits.requiredSubgroupSizeStages = static_cast<asset::IShader::E_SHADER_STAGE>(vulkan13Properties.requiredSubgroupSizeStages&VK_SHADER_STAGE_ALL);

// don't real with inline uniform blocks yet
// don't deal with inline uniform blocks yet

properties.limits.integerDotProduct8BitUnsignedAccelerated = vulkan13Properties.integerDotProduct8BitUnsignedAccelerated;
properties.limits.integerDotProduct8BitSignedAccelerated = vulkan13Properties.integerDotProduct8BitSignedAccelerated;
Expand Down Expand Up @@ -608,10 +618,9 @@ std::unique_ptr<CVulkanPhysicalDevice> CVulkanPhysicalDevice::create(core::smart
properties.limits.shaderGroupHandleAlignment = rayTracingPipelineProperties.shaderGroupHandleAlignment;
properties.limits.maxRayHitAttributeSize = rayTracingPipelineProperties.maxRayHitAttributeSize;
}
#if 0 //TODO

if (isExtensionSupported(VK_KHR_COOPERATIVE_MATRIX_EXTENSION_NAME))
properties.limits.cooperativeMatrixSupportedStages = static_cast<asset::IShader::E_SHADER_STAGE>(cooperativeMatrixProperties.cooperativeMatrixSupportedStages);
#endif


//! Nabla
Expand Down Expand Up @@ -707,9 +716,8 @@ std::unique_ptr<CVulkanPhysicalDevice> CVulkanPhysicalDevice::create(core::smart
VkPhysicalDeviceRasterizationOrderAttachmentAccessFeaturesARM rasterizationOrderAttachmentAccessFeatures = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RASTERIZATION_ORDER_ATTACHMENT_ACCESS_FEATURES_ARM };
VkPhysicalDeviceRayTracingPositionFetchFeaturesKHR rayTracingPositionFetchFeatures = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_POSITION_FETCH_FEATURES_KHR };
VkPhysicalDeviceColorWriteEnableFeaturesEXT colorWriteEnableFeatures = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COLOR_WRITE_ENABLE_FEATURES_EXT };
#if 0
VkPhysicalDeviceCooperativeMatrixFeaturesKHR cooperativeMatrixFeatures = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COOPERATIVE_MATRIX_FEATURES_KHR };
#endif

if (isExtensionSupported(VK_EXT_CONDITIONAL_RENDERING_EXTENSION_NAME))
addToPNextChain(&conditionalRenderingFeatures);
if (isExtensionSupported(VK_KHR_PERFORMANCE_QUERY_EXTENSION_NAME))
Expand Down Expand Up @@ -903,11 +911,9 @@ std::unique_ptr<CVulkanPhysicalDevice> CVulkanPhysicalDevice::create(core::smart
if (!vulkan12Features.shaderUniformTexelBufferArrayDynamicIndexing || !vulkan12Features.shaderStorageTexelBufferArrayDynamicIndexing)
return nullptr;
// not uniform at all
properties.limits.shaderUniformBufferArrayNonUniformIndexing = vulkan12Features.shaderUniformBufferArrayNonUniformIndexing;
if (!vulkan12Features.shaderSampledImageArrayNonUniformIndexing || !vulkan12Features.shaderStorageBufferArrayNonUniformIndexing || !vulkan12Features.shaderStorageImageArrayNonUniformIndexing)
if (!vulkan12Features.shaderUniformBufferArrayNonUniformIndexing || !vulkan12Features.shaderSampledImageArrayNonUniformIndexing || !vulkan12Features.shaderStorageBufferArrayNonUniformIndexing || !vulkan12Features.shaderStorageImageArrayNonUniformIndexing)
return nullptr;
properties.limits.shaderInputAttachmentArrayNonUniformIndexing = vulkan12Features.shaderInputAttachmentArrayNonUniformIndexing;
if (!vulkan12Features.shaderUniformTexelBufferArrayNonUniformIndexing || !vulkan12Features.shaderStorageTexelBufferArrayNonUniformIndexing)
if (!vulkan12Features.shaderInputAttachmentArrayNonUniformIndexing || !vulkan12Features.shaderUniformTexelBufferArrayNonUniformIndexing || !vulkan12Features.shaderStorageTexelBufferArrayNonUniformIndexing)
return nullptr;
// update after bind
properties.limits.descriptorBindingUniformBufferUpdateAfterBind = vulkan12Features.descriptorBindingUniformBufferUpdateAfterBind;
Expand Down Expand Up @@ -1128,10 +1134,9 @@ std::unique_ptr<CVulkanPhysicalDevice> CVulkanPhysicalDevice::create(core::smart
features.rasterizationOrderDepthAttachmentAccess = rasterizationOrderAttachmentAccessFeatures.rasterizationOrderDepthAttachmentAccess;
features.rasterizationOrderStencilAttachmentAccess = rasterizationOrderAttachmentAccessFeatures.rasterizationOrderStencilAttachmentAccess;
}
#if 0

if (isExtensionSupported(VK_KHR_COOPERATIVE_MATRIX_EXTENSION_NAME))
features.cooperativeMatrixRobustBufferAccess = cooperativeMatrixFeatures.cooperativeMatrixRobustBufferAccess;
#endif


/* Vulkan Extensions Features as Limits */
Expand Down Expand Up @@ -1204,10 +1209,9 @@ std::unique_ptr<CVulkanPhysicalDevice> CVulkanPhysicalDevice::create(core::smart

if (isExtensionSupported(VK_EXT_COLOR_WRITE_ENABLE_EXTENSION_NAME))
properties.limits.colorWriteEnable = colorWriteEnableFeatures.colorWriteEnable;
#if 0 //TODO

if (isExtensionSupported(VK_KHR_COOPERATIVE_MATRIX_EXTENSION_NAME))
properties.limits.cooperativeMatrixRobustness = cooperativeMatrixFeatures.robustness;
#endif
properties.limits.cooperativeMatrixRobustBufferAccess = cooperativeMatrixFeatures.cooperativeMatrixRobustBufferAccess;
}

// we compare all limits against the defaults easily!
Expand Down Expand Up @@ -1577,10 +1581,9 @@ core::smart_refctd_ptr<ILogicalDevice> CVulkanPhysicalDevice::createLogicalDevic

VkPhysicalDeviceColorWriteEnableFeaturesEXT colorWriteEnableFeatures = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COLOR_WRITE_ENABLE_FEATURES_EXT,nullptr };
enableExtensionIfAvailable(VK_EXT_COLOR_WRITE_ENABLE_EXTENSION_NAME,&colorWriteEnableFeatures);
#if 0

VkPhysicalDeviceCooperativeMatrixFeaturesKHR cooperativeMatrixFeatures = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COOPERATIVE_MATRIX_FEATURES_KHR,nullptr };
REQUIRE_EXTENSION_IF(enabledFeatures.cooperativeMatrixRobustBufferAccess,VK_KHR_COOPERATIVE_MATRIX_EXTENSION_NAME,&cooperativeMatrixFeatures);
#endif

#undef REQUIRE_EXTENSION_IF

Expand Down Expand Up @@ -1677,11 +1680,11 @@ core::smart_refctd_ptr<ILogicalDevice> CVulkanPhysicalDevice::createLogicalDevic
vulkan12Features.shaderInputAttachmentArrayDynamicIndexing = limits.shaderInputAttachmentArrayDynamicIndexing;
vulkan12Features.shaderUniformTexelBufferArrayDynamicIndexing = true; // implied by `descriptorIndexing`
vulkan12Features.shaderStorageTexelBufferArrayDynamicIndexing = true; // implied by `descriptorIndexing`
vulkan12Features.shaderUniformBufferArrayNonUniformIndexing = limits.shaderUniformBufferArrayNonUniformIndexing;
vulkan12Features.shaderUniformBufferArrayNonUniformIndexing = true; // implied by `descriptorIndexing`
vulkan12Features.shaderSampledImageArrayNonUniformIndexing = true; // implied by `descriptorIndexing`
vulkan12Features.shaderStorageBufferArrayNonUniformIndexing = true; // implied by `descriptorIndexing`
vulkan12Features.shaderStorageImageArrayNonUniformIndexing = true; // require
vulkan12Features.shaderInputAttachmentArrayNonUniformIndexing = limits.shaderInputAttachmentArrayNonUniformIndexing;
vulkan12Features.shaderInputAttachmentArrayNonUniformIndexing = true; // implied by `descriptorIndexing`
vulkan12Features.shaderUniformTexelBufferArrayNonUniformIndexing = true; // implied by `descriptorIndexing`
vulkan12Features.shaderStorageTexelBufferArrayNonUniformIndexing = true; // ubiquitous
vulkan12Features.descriptorBindingUniformBufferUpdateAfterBind = limits.descriptorBindingUniformBufferUpdateAfterBind;
Expand Down Expand Up @@ -1823,10 +1826,11 @@ core::smart_refctd_ptr<ILogicalDevice> CVulkanPhysicalDevice::createLogicalDevic
rasterizationOrderAttachmentAccessFeatures.rasterizationOrderStencilAttachmentAccess = enabledFeatures.rasterizationOrderStencilAttachmentAccess;

//colorWriteEnableFeatures [LIMIT SO ENABLE EVERYTHING BY DEFAULT]
#if 0
cooperativeMatrixFeatures.cooperativeMatrix = true;
cooperativeMatrixFeatures.cooperativeMatrixRobustBufferAccess = enabledFeatures.cooperativeMatrixRobustBufferAccess;
#endif

if (limits.cooperativeMatrix) {
cooperativeMatrixFeatures.cooperativeMatrix = enabledFeatures.cooperativeMatrix;
cooperativeMatrixFeatures.cooperativeMatrixRobustBufferAccess = enabledFeatures.cooperativeMatrixRobustBufferAccess;
}

// convert a set into a vector
core::vector<const char*> extensionStrings(extensionsToEnable.size());
Expand Down
26 changes: 0 additions & 26 deletions src/nbl/video/ILogicalDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -673,8 +673,6 @@ core::smart_refctd_ptr<IGPURenderpass> ILogicalDevice::createRenderpass(const IG
const auto mixedAttachmentSamples = getEnabledFeatures().mixedAttachmentSamples;
const auto supportedDepthResolveModes = getPhysicalDeviceLimits().supportedDepthResolveModes;
const auto supportedStencilResolveModes = getPhysicalDeviceLimits().supportedStencilResolveModes;
const auto independentResolve = getPhysicalDeviceLimits().independentResolve;
const auto independentResolveNone = getPhysicalDeviceLimits().independentResolveNone;
const auto maxColorAttachments = getPhysicalDeviceLimits().maxColorAttachments;
const int32_t maxMultiviewViewCount = getPhysicalDeviceLimits().maxMultiviewViewCount;
for (auto i=0u; i<validation.subpassCount; i++)
Expand Down Expand Up @@ -713,30 +711,6 @@ core::smart_refctd_ptr<IGPURenderpass> ILogicalDevice::createRenderpass(const IG
return nullptr;
}

if (hasDepth && hasStencil)
{
if (!independentResolve && depthResolve!=stencilResolve)
{
if (independentResolveNone)
{
// https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkSubpassDescriptionDepthStencilResolve-pDepthStencilResolveAttachment-03186
// https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkSubpassDescriptionDepthStencilResolve-pNext-06877
if (depthResolve != resolve_flag_t::NONE && stencilResolve != resolve_flag_t::NONE)
{
NBL_LOG_ERROR("Invalid stencil attachment's resolve mode (subpasses[%u])", i);
return nullptr;
}
}
// https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkSubpassDescriptionDepthStencilResolve-pDepthStencilResolveAttachment-03185
// https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkSubpassDescriptionDepthStencilResolve-pNext-06876
else
{
NBL_LOG_ERROR("Invalid stencil attachment's resolve mode (subpasses[%u])", i);
return nullptr;
}
}
}

// https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkSubpassDescriptionDepthStencilResolve-pNext-06873
if (/*multisampledToSingleSampledUsed*/false && depthResolve == resolve_flag_t::NONE && stencilResolve == resolve_flag_t::NONE)
{
Expand Down
Loading