access particular set of pixels MTLTexture in melal
access particular set of pixels MTLTexture in melal I created a MTLtexture using UIImage data as follows. var texture = metalView.currentDrawable!.texture let uiImg = createImageFromCurrentDrawable() guard let device = metalView.device else { fatalError("Device not created. Run on a physical device") } let textureLoader = MTKTextureLoader(device:device) let imageData: NSData = UIImagePNGRepresentation(uiImg)! as NSData texture = try! textureLoader.newTexture(data: imageData as Data, options: [MTKTextureLoader.Option.allocateMipmaps : (false as NSNumber)]) what I need to do is change pixels color in MTLTexture.Not all of them.So Is it possible to access particular set of pixels in MTLtexture and write into it in metal? 1 Answer 1 Yes, as a look at the MTLTexture documentation would have shown you. You can use one of the getBytes() methods to copy a region of texture data ou...