I am developing an iOS application using Metal and have the choice of using either RGBA or BGRA for texture formats. The application will be:
UIImages
from texturesUIImages
Are there any performance trade-offs for choosing RGBA over BGRA? The latter two points lead me to RGBA, but I also notice that MTKTextureLoader
defaults to BGRA textures. I was unable to find any application notes addressing difference between RGBA and BRGA in Metal.
BGRA is the default and most optimal format for textures and image data on iOS devices. While RGBA is supported, use of RGBA format can result in real performance issues when reading RGBA textures with UIImage and CoreGraphics because these layers can silently reorder the bytes for each pixel (this hurts performance for every pixel). BGRA native data can be copied via memcpy() on the device.