I added another texture to one of my metal Kernel functions, and get the following error. I searched, and see a lot of confusion about this error.
How to solve Metal error "The pixel format of the texture is incompatible with the data type" ?
validateComputeFunctionArguments:841: failed assertion `Compute Function(screenSampleWithScreenshot):
The pixel format (MTLPixelFormatBGRA8Unorm) of the texture (name:CAMetalLayer Display Drawable)
bound at index 4 is incompatible with the data type (MTLDataTypeUInt) of the texture parameter
(myTexture [[texture(0)]]). MTLPixelFormatBGRA8Unorm is compatible with the data type(s) (
float,
half
).'
The solution is simple: metal validation has detected that your function signature is incorrect. It found unsigned int (or other unexpected) data type, while you are passing in a texture with a float color format.