Vulkan: Use VK_EXT_primitive_topology_list_restart

From ANGLE's point of view, there is nothing to do with this extension
other than enable a feature that silences a validation error.

Bug: angleproject:3832
Change-Id: I094343d09c322e2848a65a5bc775d0f21388fb46
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3562380
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: mohan maiya <m.maiya@samsung.com>
This commit is contained in:
Shahbaz Youssefi 2022-03-30 23:06:54 -04:00 коммит произвёл Angle LUCI CQ
Родитель 428b6788d7
Коммит e79c9cd630
8 изменённых файлов: 90 добавлений и 22 удалений

Просмотреть файл

@ -349,6 +349,11 @@ struct FeaturesVk : FeatureSetBase
"VkDevice supports VK_EXT_depth_clip_control extension.", &members,
"http://anglebug.com/5421"};
FeatureInfo supportsPrimitiveTopologyListRestart = {
"supportsPrimitiveTopologyListRestart", FeatureCategory::VulkanFeatures,
"VkDevice supports VK_EXT_primitive_topology_list_restart extension.", &members,
"http://anglebug.com/3832"};
FeatureInfo supportsBlendOperationAdvanced = {
"supportsBlendOperationAdvanced", FeatureCategory::VulkanFeatures,
"VkDevice supports VK_EXT_blend_operation_advanced extension.", &members,

Просмотреть файл

@ -457,6 +457,14 @@
],
"issue": "http://anglebug.com/5421"
},
{
"name": "supports_primitive_topology_list_restart",
"category": "Features",
"description": [
"VkDevice supports VK_EXT_primitive_topology_list_restart extension."
],
"issue": "http://anglebug.com/3832"
},
{
"name": "supports_blend_operation_advanced",
"category": "Features",

Просмотреть файл

@ -6,7 +6,7 @@
"include/platform/FeaturesMtl_autogen.h":
"6b6d49c35bc9246361f8dac0a5445a02",
"include/platform/FeaturesVk_autogen.h":
"8f357d2192e39f4f73404bdd630cf5c8",
"395e398a10970b6ed0dfb717df59914c",
"include/platform/FrontendFeatures_autogen.h":
"1781e4fa6efb552bca2ce5a5164eb374",
"include/platform/d3d_features.json":
@ -20,9 +20,9 @@
"include/platform/mtl_features.json":
"1fabfe4d5c2eb3683a5b567ab60ad83c",
"include/platform/vk_features.json":
"3c25030e881f17d694dbb6d090d3b1f7",
"1192cc1026df4af07479928dd7b21099",
"util/angle_features_autogen.cpp":
"f741428c05af3e3f8e7510a27c86a16e",
"d8473c28c13c88200df622a237ad770c",
"util/angle_features_autogen.h":
"4bd7dcfa8430f8ceb4b731adc5ec7ca7"
"2967001238a409ab2049170b98332787"
}

Просмотреть файл

@ -155,8 +155,6 @@ constexpr const char *kSkippedMessages[] = {
"UNASSIGNED-CoreValidation-Shader-InputNotProduced",
// http://anglebug.com/2796
"UNASSIGNED-CoreValidation-Shader-PointSizeMissing",
// http://anglebug.com/3832
"VUID-VkPipelineInputAssemblyStateCreateInfo-topology-00428",
// Best Practices Skips https://issuetracker.google.com/issues/166641492
// https://issuetracker.google.com/issues/166793850
"UNASSIGNED-BestPractices-vkCreateCommandPool-command-buffer-reset",
@ -221,6 +219,13 @@ constexpr const char *kSkippedMessages[] = {
"VUID-VkGraphicsPipelineCreateInfo-pStages-06896",
};
// Validation messages that should be ignored only when VK_EXT_primitive_topology_list_restart is
// not present.
constexpr const char *kNoListRestartSkippedMessages[] = {
// http://anglebug.com/3832
"VUID-VkPipelineInputAssemblyStateCreateInfo-topology-00428",
};
// Some syncval errors are resolved in the presence of the NONE load or store render pass ops. For
// those, ANGLE makes no further attempt to resolve them and expects vendor support for the
// extensions instead. The list of skipped messages is split based on this support.
@ -635,6 +640,21 @@ enum class DebugMessageReport
Print,
};
bool IsMessageInSkipList(const char *message,
const char *const skippedList[],
size_t skippedListSize)
{
for (size_t index = 0; index < skippedListSize; ++index)
{
if (strstr(message, skippedList[index]) != nullptr)
{
return true;
}
}
return false;
}
// Suppress validation errors that are known. Returns DebugMessageReport::Ignore in that case.
DebugMessageReport ShouldReportDebugMessage(RendererVk *renderer,
const char *messageId,
@ -646,12 +666,10 @@ DebugMessageReport ShouldReportDebugMessage(RendererVk *renderer,
}
// Check with non-syncval messages:
for (const char *msg : kSkippedMessages)
const std::vector<const char *> skippedMessages = renderer->getSkippedValidationMessages();
if (IsMessageInSkipList(message, skippedMessages.data(), skippedMessages.size()))
{
if (strstr(message, msg) != nullptr)
{
return DebugMessageReport::Ignore;
}
return DebugMessageReport::Ignore;
}
// Then check with syncval messages:
@ -1955,6 +1973,10 @@ void RendererVk::queryDeviceExtensionFeatures(const vk::ExtensionNameList &devic
mPrimitivesGeneratedQueryFeatures.sType =
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRIMITIVES_GENERATED_QUERY_FEATURES_EXT;
mPrimitiveTopologyListRestartFeatures = {};
mPrimitiveTopologyListRestartFeatures.sType =
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRIMITIVE_TOPOLOGY_LIST_RESTART_FEATURES_EXT;
mBlendOperationAdvancedFeatures = {};
mBlendOperationAdvancedFeatures.sType =
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BLEND_OPERATION_ADVANCED_FEATURES_EXT;
@ -2120,6 +2142,11 @@ void RendererVk::queryDeviceExtensionFeatures(const vk::ExtensionNameList &devic
vk::AddToPNextChain(&deviceFeatures, &mPrimitivesGeneratedQueryFeatures);
}
if (ExtensionFound(VK_EXT_PRIMITIVE_TOPOLOGY_LIST_RESTART_EXTENSION_NAME, deviceExtensionNames))
{
vk::AddToPNextChain(&deviceFeatures, &mPrimitiveTopologyListRestartFeatures);
}
if (ExtensionFound(VK_EXT_BLEND_OPERATION_ADVANCED_EXTENSION_NAME, deviceExtensionNames))
{
vk::AddToPNextChain(&deviceFeatures, &mBlendOperationAdvancedFeatures);
@ -2183,6 +2210,7 @@ void RendererVk::queryDeviceExtensionFeatures(const vk::ExtensionNameList &devic
mHostQueryResetFeatures.pNext = nullptr;
mDepthClipControlFeatures.pNext = nullptr;
mPrimitivesGeneratedQueryFeatures.pNext = nullptr;
mPrimitiveTopologyListRestartFeatures.pNext = nullptr;
mBlendOperationAdvancedFeatures.pNext = nullptr;
mPipelineCreationCacheControlFeatures.pNext = nullptr;
mExtendedDynamicStateFeatures.pNext = nullptr;
@ -2653,6 +2681,12 @@ angle::Result RendererVk::initializeDevice(DisplayVk *displayVk, uint32_t queueF
vk::AddToPNextChain(&mEnabledFeatures, &mPrimitivesGeneratedQueryFeatures);
}
if (getFeatures().supportsPrimitiveTopologyListRestart.enabled)
{
mEnabledDeviceExtensions.push_back(VK_EXT_PRIMITIVE_TOPOLOGY_LIST_RESTART_EXTENSION_NAME);
vk::AddToPNextChain(&mEnabledFeatures, &mPrimitiveTopologyListRestartFeatures);
}
if (getFeatures().supportsBlendOperationAdvanced.enabled)
{
mEnabledDeviceExtensions.push_back(VK_EXT_BLEND_OPERATION_ADVANCED_EXTENSION_NAME);
@ -2834,6 +2868,23 @@ angle::Result RendererVk::initializeDevice(DisplayVk *displayVk, uint32_t queueF
}
mSupportedVulkanPipelineStageMask = ~unsupportedStages;
initializeValidationMessageSuppressions();
return angle::Result::Continue;
}
void RendererVk::initializeValidationMessageSuppressions()
{
// Build the list of validation errors that are currently expected and should be skipped.
mSkippedValidationMessages.insert(mSkippedValidationMessages.end(), kSkippedMessages,
kSkippedMessages + ArraySize(kSkippedMessages));
if (!getFeatures().supportsPrimitiveTopologyListRestart.enabled)
{
mSkippedValidationMessages.insert(
mSkippedValidationMessages.end(), kNoListRestartSkippedMessages,
kNoListRestartSkippedMessages + ArraySize(kNoListRestartSkippedMessages));
}
// Build the list of syncval errors that are currently expected and should be skipped.
mSkippedSyncvalMessages.insert(mSkippedSyncvalMessages.end(), kSkippedSyncvalMessages,
kSkippedSyncvalMessages + ArraySize(kSkippedSyncvalMessages));
@ -2852,8 +2903,6 @@ angle::Result RendererVk::initializeDevice(DisplayVk *displayVk, uint32_t queueF
kSkippedSyncvalMessagesWithoutLoadStoreOpNone +
ArraySize(kSkippedSyncvalMessagesWithoutLoadStoreOpNone));
}
return angle::Result::Continue;
}
angle::Result RendererVk::selectPresentQueueForSurface(DisplayVk *displayVk,
@ -3395,6 +3444,10 @@ void RendererVk::initFeatures(DisplayVk *displayVk,
// VK_TRUE);
ANGLE_FEATURE_CONDITION(&mFeatures, supportsPrimitivesGeneratedQuery, false);
ANGLE_FEATURE_CONDITION(
&mFeatures, supportsPrimitiveTopologyListRestart,
mPrimitiveTopologyListRestartFeatures.primitiveTopologyListRestart == VK_TRUE);
ANGLE_FEATURE_CONDITION(
&mFeatures, supportsBlendOperationAdvanced,
ExtensionFound(VK_EXT_BLEND_OPERATION_ADVANCED_EXTENSION_NAME, deviceExtensionNames));

Просмотреть файл

@ -371,6 +371,10 @@ class RendererVk : angle::NonCopyable
void onNewValidationMessage(const std::string &message);
std::string getAndClearLastValidationMessage(uint32_t *countSinceLastClear);
const std::vector<const char *> &getSkippedValidationMessages() const
{
return mSkippedValidationMessages;
}
const std::vector<vk::SkippedSyncvalMessage> &getSkippedSyncvalMessages() const
{
return mSkippedSyncvalMessages;
@ -620,6 +624,7 @@ class RendererVk : angle::NonCopyable
private:
angle::Result initializeDevice(DisplayVk *displayVk, uint32_t queueFamilyIndex);
void ensureCapsInitialized() const;
void initializeValidationMessageSuppressions();
void queryDeviceExtensionFeatures(const vk::ExtensionNameList &deviceExtensionNames);
@ -702,6 +707,7 @@ class RendererVk : angle::NonCopyable
VkPhysicalDeviceHostQueryResetFeaturesEXT mHostQueryResetFeatures;
VkPhysicalDeviceDepthClipControlFeaturesEXT mDepthClipControlFeatures;
VkPhysicalDevicePrimitivesGeneratedQueryFeaturesEXT mPrimitivesGeneratedQueryFeatures;
VkPhysicalDevicePrimitiveTopologyListRestartFeaturesEXT mPrimitiveTopologyListRestartFeatures;
VkPhysicalDeviceBlendOperationAdvancedFeaturesEXT mBlendOperationAdvancedFeatures;
VkPhysicalDeviceSamplerYcbcrConversionFeatures mSamplerYcbcrConversionFeatures;
VkPhysicalDevicePipelineCreationCacheControlFeaturesEXT mPipelineCreationCacheControlFeatures;
@ -778,6 +784,9 @@ class RendererVk : angle::NonCopyable
std::string mLastValidationMessage;
uint32_t mValidationMessageCount;
// Skipped validation messages. The exact contents of the list depends on the availability of
// certain extensions.
std::vector<const char *> mSkippedValidationMessages;
// Syncval skipped messages. The exact contents of the list depends on the availability of
// certain extensions.
std::vector<vk::SkippedSyncvalMessage> mSkippedSyncvalMessages;

Просмотреть файл

@ -2913,15 +2913,6 @@ angle::Result GraphicsPipelineDesc::initializePipeline(
inputAssemblyState.sType = VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO;
inputAssemblyState.flags = 0;
inputAssemblyState.topology = static_cast<VkPrimitiveTopology>(inputAndRaster.misc.topology);
// http://anglebug.com/3832
// We currently hit a VK Validation here where VUID
// VUID-VkPipelineInputAssemblyStateCreateInfo-topology-00428 is flagged because we allow
// primitiveRestartEnable to be true for topologies VK_PRIMITIVE_TOPOLOGY_POINT_LIST,
// VK_PRIMITIVE_TOPOLOGY_LINE_LIST, VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST
// VK_PRIMITIVE_TOPOLOGY_LINE_LIST_WITH_ADJACENCY,
// VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY and VK_PRIMITIVE_TOPOLOGY_PATCH_LIST
// However if we force primiteRestartEnable to FALSE we fail tests.
// Need to identify alternate fix.
inputAssemblyState.primitiveRestartEnable =
static_cast<VkBool32>(mDynamicState.ds1And2.primitiveRestartEnable);

Просмотреть файл

@ -258,6 +258,7 @@ constexpr PackedEnumMap<Feature, const char *> kFeatureNames = {{
{Feature::SupportsPipelineCreationFeedback, "supportsPipelineCreationFeedback"},
{Feature::SupportsPipelineStatisticsQuery, "supportsPipelineStatisticsQuery"},
{Feature::SupportsPrimitivesGeneratedQuery, "supportsPrimitivesGeneratedQuery"},
{Feature::SupportsPrimitiveTopologyListRestart, "supportsPrimitiveTopologyListRestart"},
{Feature::SupportsProtectedMemory, "supportsProtectedMemory"},
{Feature::SupportsRenderpass2, "supportsRenderpass2"},
{Feature::SupportsRenderPassLoadStoreOpNone, "supportsRenderPassLoadStoreOpNone"},

Просмотреть файл

@ -244,6 +244,7 @@ enum class Feature
SupportsPipelineCreationFeedback,
SupportsPipelineStatisticsQuery,
SupportsPrimitivesGeneratedQuery,
SupportsPrimitiveTopologyListRestart,
SupportsProtectedMemory,
SupportsRenderpass2,
SupportsRenderPassLoadStoreOpNone,