Tyler Goose Lafferty
Tyler Goose Lafferty

Reputation: 81

RealityKit arView.snapshot fails

I currently have an application using RealityKit to add AR content to the view. I have a button that allows the user to take a photo. Based on the documentation, ARView.snapshot() seems to do this. However, I get an error every time I try.

arView.snapshot(saveToHDR: false) { (image) in
    self.capturedImage = image
}

The error I receive is

validateFunctionArguments:3543: failed assertion `Fragment Function(arPostProcessCombinedGraphics): Shader reads texture (inputColor[0]) whose usage (0x04) doesn't specify MTLTextureUsageShaderRead (0x01)'

Any help is greatly appreciated!

Upvotes: 4

Views: 778

Answers (1)

Tyler Goose Lafferty
Tyler Goose Lafferty

Reputation: 81

When I am debugging, that is the only time I receive the error. If I run the app on it's own, the capture works. I found that disabling Metal API validation in your run options for the scheme allows this to work when debugging as well.

Upvotes: 3

Related Questions