Guard for [MTLDevice counterSets] being null.
Bug: dawn:1102 Change-Id: I1c8fffba65cba0b04ef72018013f027f0a814f90 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/79361 Reviewed-by: Austin Eng <enga@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org> Auto-Submit: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
parent
839d99cd9a
commit
a9a80ef386
|
@ -193,6 +193,12 @@ namespace dawn::native::metal {
|
|||
API_AVAILABLE(macos(10.15), ios(14.0)) {
|
||||
// MTLDevice’s counterSets property declares which counter sets it supports. Check
|
||||
// whether it's available on the device before requesting a counter set.
|
||||
|
||||
// On some systems, [device counterSets] is null and not an empty array.
|
||||
if ([device counterSets] == nil) {
|
||||
return false;
|
||||
}
|
||||
|
||||
id<MTLCounterSet> counterSet = nil;
|
||||
for (id<MTLCounterSet> set in [device counterSets]) {
|
||||
if ([set.name caseInsensitiveCompare:counterSetName] == NSOrderedSame) {
|
||||
|
|
Loading…
Reference in New Issue