OpenGL benchmark on iPhone - iphone

I'm looking for a comparison of iPhone 3G / 3GS graphical systems (opengl) to the ones on a PC / MAC.
Google didn't help. Perhaps anybody here?

While this might be more of a hardware question, there is enough that might influence the design of an OpenGL-based application here that I'll bite.
Using my Molecules application as a template, I benchmarked the rendering throughput of that running on iPhone 3G, iPad, and a 2nd generation MacBook Air (Nvidia GeForce 9400M). For the MacBook, the numbers were generated from running the application in the Simulator with nothing else executing on the system:
iPhone 3G: 423,000 triangles / s
iPad: 1,830,000 triangles / s
MacBook Air: 2,150,000 triangles / s
You can grab the code for the application and try this yourself by enabling the RUN_OPENGL_BENCHMARKS define in SLSMoleculeGLViewController. This causes structures to be rendered for 100 frames, then the total time measured and the rendering rate figured from the complexity of the model being shown.
Note that this is an OpenGL ES 1.1 application which is geometry-limited in its current state. A fill-rate-limited application might have completely different performance characteristics, same as with one that uses OpenGL / OpenGL ES 2.0 shaders.
Aside from performance differences, the OpenGL command set differs between iOS and the Mac. OpenGL ES cuts out a lot of the cruft that's built up in OpenGL over the years (immediate mode, etc.). In general, OpenGL ES is a subset of OpenGL, so you can pretty much port something written for OpenGL ES to OpenGL without a lot of trouble. OpenGL on the desktop also uses a newer version of GLSL for its shaders (1.4, I believe), so some of the commands supported there will not work on iOS devices.
Apple has more about platform-specific differences in their Platform Notes section in the OpenGL ES Programming Guide for iOS.

Related

PowerVR SGX535 Shader Performance (OpenGL ES 2.0)

I'm currently working on a couple of shaders for an iPad game and it seems as if Apple's GLSL compiler isn't doing any optimizations (or very few). I can move a single line in a shader and drop my FPS from 30 to 24 but I really have no idea why this is happening.
Does anyone have any references for the following:
what PowerVR instructions are generated from GLSL instructions?
what are the timings of the PowerVR instructions?
what sort of parallel processing units are in the PowerVR535 and how can they be exploited?
Thanks,
Tristan
Imagination Technologies recently added Mac support for their PVRUniSCo compiler and PVRUniSCoEditor interactive shader editor. These can be downloaded for free as part of the PowerVR SDK. The compiler has support for both the PowerVR SGX 53x series as well as the 540 series in the iPad 2. Unfortunately, the editor runs as a clunky X11 application, but at least it works now.
The editor gives you line-by-line estimates of the number of GPU cycles required throughout your vertex or fragment shader, as well as more accurate best and worst case estimates of total cycles required.
I've been using it to profile my iOS shaders, and it has proven to be extremely useful in finding hotspots:
http://www.imgtec.net/factsheets/SDK/POWERVR%20SGX.OpenGL%20ES%202.0%20Application%20Development%20Recommendations.1.1f.External.pdf
This documet should help you to optimize your shaders for maximum performance. Apple should provide similar information as well.

iPhone cost vs. benefit - OpenGL ES 1.x vs 2.0

I'm not sure if this question has been asked already, my stackoverflow-fu has failed me.
So I'm building an OpenGL-ES-based iPhone game and pretty much all of the examples I've found out in the wild are on OpenGL ES 1.x. Which is fine because at least I'm (re)learning a lot about OpenGL in general.
Now that newer devices support OpenGL-ES 2.0, I'm wondering if anyone has ported their OpenGL-ES 1.x app to 2.0 and if so were there any performance or efficiency gains? For instance, I can setup my lighting (in 1.x) with glLightf(blahblah) and I'm done with lighting...but apparently that function doesn't exist in 2.0 so I'm forced to write it myself? So, how can somebody with no experience "programming the pipeline" accomplish this? Is there a default lighting implementation in 2.0?
I'm probably speaking out of ignorance as I haven't really found any solid iPhone-specific OpenGL-ES 2.0 information.
Any help in this space will be greatly appreciated.
From what I've read, and from my limited time working with it, going to OpenGL ES 2.0 from 1.1 isn't so much a matter of performance as it is about capabilities. If you watch the Mastering OpenGL ES for iPhone videos (part of the iPhone Getting Started Videos available through the iPhone Developer Program site), Apple even states that if you can do what you need to under OpenGL ES 1.1, you don't need to step up to 2.0.
OpenGL ES 2.0's fully programmable pipeline can make simple actions much harder than doing the same thing in 1.1, because you need to write code for parts of the pipeline that were handled for you before. However, 2.0 makes practical many stunning effects that you just couldn't do in 1.1. For example, I recommend watching the WWDC 2010 session video 417 - OpenGL ES Shading and Advanced Rendering and the Graphics and Media State of the Union to see what's possible using OpenGL ES 2.0.
To date, few applications have used OpenGL ES 2.0, given the limited subset of iPhone devices that had compatible GPUs and the lack of documentation and examples. I think we'll see this start to change as the pre-iPhone 3G S devices are phased out. In particular, the iPad has had OpenGL ES 2.0 from launch, so if you are designing an application for it you can rely on these capabilities to be there. More code examples and documentation are sure to appear in the near future.

Open GL ES 1.1 and iPhone games

Will iPhone games that draw 2D textures like this:
glPushMatrix();
glTranslatef(xLoc, yLoc, 0);
[myTexturePointer drawAtPoint:CGPointZero];
glPopMatrix();
work with newer iPhones (that support OpenGL ES 2.0)? I'm asking because I just learned OpenGL ES 2.0 doesn't support glPushMatrix etc.
Cheers!
The newer phones still support the older OpenGL ES 1.1, so this code should run fine, as long as you're running it in a 1.1 context.
Newer iphones do support both standards. So your code should work.
To maintain compatibility with the
OpenGL ES 1.1 used in existing iPhone
and iPod touch devices, "the graphics
driver for the PowerVR SGX also
implements OpenGL ES 1.1 by
efficiently implementing the
fixed-function pipeline using
shaders," sources report. This
indicates that games and other
applications unique to the iPhone 3G S
and other future models of the iPhone
and iPod touch are likely to arrive
that will either be exclusive to the
new model, or more likely, will
support improved 3D graphics on the
new device while still working on
previous models using the older
fixed-function 3D pipeline.
Source

Is there any GPGPU library for iPhone?

Is there any GPGPU library for iPhone?
The original iPhone and iPhone 3G support only support OpenGL ES 1.1 fixed-function pipeline and do not provide a programmable pipeline (no shaders) and therefore cannot be used as general purpose computation devices, at least at the OpenGL abstraction layer.
iPhone 3GS and iPod touch 3G support OpenGL ES 2.0 programmable pipeline. However, it looks like there are limitations like lack of antialiased shaders.
Regardless of the support for programmable shaders in 3GS, I don't think the GPU is powerful enough to be used as a general purpose computational engine.
The iPhone GPU isn't built for general purpose computation, so hacking it for such features would be very limited and slow at best.
Pre 3GS' even have fixed pipeline chips, which makes computation on them impossible for almost all practical purposes.

How to get started with implementing my own VGP code for iPhone OpenGL ES development?

How do I get started with implementing my own Vertex Geometry Processor code for iPhone OpenGL ES development, in order to fully benefit from its VGP Lite chip?
The iPhone chip can only be used for fixed-function processing as part of the normal transform and lighting pipeline. There's no way to run custom vertex programs.