2

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?

user16217248
  • 3,119
  • 19
  • 19
  • 37
Curyous
  • 8,716
  • 15
  • 58
  • 83
  • Did you specify a pixel format in Xcode or leave it as "Automatic"? Either way, this sounds like a bug and you should probably [file a bug report](http://bugreport.apple.com), providing a copy of your project if possible. – warrenm Nov 11 '16 at 07:00

0 Answers0