Metal: Preemptively Start Provoking Vertex CmdBuffer on AMD

There seems to be a bug in older AMD drivers and this appears
to work around it

Bug: angleproject:7635
Change-Id: I1b22e4b7d5d1ce0d405e422d08d33eeeb731050a
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3877666
Reviewed-by: Kenneth Russell <kbr@chromium.org>
Commit-Queue: Kenneth Russell <kbr@chromium.org>
This commit is contained in:
Gregg Tavares 2022-09-06 14:12:26 -07:00 коммит произвёл Angle LUCI CQ
Родитель ff46a03a89
Коммит 662226a324
7 изменённых файлов: 29 добавлений и 6 удалений

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

@ -222,6 +222,11 @@ struct FeaturesMtl : FeatureSetBase
"limitMaxColorTargetBitsForTesting", FeatureCategory::MetalFeatures,
"Metal iOS has a limit on the number of color target bits per pixel.", &members,
"http://anglebug.com/7280"};
FeatureInfo preemptivelyStartProvokingVertexCommandBuffer = {
"preemptivelyStartProvokingVertexCommandBuffer", FeatureCategory::MetalFeatures,
"AMD Metal Drivers appear to have a bug this works around", &members,
"http://anglebug.com/7635"};
};
inline FeaturesMtl::FeaturesMtl() = default;

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

@ -227,6 +227,13 @@
"Metal iOS has a limit on the number of color target bits per pixel."
],
"issue": "http://anglebug.com/7280"
}
]
},
{
"name": "preemptively_start_provoking_vertex_command_buffer",
"category": "Features",
"description": [
"AMD Metal Drivers appear to have a bug this works around"
],
"issue": "http://anglebug.com/7635"
} ]
}

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

@ -4,7 +4,7 @@
"include/platform/FeaturesGL_autogen.h":
"b559f25f72ed9e103c39ef7e130ca58c",
"include/platform/FeaturesMtl_autogen.h":
"6b6d49c35bc9246361f8dac0a5445a02",
"2eae56120878fb633700e1cdf56557dd",
"include/platform/FeaturesVk_autogen.h":
"c0daa0104f737a5670a00e1183f4e300",
"include/platform/FrontendFeatures_autogen.h":
@ -18,11 +18,11 @@
"include/platform/gl_features.json":
"3fb9baa3748a8dd383cf189f1bc12d30",
"include/platform/mtl_features.json":
"1fabfe4d5c2eb3683a5b567ab60ad83c",
"383be09e93f3d28c79a9f36c186ae2d7",
"include/platform/vk_features.json":
"fca1269d2ae63781842f78ef1eaeefea",
"util/angle_features_autogen.cpp":
"a83882020a07f73c06b376a07e0c44a7",
"c18ecaee137793f043e35996256ad8e6",
"util/angle_features_autogen.h":
"cb4638d9b5fdddf67659d305f6d387bd"
"748e62a5172bb4d469e1a4dd7d1909fc"
}

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

@ -1881,6 +1881,12 @@ mtl::ComputeCommandEncoder *ContextMtl::getIndexPreprocessingCommandEncoder()
void ContextMtl::ensureCommandBufferReady()
{
flushCommandBufferIfNeeded();
if (getDisplay()->getFeatures().preemptivelyStartProvokingVertexCommandBuffer.enabled)
{
mProvokingVertexHelper.ensureCommandBufferReady();
}
if (!mCmdBuffer.ready())
{
mCmdBuffer.restart();

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

@ -1141,6 +1141,8 @@ void DisplayMtl::initializeFeatures()
ANGLE_FEATURE_CONDITION((&mFeatures), forceNonCSBaseMipmapGeneration, isIntel());
ANGLE_FEATURE_CONDITION((&mFeatures), preemptivelyStartProvokingVertexCommandBuffer, isAMD());
bool defaultDirectToMetal = true;
ANGLE_FEATURE_CONDITION((&mFeatures), directMetalGeneration, defaultDirectToMetal);

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

@ -182,6 +182,8 @@ constexpr PackedEnumMap<Feature, const char *> kFeatureNames = {{
{Feature::PersistentlyMappedBuffers, "persistentlyMappedBuffers"},
{Feature::PreAddTexelFetchOffsets, "preAddTexelFetchOffsets"},
{Feature::PrecisionSafeDivision, "precisionSafeDivision"},
{Feature::PreemptivelyStartProvokingVertexCommandBuffer,
"preemptivelyStartProvokingVertexCommandBuffer"},
{Feature::PreferAggregateBarrierCalls, "preferAggregateBarrierCalls"},
{Feature::PreferCPUForBufferSubData, "preferCPUForBufferSubData"},
{Feature::PreferDeviceLocalMemoryHostVisible, "preferDeviceLocalMemoryHostVisible"},

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

@ -173,6 +173,7 @@ enum class Feature
PersistentlyMappedBuffers,
PreAddTexelFetchOffsets,
PrecisionSafeDivision,
PreemptivelyStartProvokingVertexCommandBuffer,
PreferAggregateBarrierCalls,
PreferCPUForBufferSubData,
PreferDeviceLocalMemoryHostVisible,