Based on the answer from Adi Shavit above , here is the full code snippet (Objective-C) that you can use to print all current OpenGL ES compatible pixel formats
+ (void)load { @autoreleasepool { printf("Core Video Supported Pixel Format Types:\n"); CFArrayRef pixelFormatDescriptionsArray = CVPixelFormatDescriptionArrayCreateWithAllPixelFormatTypes(kCFAllocatorDefault); for (CFIndex i = 0; i < CFArrayGetCount(pixelFormatDescriptionsArray); i++) { CFNumberRef pixelFormatFourCC = (CFNumberRef)CFArrayGetValueAtIndex(pixelFormatDescriptionsArray, i); if (pixelFormatFourCC != NULL) { UInt32 value; CFNumberGetValue(pixelFormatFourCC, kCFNumberSInt32Type, &value); NSString * pixelFormat; if (value <= 0x28) { pixelFormat = [NSString stringWithFormat:@"Core Video Pixel Format Type 0x%02x", (unsigned int)value]; } else { pixelFormat = [NSString stringWithFormat:@"Core Video Pixel Format Type (FourCC) %c%c%c%c", (char)(value >> 24), (char)(value >> 16), (char)(value >> 8), (char)value]; } CFDictionaryRef desc = CVPixelFormatDescriptionCreateWithPixelFormatType(kCFAllocatorDefault, (OSType)value); CFBooleanRef OpenGLESCompatibility = (CFBooleanRef)CFDictionaryGetValue(desc, kCVPixelFormatOpenGLESCompatibility); printf("%s: Compatible with OpenGL ES: %s\n", pixelFormat.UTF8String, (OpenGLESCompatibility != nil && CFBooleanGetValue(OpenGLESCompatibility)) ? "YES" : "NO"); } } printf("End Core Video Supported Pixel Format Types.\n"); } }
You can place this snippet anywhere in the Objective-C category or class to print which pixel format is compatible and which are not. For completeness, all pixel formats that are compatible with OpenGL ES with iOS 10.2.1 are presented here:
L5655551L5552vuyyuvsyuvfL008L0162C082C16BGRA420v420f420e411v411f422v422f444v444fL00hL00f2C0h2C0fRGhARGfA
Stéphane Copin Feb 14 '17 at 11:45 2017-02-14 11:45
source share