Add workaround for zombie memory bug in Intel Iris Plus Graphics

driver when repeatedly retrieving GPU counter sets.
This commit is contained in:
Bill Hollings 2022-05-12 11:40:02 -04:00
parent 711231ddf6
commit 695a54037b
2 changed files with 9 additions and 0 deletions

View File

@ -30,6 +30,7 @@ Released TBD
used by a subsequent pipeline that does not use push constants.
- Fix error on some Apple GPU's where a `vkCmdTimestampQuery()` after a renderpass was
writing timestamp before renderpass activity was complete.
- Work around zombie memory bug in Intel Iris Plus Graphics driver when repeatedly retrieving GPU counter sets.
- Update to latest SPIRV-Cross:
- MSL: Emit interface block members of array length 1 as arrays instead of scalars.

View File

@ -2812,6 +2812,14 @@ void MVKPhysicalDevice::initCounterSets() {
@autoreleasepool {
if (_metalFeatures.counterSamplingPoints) {
NSArray<id<MTLCounterSet>>* counterSets = _mtlDevice.counterSets;
// Workaround for a bug in Intel Iris Plus Graphics driver where the counterSets
// array is not properly retained internally, and becomes a zombie when counterSets
// is called more than once, which occurs when an app creates more than one VkInstance.
// This workaround will cause a very small memory leak on systems that do not have this
// bug, so we apply the workaround only when absolutely needed for specific devices.
if (_properties.vendorID == kIntelVendorId && _properties.deviceID == 0x8a53) { [counterSets retain]; }
for (id<MTLCounterSet> cs in counterSets){
NSString* csName = cs.name;
if ( [csName caseInsensitiveCompare: MTLCommonCounterSetTimestamp] == NSOrderedSame) {