当我尝试从资产目录中加载纹理时:
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)")
}
如果目录中的纹理不是mipmap,它可以正常工作,但如果它是mipmap,则执行会在断言失败时停止:
Library / Caches / com.apple.xbs / Sources / Metal / Metal-85.82.1 / ToolsLayers / Debug / MTLDebugBlitCommandEncoder.mm:493:断言失败`totalBytesUsed(7427)必须是&lt; = sourceBuffer length。'< / p>
如何加载mipmapped纹理?