iPhone OpenGL ES:最快的纹理模式是什么?

发布于 2024-11-06 07:53:36 字数 390 浏览 1 评论 0原文

所以我一直在开发 iPhone 3D 游戏,分辨率为通常的 320x480(不是视网膜)。

我一直在使用仪器测试其性能,报告显示渲染器利用率为 64%,而平铺器利用率仅为 9%。这意味着性能影响与纹理、混合等有关。

我尝试的下一件事是删除除天空盒之外的所有绘图。仅渲染天空盒就使渲染器百分比从菜单屏幕的 20% 跃升至 40%。

可能会发生什么?我尝试禁用 GL_BLEND,并将 GL_NEAREST 设置为纹理 mag 过滤器,但渲染器 % 仍然很糟糕。

我尝试打开视网膜显示屏(分辨率的四倍),但帧速率被轰炸了。

还可以采取哪些其他措施来减少渲染器开销?我想一定有什么东西,考虑到 RAGE for iPhone 在视网膜分辨率下以 60fps 运行(实际上我还没有证实这一点)。

So I've been working on an iPhone 3D game, at the usual 320x480 resolution (not retina).

I've been testing its performance using instruments, and it reports that renderer utilization % is at 64%, whereas tiler utilization% is at a low 9%. Which means that the performance hit is related to textures, blending etc.

The next thing I tried was to remove all the drawings, except for the skybox. Rendering the skybox alone made the renderer % jump to 40% from the menu screen, which was at 20%.

What could be happening? I tried disabling GL_BLEND, and set GL_NEAREST to the texture mag filters, but the renderer % is still pretty bad.

I tried turning on retina display (four times the resolution) and the frame rate just bombed.

What other things could be done to reduce the renderer overhead? I suppose there must be something, considering RAGE for iPhone runs at 60fps at retina resolution (I haven't confirmed that, actually).

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

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

发布评论

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

评论(2

灵芸 2024-11-13 07:53:36

您的纹理的颜色深度是多少?在许多情况下,32 位的深度可以轻松减少到 16 位(从 8888 格式减少到 4444),而不会造成相当大的质量损失。当然,“最快”的纹理是 pvrtc。另外,不要忘记纹理图集。

首先,这些调整将显着减少内存消耗,但这只是第一个优点。第二个优点是压缩纹理需要更少的带宽,这就是为什么它们从内存传输到 GPU 的速度会更快(因为结果纹理采样会更快)。第三个优点是小纹理可以放入缓存并更快地重用。

然而,正如 Brad Larson 所说,您最好运行 OpenGL ES 分析器并查看其内容。

What is the color depth of your textures? In many cases the depth of 32 bits could be easily reduced to 16 (from 8888 format to 4444) without considerable quality loss. And of course the 'fastest' textures are pvrtc. Also, don't forget about texture atlases.

First of all all this tweaks will significantly reduce memory consumption, but this is only the first advantage. The second advantage is that compressed textures need less bandwidth and that's why they will be transfered faster from memory to the GPU (as the result texture sampling would be mush faster). The third advantage is that small textures can fit into the cache and be reused faster.

However, as Brad Larson said, you'd better run OpenGL ES Analyzer and see what it says.

ぃ弥猫深巷。 2024-11-13 07:53:36

如果不需要 alpha 读取,请使用 16 位帧缓冲区。禁用 alpha 测试和 alpha 混合。如果不需要,请不要忘记禁用照明和 z 缓冲区测试。开始新帧时,请始终清除帧缓冲区/z缓冲区和/或确保在绘制天空盒或背景时完全覆盖它,而无需进行 alpha 混合和测试。
如果要将纹理缩小到低于其原始大小,请使用 mipmap,但不要使用三线性。
您可以尝试禁用双线性过滤。通常它是免费的,但是当在没有 mipmap 的情况下进行纹理缩小时,它(可能)可能会慢一些。
使用 16 位或 PVR 压缩格式的纹理。甚至不要考虑其他压缩格式,它们并不真正受到硬件支持。
不要频繁切换纹理,尽量将所有内容放入纹理图集中。
此外,基于 NSTimer 的简单屏幕更新方法可能不是最佳的。我听说有些应用程序,例如 iPhone Doom port,正在单独的线程中进行渲染。

Use 16-bit framebuffer, if you don't need alpha reads. Disable alpha testing and alphablending. Don't forget to disable lighting and z-buffer testing if you don't need it. When starting a new frame, always clear the framebuffer/zbuffer and/or make sure you are overwriting it completely without alpha blending and testing when drawing skybox or background.
Use mipmapping, but not trilinear if you are shrinking textures below their original size.
You can try to disable bilinear filtering. Usually it's free, but when doing texture minification without mipmapping, it (probably) can be somewhat slower.
Use 16-bit or PVR compressed format for textures. Don't even consider other compressed formats, they are not really supported by hardware.
Don't switch textures frequently, try to put everything into texture atlas(es).
Also, naive NSTimer-based screen update method may be not optimal. I heard that some apps, such as iPhone Doom port, are doing rendering in separate thread.

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