From 633d40bd0fbb88b39e0ea76d94c02fd665086c8a Mon Sep 17 00:00:00 2001 From: Austin Eng Date: Tue, 30 Nov 2021 01:07:38 +0000 Subject: [PATCH] Revert "Add a guard for MTLDevice.counterSets being null." This reverts commit 610f184fd932ded1756fb9a117fb692382c8d37d. Reason for revert: Crashes still happen even with this guard. Testing shows that counterSets being null does not cause crashes. Original change's description: > Add a guard for MTLDevice.counterSets being null. > > This is a tentative fix for a segfault that's happening on > metal::Adapter initialization on some systems. > > Bug: dawn:1102 > Change-Id: Iff31e46420e60cd76ecbbfa92bd5b5906ca89cf4 > Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/69340 > Auto-Submit: Corentin Wallez > Commit-Queue: Austin Eng > Reviewed-by: Austin Eng # Not skipping CQ checks because original CL landed > 1 day ago. Bug: dawn:1102 Change-Id: Ia7d7428acee552a107425c774ba15e97bf170e38 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/71241 Reviewed-by: Jiawei Shao Commit-Queue: Austin Eng --- src/dawn_native/metal/BackendMTL.mm | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/dawn_native/metal/BackendMTL.mm b/src/dawn_native/metal/BackendMTL.mm index e931af351d..33bfc9862b 100644 --- a/src/dawn_native/metal/BackendMTL.mm +++ b/src/dawn_native/metal/BackendMTL.mm @@ -194,12 +194,10 @@ namespace dawn_native { namespace metal { // MTLDevice’s counterSets property declares which counter sets it supports. Check // whether it's available on the device before requesting a counter set. id counterSet = nil; - if (device.counterSets != nil) { - for (id set in device.counterSets) { - if ([set.name caseInsensitiveCompare:counterSetName] == NSOrderedSame) { - counterSet = set; - break; - } + for (id set in device.counterSets) { + if ([set.name caseInsensitiveCompare:counterSetName] == NSOrderedSame) { + counterSet = set; + break; } }