5

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.

Charles
  • 50,943
  • 13
  • 104
  • 142
Ben Zotto
  • 70,108
  • 23
  • 141
  • 204
  • 1
    Hey, I think this should help: http://stackoverflow.com/questions/448162/determine-device-iphone-ipod-touch-with-iphone-sdk The capabilities are determined by the return value from UIDevice. IPad 2 is returned as "iPad2,x" where "x" is a sub-version of the IPad 2. – Jon Boydell Feb 13 '12 at 23:47
  • 2
    Are you sure that capability detection is the way to go here? That approach might make sense in the wild world of web applications, where every version of every browser does things differently, but I'm not sure it applies to iOS apps. iOS apps are going to run on a limited, specific set of hardware and software. You'd probably be safe with a *blacklist* of the handful of devices you know don't perform well, turning on the pretty effects otherwise. – Charles Feb 14 '12 at 00:14
  • 1
    @Charles - In this case, it does make sense to determine the power of the GPU, because there is a vast difference in performance between the iPad 1 and 2 (I've seen 7X differences between the two in some cases). For presenting 3-D content, it can be really useful to scale textures, geometry, and shaders depending on the power of the device in question. A slower device blacklist is probably OK, but I like my OpenGL ES capability-based solution a little better, because that should protect against Apple rolling out some new model that uses an older GPU. – Brad Larson Feb 19 '12 at 23:28

2 Answers2

10

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.

Brad Larson
  • 170,088
  • 45
  • 397
  • 571
1

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.

Jeshua Lacock
  • 5,730
  • 1
  • 28
  • 58