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
Facebooksdk(4.1.X) Custom Login UI Button - Swift(1.2)
Adding Swift Files to Test Target Not Fixing Unit Tests
Fonts Not Displaying in Interface Builder
iOS 7 When Rotating View in Tab Bar, Right Side of View Is Not Clickable
Nsdateformatter Datefromstring Always Returns Nil
iOS Uitableview with Dynamic Text and Images Rendered Together (Nsattributedstring + Images)
Change Button Title Color in Uialertview
Change Tabview Color Based on Which Tab Is Selected -Swiftui
Nsdateformatter Returns Nil in Swift and iOS Sdk 8.0
Asynchronous Upload with Nsurlsession Will Not Work But Synchronous Nsurlconnection Does
Restore Button for iOS Non-Consumable In-App Purchase
How Long Does a Push Notification Sit in Queue Before Being Removed
How to Write Output of Augraph to a File
Will Push Notification Still Work After Ownership Transfer in Itunesconnect
Ios/C: Convert "Integer" into Four Character String
Audiokit iOS Aksamplermetronome
How to Create/Extract an Array of Views Using @Viewbuilder in Swiftui