radv: implement 1.3 features/properties

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14707>
This commit is contained in:
Samuel Pitoiset 2021-10-04 16:34:28 +02:00 committed by Marge Bot
parent cc8eb6f5df
commit 2d12041967

View file

@ -1286,6 +1286,29 @@ radv_get_physical_device_features_1_2(struct radv_physical_device *pdevice,
f->subgroupBroadcastDynamicId = true;
}
static void
radv_get_physical_device_features_1_3(struct radv_physical_device *pdevice,
VkPhysicalDeviceVulkan13Features *f)
{
assert(f->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_FEATURES);
f->robustImageAccess = true;
f->inlineUniformBlock = true;
f->descriptorBindingInlineUniformBlockUpdateAfterBind = true;
f->pipelineCreationCacheControl = true;
f->privateData = true;
f->shaderDemoteToHelperInvocation = true;
f->shaderTerminateInvocation = true;
f->subgroupSizeControl = true;
f->computeFullSubgroups = true;
f->synchronization2 = true;
f->textureCompressionASTC_HDR = false;
f->shaderZeroInitializeWorkgroupMemory = true;
f->dynamicRendering = true;
f->shaderIntegerDotProduct = true;
f->maintenance4 = true;
}
VKAPI_ATTR void VKAPI_CALL
radv_GetPhysicalDeviceFeatures2(VkPhysicalDevice physicalDevice,
VkPhysicalDeviceFeatures2 *pFeatures)
@ -1303,6 +1326,11 @@ radv_GetPhysicalDeviceFeatures2(VkPhysicalDevice physicalDevice,
};
radv_get_physical_device_features_1_2(pdevice, &core_1_2);
VkPhysicalDeviceVulkan13Features core_1_3 = {
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_FEATURES,
};
radv_get_physical_device_features_1_3(pdevice, &core_1_3);
#define CORE_FEATURE(major, minor, feature) features->feature = core_##major##_##minor.feature
vk_foreach_struct(ext, pFeatures->pNext)
@ -1311,6 +1339,8 @@ radv_GetPhysicalDeviceFeatures2(VkPhysicalDevice physicalDevice,
continue;
if (vk_get_physical_device_core_1_2_feature_ext(ext, &core_1_2))
continue;
if (vk_get_physical_device_core_1_3_feature_ext(ext, &core_1_3))
continue;
switch (ext->sType) {
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CONDITIONAL_RENDERING_FEATURES_EXT: {
@ -1360,20 +1390,6 @@ radv_GetPhysicalDeviceFeatures2(VkPhysicalDevice physicalDevice,
features->depthClipEnable = true;
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DEMOTE_TO_HELPER_INVOCATION_FEATURES_EXT: {
VkPhysicalDeviceShaderDemoteToHelperInvocationFeaturesEXT *features =
(VkPhysicalDeviceShaderDemoteToHelperInvocationFeaturesEXT *)ext;
features->shaderDemoteToHelperInvocation = true;
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INLINE_UNIFORM_BLOCK_FEATURES_EXT: {
VkPhysicalDeviceInlineUniformBlockFeaturesEXT *features =
(VkPhysicalDeviceInlineUniformBlockFeaturesEXT *)ext;
features->inlineUniformBlock = true;
features->descriptorBindingInlineUniformBlockUpdateAfterBind = true;
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COMPUTE_SHADER_DERIVATIVES_FEATURES_NV: {
VkPhysicalDeviceComputeShaderDerivativesFeaturesNV *features =
(VkPhysicalDeviceComputeShaderDerivativesFeaturesNV *)ext;
@ -1412,13 +1428,6 @@ radv_GetPhysicalDeviceFeatures2(VkPhysicalDevice physicalDevice,
features->texelBufferAlignment = true;
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_SIZE_CONTROL_FEATURES_EXT: {
VkPhysicalDeviceSubgroupSizeControlFeaturesEXT *features =
(VkPhysicalDeviceSubgroupSizeControlFeaturesEXT *)ext;
features->subgroupSizeControl = true;
features->computeFullSubgroups = true;
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COHERENT_MEMORY_FEATURES_AMD: {
VkPhysicalDeviceCoherentMemoryFeaturesAMD *features =
(VkPhysicalDeviceCoherentMemoryFeaturesAMD *)ext;
@ -1460,30 +1469,12 @@ radv_GetPhysicalDeviceFeatures2(VkPhysicalDevice physicalDevice,
features->customBorderColorWithoutFormat = true;
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRIVATE_DATA_FEATURES_EXT: {
VkPhysicalDevicePrivateDataFeaturesEXT *features =
(VkPhysicalDevicePrivateDataFeaturesEXT *)ext;
features->privateData = true;
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_CREATION_CACHE_CONTROL_FEATURES_EXT: {
VkPhysicalDevicePipelineCreationCacheControlFeaturesEXT *features =
(VkPhysicalDevicePipelineCreationCacheControlFeaturesEXT *)ext;
features->pipelineCreationCacheControl = true;
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_FEATURES_EXT: {
VkPhysicalDeviceExtendedDynamicStateFeaturesEXT *features =
(VkPhysicalDeviceExtendedDynamicStateFeaturesEXT *)ext;
features->extendedDynamicState = true;
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_ROBUSTNESS_FEATURES_EXT: {
VkPhysicalDeviceImageRobustnessFeaturesEXT *features =
(VkPhysicalDeviceImageRobustnessFeaturesEXT *)ext;
features->robustImageAccess = true;
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_FLOAT_FEATURES_EXT: {
VkPhysicalDeviceShaderAtomicFloatFeaturesEXT *features =
(VkPhysicalDeviceShaderAtomicFloatFeaturesEXT *)ext;
@ -1508,12 +1499,6 @@ radv_GetPhysicalDeviceFeatures2(VkPhysicalDevice physicalDevice,
features->formatA4B4G4R4 = true;
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_TERMINATE_INVOCATION_FEATURES_KHR: {
VkPhysicalDeviceShaderTerminateInvocationFeaturesKHR *features =
(VkPhysicalDeviceShaderTerminateInvocationFeaturesKHR *)ext;
features->shaderTerminateInvocation = true;
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_IMAGE_ATOMIC_INT64_FEATURES_EXT: {
VkPhysicalDeviceShaderImageAtomicInt64FeaturesEXT *features =
(VkPhysicalDeviceShaderImageAtomicInt64FeaturesEXT *)ext;
@ -1544,12 +1529,6 @@ radv_GetPhysicalDeviceFeatures2(VkPhysicalDevice physicalDevice,
features->workgroupMemoryExplicitLayout16BitAccess = true;
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ZERO_INITIALIZE_WORKGROUP_MEMORY_FEATURES_KHR: {
VkPhysicalDeviceZeroInitializeWorkgroupMemoryFeaturesKHR *features =
(VkPhysicalDeviceZeroInitializeWorkgroupMemoryFeaturesKHR *)ext;
features->shaderZeroInitializeWorkgroupMemory = true;
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROVOKING_VERTEX_FEATURES_EXT: {
VkPhysicalDeviceProvokingVertexFeaturesEXT *features =
(VkPhysicalDeviceProvokingVertexFeaturesEXT *)ext;
@ -1628,12 +1607,6 @@ radv_GetPhysicalDeviceFeatures2(VkPhysicalDevice physicalDevice,
features->primitiveTopologyPatchListRestart = false;
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_INTEGER_DOT_PRODUCT_FEATURES_KHR: {
VkPhysicalDeviceShaderIntegerDotProductFeaturesKHR *features =
(VkPhysicalDeviceShaderIntegerDotProductFeaturesKHR *)ext;
features->shaderIntegerDotProduct = true;
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_PIPELINE_FEATURES_KHR: {
VkPhysicalDeviceRayTracingPipelineFeaturesKHR *features =
(VkPhysicalDeviceRayTracingPipelineFeaturesKHR *)ext;
@ -2012,6 +1985,69 @@ radv_get_physical_device_properties_1_2(struct radv_physical_device *pdevice,
p->framebufferIntegerColorSampleCounts = VK_SAMPLE_COUNT_1_BIT;
}
static void
radv_get_physical_device_properties_1_3(struct radv_physical_device *pdevice,
VkPhysicalDeviceVulkan13Properties *p)
{
assert(p->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_PROPERTIES);
p->minSubgroupSize = 64;
p->maxSubgroupSize = 64;
p->maxComputeWorkgroupSubgroups = UINT32_MAX;
p->requiredSubgroupSizeStages = 0;
if (pdevice->rad_info.chip_class >= GFX10) {
/* Only GFX10+ supports wave32. */
p->minSubgroupSize = 32;
p->requiredSubgroupSizeStages = VK_SHADER_STAGE_COMPUTE_BIT;
}
p->maxInlineUniformBlockSize = MAX_INLINE_UNIFORM_BLOCK_SIZE;
p->maxPerStageDescriptorInlineUniformBlocks = MAX_INLINE_UNIFORM_BLOCK_SIZE * MAX_SETS;
p->maxPerStageDescriptorUpdateAfterBindInlineUniformBlocks = MAX_INLINE_UNIFORM_BLOCK_SIZE * MAX_SETS;
p->maxDescriptorSetInlineUniformBlocks = MAX_INLINE_UNIFORM_BLOCK_COUNT;
p->maxDescriptorSetUpdateAfterBindInlineUniformBlocks = MAX_INLINE_UNIFORM_BLOCK_COUNT;
p->maxInlineUniformTotalSize = UINT16_MAX;
bool accel = pdevice->rad_info.has_accelerated_dot_product;
p->integerDotProduct8BitUnsignedAccelerated = accel;
p->integerDotProduct8BitSignedAccelerated = accel;
p->integerDotProduct8BitMixedSignednessAccelerated = false;
p->integerDotProduct4x8BitPackedUnsignedAccelerated = accel;
p->integerDotProduct4x8BitPackedSignedAccelerated = accel;
p->integerDotProduct4x8BitPackedMixedSignednessAccelerated = false;
p->integerDotProduct16BitUnsignedAccelerated = accel;
p->integerDotProduct16BitSignedAccelerated = accel;
p->integerDotProduct16BitMixedSignednessAccelerated = false;
p->integerDotProduct32BitUnsignedAccelerated = false;
p->integerDotProduct32BitSignedAccelerated = false;
p->integerDotProduct32BitMixedSignednessAccelerated = false;
p->integerDotProduct64BitUnsignedAccelerated = false;
p->integerDotProduct64BitSignedAccelerated = false;
p->integerDotProduct64BitMixedSignednessAccelerated = false;
p->integerDotProductAccumulatingSaturating8BitUnsignedAccelerated = accel;
p->integerDotProductAccumulatingSaturating8BitSignedAccelerated = accel;
p->integerDotProductAccumulatingSaturating8BitMixedSignednessAccelerated = false;
p->integerDotProductAccumulatingSaturating4x8BitPackedUnsignedAccelerated = accel;
p->integerDotProductAccumulatingSaturating4x8BitPackedSignedAccelerated = accel;
p->integerDotProductAccumulatingSaturating4x8BitPackedMixedSignednessAccelerated = false;
p->integerDotProductAccumulatingSaturating16BitUnsignedAccelerated = accel;
p->integerDotProductAccumulatingSaturating16BitSignedAccelerated = accel;
p->integerDotProductAccumulatingSaturating16BitMixedSignednessAccelerated = false;
p->integerDotProductAccumulatingSaturating32BitUnsignedAccelerated = false;
p->integerDotProductAccumulatingSaturating32BitSignedAccelerated = false;
p->integerDotProductAccumulatingSaturating32BitMixedSignednessAccelerated = false;
p->integerDotProductAccumulatingSaturating64BitUnsignedAccelerated = false;
p->integerDotProductAccumulatingSaturating64BitSignedAccelerated = false;
p->integerDotProductAccumulatingSaturating64BitMixedSignednessAccelerated = false;
p->storageTexelBufferOffsetAlignmentBytes = 4;
p->storageTexelBufferOffsetSingleTexelAlignment = true;
p->uniformTexelBufferOffsetAlignmentBytes = 4;
p->uniformTexelBufferOffsetSingleTexelAlignment = true;
p->maxBufferSize = RADV_MAX_MEMORY_ALLOCATION_SIZE;
}
VKAPI_ATTR void VKAPI_CALL
radv_GetPhysicalDeviceProperties2(VkPhysicalDevice physicalDevice,
VkPhysicalDeviceProperties2 *pProperties)
@ -2029,12 +2065,19 @@ radv_GetPhysicalDeviceProperties2(VkPhysicalDevice physicalDevice,
};
radv_get_physical_device_properties_1_2(pdevice, &core_1_2);
VkPhysicalDeviceVulkan13Properties core_1_3 = {
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_PROPERTIES,
};
radv_get_physical_device_properties_1_3(pdevice, &core_1_3);
vk_foreach_struct(ext, pProperties->pNext)
{
if (vk_get_physical_device_core_1_1_property_ext(ext, &core_1_1))
continue;
if (vk_get_physical_device_core_1_2_property_ext(ext, &core_1_2))
continue;
if (vk_get_physical_device_core_1_3_property_ext(ext, &core_1_3))
continue;
switch (ext->sType) {
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PUSH_DESCRIPTOR_PROPERTIES_KHR: {
@ -2134,18 +2177,6 @@ radv_GetPhysicalDeviceProperties2(VkPhysicalDevice physicalDevice,
properties->transformFeedbackDraw = true;
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INLINE_UNIFORM_BLOCK_PROPERTIES_EXT: {
VkPhysicalDeviceInlineUniformBlockPropertiesEXT *props =
(VkPhysicalDeviceInlineUniformBlockPropertiesEXT *)ext;
props->maxInlineUniformBlockSize = MAX_INLINE_UNIFORM_BLOCK_SIZE;
props->maxPerStageDescriptorInlineUniformBlocks = MAX_INLINE_UNIFORM_BLOCK_SIZE * MAX_SETS;
props->maxPerStageDescriptorUpdateAfterBindInlineUniformBlocks =
MAX_INLINE_UNIFORM_BLOCK_SIZE * MAX_SETS;
props->maxDescriptorSetInlineUniformBlocks = MAX_INLINE_UNIFORM_BLOCK_COUNT;
props->maxDescriptorSetUpdateAfterBindInlineUniformBlocks = MAX_INLINE_UNIFORM_BLOCK_COUNT;
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLE_LOCATIONS_PROPERTIES_EXT: {
VkPhysicalDeviceSampleLocationsPropertiesEXT *properties =
(VkPhysicalDeviceSampleLocationsPropertiesEXT *)ext;
@ -2158,30 +2189,6 @@ radv_GetPhysicalDeviceProperties2(VkPhysicalDevice physicalDevice,
properties->variableSampleLocations = false;
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TEXEL_BUFFER_ALIGNMENT_PROPERTIES_EXT: {
VkPhysicalDeviceTexelBufferAlignmentPropertiesEXT *properties =
(VkPhysicalDeviceTexelBufferAlignmentPropertiesEXT *)ext;
properties->storageTexelBufferOffsetAlignmentBytes = 4;
properties->storageTexelBufferOffsetSingleTexelAlignment = true;
properties->uniformTexelBufferOffsetAlignmentBytes = 4;
properties->uniformTexelBufferOffsetSingleTexelAlignment = true;
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_SIZE_CONTROL_PROPERTIES_EXT: {
VkPhysicalDeviceSubgroupSizeControlPropertiesEXT *props =
(VkPhysicalDeviceSubgroupSizeControlPropertiesEXT *)ext;
props->minSubgroupSize = 64;
props->maxSubgroupSize = 64;
props->maxComputeWorkgroupSubgroups = UINT32_MAX;
props->requiredSubgroupSizeStages = 0;
if (pdevice->rad_info.chip_class >= GFX10) {
/* Only GFX10+ supports wave32. */
props->minSubgroupSize = 32;
props->requiredSubgroupSizeStages = VK_SHADER_STAGE_COMPUTE_BIT;
}
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LINE_RASTERIZATION_PROPERTIES_EXT: {
VkPhysicalDeviceLineRasterizationPropertiesEXT *props =
(VkPhysicalDeviceLineRasterizationPropertiesEXT *)ext;
@ -2272,45 +2279,6 @@ radv_GetPhysicalDeviceProperties2(VkPhysicalDevice physicalDevice,
props->maxMultiDrawCount = 2048;
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_INTEGER_DOT_PRODUCT_PROPERTIES_KHR: {
VkPhysicalDeviceShaderIntegerDotProductPropertiesKHR *props =
(VkPhysicalDeviceShaderIntegerDotProductPropertiesKHR *)ext;
bool accel = pdevice->rad_info.has_accelerated_dot_product;
props->integerDotProduct8BitUnsignedAccelerated = accel;
props->integerDotProduct8BitSignedAccelerated = accel;
props->integerDotProduct8BitMixedSignednessAccelerated = false;
props->integerDotProduct4x8BitPackedUnsignedAccelerated = accel;
props->integerDotProduct4x8BitPackedSignedAccelerated = accel;
props->integerDotProduct4x8BitPackedMixedSignednessAccelerated = false;
props->integerDotProduct16BitUnsignedAccelerated = accel;
props->integerDotProduct16BitSignedAccelerated = accel;
props->integerDotProduct16BitMixedSignednessAccelerated = false;
props->integerDotProduct32BitUnsignedAccelerated = false;
props->integerDotProduct32BitSignedAccelerated = false;
props->integerDotProduct32BitMixedSignednessAccelerated = false;
props->integerDotProduct64BitUnsignedAccelerated = false;
props->integerDotProduct64BitSignedAccelerated = false;
props->integerDotProduct64BitMixedSignednessAccelerated = false;
props->integerDotProductAccumulatingSaturating8BitUnsignedAccelerated = accel;
props->integerDotProductAccumulatingSaturating8BitSignedAccelerated = accel;
props->integerDotProductAccumulatingSaturating8BitMixedSignednessAccelerated = false;
props->integerDotProductAccumulatingSaturating4x8BitPackedUnsignedAccelerated = accel;
props->integerDotProductAccumulatingSaturating4x8BitPackedSignedAccelerated = accel;
props->integerDotProductAccumulatingSaturating4x8BitPackedMixedSignednessAccelerated =
false;
props->integerDotProductAccumulatingSaturating16BitUnsignedAccelerated = accel;
props->integerDotProductAccumulatingSaturating16BitSignedAccelerated = accel;
props->integerDotProductAccumulatingSaturating16BitMixedSignednessAccelerated = false;
props->integerDotProductAccumulatingSaturating32BitUnsignedAccelerated = false;
props->integerDotProductAccumulatingSaturating32BitSignedAccelerated = false;
props->integerDotProductAccumulatingSaturating32BitMixedSignednessAccelerated = false;
props->integerDotProductAccumulatingSaturating64BitUnsignedAccelerated = false;
props->integerDotProductAccumulatingSaturating64BitSignedAccelerated = false;
props->integerDotProductAccumulatingSaturating64BitMixedSignednessAccelerated = false;
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_PIPELINE_PROPERTIES_KHR: {
VkPhysicalDeviceRayTracingPipelinePropertiesKHR *props =
(VkPhysicalDeviceRayTracingPipelinePropertiesKHR *)ext;