diff --git a/guest/bundle/src/RgfxMetalDevice+Unsupported.mm b/guest/bundle/src/RgfxMetalDevice+Unsupported.mm index 3d84c477b..ef03cad4c 100644 --- a/guest/bundle/src/RgfxMetalDevice+Unsupported.mm +++ b/guest/bundle/src/RgfxMetalDevice+Unsupported.mm @@ -134,10 +134,19 @@ constexpr const char *kArgumentLayouts = "argument buffers of a layout object"; return nil; } +// The x86 Macs answer nil and set no error (measured: macOS 26.7.1, the AMD Radeon Pro 5300M and +// the Intel UHD 630, the error out nil before and after), so the x86 device leaves `*error` as it +// is. An M3 makes a set (measured: macOS 27.0.1, the M3 Max, AGXG15XFamilyResidencySet, with no +// error), which the device cannot: the arm64 device answers nil and an error, as a use the device +// does not support. - (id)newResidencySetWithDescriptor:(MTLResidencySetDescriptor *)desc error:(NSError **)error { +#if defined(__arm64__) RGFX_UNSUPPORTED_ERROR(error, "residency sets (none on the wire)"); +#else + RGFX_UNSUPPORTED("residency sets (none on the wire)"); +#endif return nil; } diff --git a/guest/bundle/tests/inherited_tests.mm b/guest/bundle/tests/inherited_tests.mm index 235c42ed0..bfa01ef5b 100644 --- a/guest/bundle/tests/inherited_tests.mm +++ b/guest/bundle/tests/inherited_tests.mm @@ -13,6 +13,9 @@ // or an argument or return value of another size. // A listed selector this macOS's base classes lack is reported, not failed: the guest's macOS can // differ. +// It also checks the x86 device's answer to newResidencySetWithDescriptor:error:: nil, its error +// out left as it was, as the x86 Macs answer (measured: macOS 26.7.1, the AMD Radeon Pro 5300M +// and the Intel UHD 630). #import #include @@ -165,6 +168,26 @@ NSString *signatureDifference(Method ours, Method base) return nil; } +// The device's newResidencySetWithDescriptor:error: answers nil and leaves its error out as it +// was. The member reads none of the device's state, so it is called with the class as `self`, +// with no device made. +void checkResidencySetAnswer(Class device) +{ + SEL sel = sel_registerName("newResidencySetWithDescriptor:error:"); + Method m = class_getInstanceMethod(device, sel); + if (m == nullptr) { + fail(@"the device does not answer newResidencySetWithDescriptor:error:"); + return; + } + NSError *sentinel = [NSError errorWithDomain:@"inherited_tests" code:1 userInfo:nil]; + NSError *error = sentinel; + id set = ((id(*)(id, SEL, id, NSError **))method_getImplementation(m))((id)device, sel, nil, &error); + if (set != nil || error != sentinel) + fail([NSString stringWithFormat:@"newResidencySetWithDescriptor:error: answers %@, error %@ (want nil, " + @"the error out untouched)", + set, error == sentinel ? @"untouched" : error]); +} + } // namespace int main(int argc, char **argv) @@ -185,6 +208,7 @@ int main(int argc, char **argv) printf("FAIL: RgfxMetalDevice is not a subclass of IOGPUMetalDevice, of _MTLDevice\n"); return 1; } + checkResidencySetAnswer(device); NSDictionary *ours = ownMethods(device); NSMutableSet *inBase = [NSMutableSet set]; NSUInteger creators = 0, answered = 0, left = 0;