When I try to load a texture from an asset catalog:
let texLoader = MTKTextureLoader.init(device: device)
texLoader.newTexture(withName: "Temple", scaleFactor: 1.0, bundle: nil, options: [:]) {(tex: MTLTexture?, error: Error?) in
guard tex != nil && error == nil else {
print("Texture load failed. \(error)")
return
}
print("Texture loaded. Mipamp level count: \(tex!.mipmapLevelCount)")
}
It works OK if the texture in the catalog is not mipmapped, but if it is mipmapped, execution halts as an assertion is failed:
Library/Caches/com.apple.xbs/Sources/Metal/Metal-85.82.1/ToolsLayers/Debug/MTLDebugBlitCommandEncoder.mm:493: failed assertion 'totalBytesUsed(7427) must be <= [sourceBuffer length](4096).'
How do I load a mipmapped texture?