UIImage(named:) with MTKTextureLoader throws error "Image decoding failed"

Originator:blixt
Number:rdar://31722523 Date Originated:2017-04-19
Status:Open Resolved:
Product:iOS + SDK Product Version:10.3.1
Classification: Reproducible:
 
Area:
Metal

Summary:
The image that I tested with is a PNG with RGB + alpha channels which was stored in Assets.xcassets. The asset image is universal with 1x, 2x, 3x versions. It was retrieved using UIImage(named:).

Steps to Reproduce:
1. Set up a MTKTextureLoader
2. Get a PNG with alpha from assets using UIImage(named:)
3. Get the CGImage from the image
4. Attempt to load it using loader.newTexture(with:options:)
5. Get error "Image decoding failed"

Expected Results:
An MTLTexture object.

Actual Results:
Error "Image decoding failed"

Configuration:
iPhone 6s (MKRY2LL/A)

Comments

Can verify that this occurs.

Reproduced on iPhone 7, XCode Version 8.3.3 (8E3004b), iOS 10.3.2

By lambdasquirrel at July 9, 2017, 11:14 p.m. (reply...)

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!