Intentionally leak MTLDevice.counterSets to workaround a crash
Some drivers over-release this object when is accessed more than once. Bug: chromium:1443658 Change-Id: I861a74e7756dcf16b0a2d25a85bf47815b6779f0 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132262 Commit-Queue: Austin Eng <enga@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
parent
dfaeb429f8
commit
3d511b3b7e
|
@ -467,6 +467,25 @@ class PhysicalDevice : public PhysicalDeviceBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (@available(macOS 10.15, iOS 14.0, *)) {
|
if (@available(macOS 10.15, iOS 14.0, *)) {
|
||||||
|
auto ShouldLeakCounterSets = [this]() {
|
||||||
|
// Intentionally leak counterSets to workaround an issue where the driver
|
||||||
|
// over-releases the handle if it is accessed more than once. It becomes a zombie.
|
||||||
|
// For more information, see crbug.com/1443658.
|
||||||
|
// Appears to occur on Intel prior to MacOS 11, and continuing on Intel Gen 7 after
|
||||||
|
// that OS version.
|
||||||
|
uint32_t vendorId = GetVendorId();
|
||||||
|
uint32_t deviceId = GetDeviceId();
|
||||||
|
if (gpu_info::IsIntelGen7(vendorId, deviceId)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (gpu_info::IsIntel(vendorId) && !IsMacOSVersionAtLeast(11)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
if (ShouldLeakCounterSets()) {
|
||||||
|
[[*mDevice counterSets] retain];
|
||||||
|
}
|
||||||
if (IsGPUCounterSupported(
|
if (IsGPUCounterSupported(
|
||||||
*mDevice, MTLCommonCounterSetStatistic,
|
*mDevice, MTLCommonCounterSetStatistic,
|
||||||
{MTLCommonCounterVertexInvocations, MTLCommonCounterClipperInvocations,
|
{MTLCommonCounterVertexInvocations, MTLCommonCounterClipperInvocations,
|
||||||
|
|
Loading…
Reference in New Issue