MTKTextureLoader失败并带有mipmapped纹理

时间:2016-11-11 01:38:54

标签: ios swift textures metal 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)")
}

如果目录中的纹理不是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纹理?

0 个答案:

没有答案