cantCreateSession("Native session create failed: CPGReturn(rawValue: -21)

Hi,

I'm getting this error code "-21" ... anyone know what it means?

cantCreateSession("Native session create failed: CPGReturn(rawValue: -21)

2021-07-17 14:01:29.621817+0200 HelloPhotogrammetry[2578:40148] [HelloPhotogrammetry] Using configuration: Configuration(isObjectMaskingEnabled: true, sampleOrdering: RealityFoundation.PhotogrammetrySession.Configuration.SampleOrdering.unordered, featureSensitivity: RealityFoundation.PhotogrammetrySession.Configuration.FeatureSensitivity.normal)

2021-07-17 14:01:29.669711+0200 HelloPhotogrammetry[2578:40148] Metal API Validation Enabled

2021-07-17 14:01:29.709715+0200 HelloPhotogrammetry[2578:40148] [HelloPhotogrammetry] Error creating session: cantCreateSession("Native session create failed: CPGReturn(rawValue: -21)")

Program ended with exit code: 1
Answered by Graphics and Games Engineer in 682244022

/// A GPU that is not low power is required.

/// https://developer.apple.com/documentation/metal/mtldevice/1433409-lowpower

kCPGReturnHardwareGPULowPower = -24,

/// A GPU with at least 4GB VRAM is required.

kCPGReturnHardwareGPUNotEnoughVRam = -21,

I'm getting a similar error but a different raw value: Error creating session: cantCreateSession("Native session create failed: CPGReturn(rawValue: -24)")

yeah, I was wondering about that too ... what other Error codes might we encounter .... and why there isn't an Error list (in the SDK) we can look at when we encounter them?

Why haven't you (Apple Developers) added one?

... I have looked though all of the RealityKit SDK ... line by line ... but I haven't seen a "comment section" (that is usually the norm...) with all of the Error codes that one might encounter.

(just a bit frustrated that every time one encounters an Error code, one has to "pray to the Apple gods of code" ... and hope they might reply ...)

Sorry you both are encountering this issue. The object capture team is aware that the error codes are unhelpful and they would like to fix this in the future. In the meantime, I will find out what both of your error codes mean and let you know.

Accepted Answer

/// A GPU that is not low power is required.

/// https://developer.apple.com/documentation/metal/mtldevice/1433409-lowpower

kCPGReturnHardwareGPULowPower = -24,

/// A GPU with at least 4GB VRAM is required.

kCPGReturnHardwareGPUNotEnoughVRam = -21,

Thanks!

... Error "-11"? ... I did some more testing, and when I run the sample-code on Monterey Beta 1, I get the error value of "-11". Updated the system to Beta 3 and here I get "-21".

Are they the same? ... just that since beta 1 --> beta 3, you have updated the Error codes?

BTW,

Would it be possible for you to add all of the potential Error Codes into RealityFoundation API documentation in the next beta release?

(green or blue highlight?)

... so we can quickly look-up the issue ourselves? :-)

cantCreateSession("Native session create failed: CPGReturn(rawValue: -21)
 
 
Q