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 <cwallez@chromium.org> Commit-Queue: Austin Eng <enga@chromium.org> Reviewed-by: Austin Eng <enga@chromium.org>
This commit is contained in:
parent
3e9f30411c
commit
610f184fd9
|
@ -194,12 +194,14 @@ namespace dawn_native { namespace metal {
|
||||||
// MTLDevice’s counterSets property declares which counter sets it supports. Check
|
// MTLDevice’s counterSets property declares which counter sets it supports. Check
|
||||||
// whether it's available on the device before requesting a counter set.
|
// whether it's available on the device before requesting a counter set.
|
||||||
id<MTLCounterSet> counterSet = nil;
|
id<MTLCounterSet> counterSet = nil;
|
||||||
|
if (device.counterSets != nil) {
|
||||||
for (id<MTLCounterSet> set in device.counterSets) {
|
for (id<MTLCounterSet> set in device.counterSets) {
|
||||||
if ([set.name caseInsensitiveCompare:counterSetName] == NSOrderedSame) {
|
if ([set.name caseInsensitiveCompare:counterSetName] == NSOrderedSame) {
|
||||||
counterSet = set;
|
counterSet = set;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// The counter set is not supported.
|
// The counter set is not supported.
|
||||||
if (counterSet == nil) {
|
if (counterSet == nil) {
|
||||||
|
|
Loading…
Reference in New Issue