The performance of the iPad 2 GPU is way better than the iPad 1. I'd like to switch in my app and add some extra nice graphical subtlety when I know the GPU can handle it.
So I'd like to be able to detect essentially the distinction between the iPad 1 and 2 (and later), ideally using as close to a capability detection as I can. There are plenty of unrelated things I could switch on (presence of camera, etc), but ideally I'd like to find something, maybe an OpenGL capability, that distinguishes the GPU more directly.
This Apple page doesn't list anything useful for iPad 1 vs 2, and this article talks about benchmarking and GPU arch differences but doesn't pinpoint anything that looks like I can query directly (e.g. number of texture units or whatever).
Anyone have any thoughts on how to do this, or am I missing something obvious? Thanks.
One distinction you can query for is maximum texture size. On iPad 2 and iPhone 4S, the maximum texture size is 4096 x 4096, where on all other iOS devices it's 2048 x 2048. It would seem to me to be a safe assumption that future, more powerful iOS devices would also have a maximum texture size at least this large.
To query for the maximum texture size, first create your OpenGL ES context, then set it as the current context and run the following query:
GLint maxTextureSize;
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTextureSize);
On my iPhone 4, this returns 2048 in maxTextureSize, but on my iPad 2 and iPhone 4S this gives back the value of 4096.
You can also test for the presence of some new extensions that the iPad 2 supports, such as EXT_shadow_samplers
(more are documented in "What's New in iOS: iOS 5.0"), but those tests will only work on iOS 5.0. Stragglers still on iOS 4.x won't have those capabilities register.
Today with more GPU's available, here is what I came up with for my own needs.
enum GpuClass {
kGpuA5 = 0,
kGpuA6,
kGpuA7,
kGpuA8,
kGpuUnknown,
} ;
- (enum GpuClass)reportGpuClass {
NSString *glVersion = [NSString stringWithUTF8String:(char *)glGetString(GL_VERSION)];
if ([glVersion containsString:@"Apple A5"] || [glVersion containsString:@"S5L8"]) {
NSLog(@"Running on a A5 GPU");
return kGpuA5;
}
if ([glVersion containsString:@"Apple A6"] || [glVersion containsString:@"IMGSGX5"]) {
NSLog(@"Running on a A6 GPU");
return kGpuA6;
}
if ([glVersion containsString:@"Apple A7"] || [glVersion containsString:@"G6430"]) {
NSLog(@"Running on a A7 GPU");
return kGpuA7;
}
if ([glVersion containsString:@"Apple A8"] || [glVersion containsString:@"GXA6850"]) {
NSLog(@"Running on a A8 GPU");
return kGpuA8;
}
return kGpuUnknown;
}
You may further differentiate between specific chips by specifying more full version numbers. e.g. specify IMGSGX543 instead of just IMGSGX5.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With