16
votes

I'm building a macOS app via Xcode. Every time I build, I get the log output:

Metal API Validation Enabled

To my knowledge my app is not using any Metal features. I'm not using hardware-accelerated 3D graphics or shaders or video game features or anything like that.

Why is Xcode printing Metal API log output?

Is Metal being used in my app? Can I or should I disable it?

How can I disable this "Metal API Validation Enabled" log message?

3

3 Answers

33
votes

Toggle Metal API Validation via your Xcode Scheme:

Scheme > Edit Scheme... > Run > Diagnostics > Metal API Validation.

It's a checkbox, so the possible options are Enabled or Disabled.

Disabling sets the key enableGPUValidationMode = 1 in your .xcscheme file.

After disabling, Xcode no longer logs the "Metal API Validation Enabled" log message.

Note: In Xcode 11 and below, the option appears in the "Options" tab of the Scheme Editor (instead of the "Diagnostics" tab).

1
votes

I had the exact same message.

I had a .onDelete(perform: deleteLocations) at the end of a scrollview closure.

I changed the scrollview to a list and the message went away.

0
votes

I recently started to work for an update to my macos app.

It worked well without errors but then i added a storyboard file from an older xcode project and when i fire .loadWindow() i saw these on my log:

  • "Metal API Validation Enabled"
  • "fopen failed for data file: errno = 2 (No such file or directory)"

Then i looked at the interface builder and one of my labels was in a weird position. So i centered that label and run app again and the "fopen failed for data file: errno = 2 (No such file or directory)" warning gone. It still says "Metal API Validation Enabled" whenever i load that window from that .storyboard file but that doesn't bother me.

So i think this is something about how operating system is drawing windows and views or maybe something about interface builder version difference.