确定 iPad 1 与 iPad 2 GPU 的最佳方法?

发布于 2025-01-05 20:43:22 字数 701 浏览 2 评论 0 原文

iPad 2 GPU 的性能比 iPad 1 更好。当我知道 GPU 可以处理它时,我想切换到我的应用程序并添加一些额外漂亮的图形细节。

因此,我希望能够本质上检测 iPad 1 和 2(及更高版本)之间的区别,最好使用尽可能接近的功能检测。有很多不相关的东西我可以打开(相机的存在等),但理想情况下我想找到一些东西,也许是 OpenGL 功能,可以更直接地区分 GPU。

这个Apple 页面 未列出任何对 iPad 1 与 2 有用的内容,并且 本文讨论基准测试和 GPU 架构差异,但没有指出任何看起来我可以直接查询的内容(例如纹理单元的数量或其他)。

有人对如何做到这一点有任何想法,还是我错过了一些明显的东西?谢谢。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

千秋岁 2025-01-12 20:43:22

您可以查询的一项区别是最大纹理大小。在 iPad 2 和 iPhone 4S 上,最大纹理尺寸为 4096 x 4096,而在所有其他 iOS 设备上为 2048 x 2048。在我看来,一个安全的假设是,未来更强大的 iOS 设备也将具有最大纹理尺寸至少有这么大。

要查询最大纹理大小,请首先创建 OpenGL ES 上下文,然后将其设置为当前上下文并运行以下查询:

GLint maxTextureSize; 
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTextureSize);

在我的 iPhone 4 上,这会在 maxTextureSize 中返回 2048,但在我的 iPad 2 和 iPhone 4S 上,这会返回值 4096。

您还可以测试 iPad 2 支持的一些新扩展是否存在,例如 EXT_shadow_samplers(更多内容记录在“iOS 新增功能:iOS 5.0”),但这些测试只会在 iOS 5.0 上工作。仍在使用 iOS 4.x 的落后者将无法注册这些功能。

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.

撩起发的微风 2025-01-12 20:43:22

如今,随着 GPU 的增多,我根据自己的需求提出了以下方案。

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;
}

您可以通过指定更完整的版本号来进一步区分特定芯片。例如指定 IMGSGX543 而不仅仅是 IMGSGX5。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文