Xcode Logging: "Metal API Validation Enabled"

Xcode logging: Metal API Validation Enabled

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).

Xcode: how can I enable Metal API Validation for a tests target?

Set the METAL_DEVICE_WRAPPER_TYPE environment variable to 1 in Edit Scheme -> Test -> Arguments.

Metal API validation crash

Ok I found the solution. The solution was to set texture usage flag MTLTextureUsage.renderTarget in addition to (or in place of depending upon usage, shaderRead or shaderWrite when creating the texture:

        let textureDescriptor = MTLTextureDescriptor()
textureDescriptor.textureType = .type3D
textureDescriptor.pixelFormat = .bgra8Unorm
textureDescriptor.width = 256
textureDescriptor.height = 1
textureDescriptor.usage = .renderTarget

let texture = device.makeTexture(descriptor: textureDescriptor)


Related Topics



Leave a reply



Submit