Butterflies VFP algorithm code sample

In the PowerVR MBX documentation, it makes reference to a fully optimized algorithm for floating point operations, and shows how when used for the Butterflies demo, realized a > 1000 fps.





Is it possible to see, or to use or even just learn from this algorithm?





Has anyone used this for iPhone development?

Yes, it’s an excellent demo. But we can’t access the source code.
There is even no a guide to show how to do this.
What a pity!

I doubt there is much to it … just relatively simple math you would find in any 3d app, optimized for arm/vfp cpus.





Here is a link to VFP code with some common matrix stuff.





http://code.google.com/p/vfpmathlibrary/source/browse/#svn/trunk





And here is something similar for the Neon cpu ( the latest iPhone)





http://code.google.com/p/math-neon/source/browse/#svn/trunk

This was actually dealt with by email - I meant to post the answer there as well:











The document you are referring to is currently under review as it was written primarily in reference to a much earlier chipset and some of the recommendations in relation to the CPU are not so applicable now.





The algorithms mentioned are simply more efficient ways of dealing with potential collisions between the butterflies than simply measuring the distance between every single one using normal floating point arithmetic. There is an implementation that uses fixed point arithmetic which is obsolete on modern platforms like the iPhone. There is a version with some optimisation with assembly, one with the VFP and there are versions with some improvements in the algorithm so that only checks for the nearest butterflies are executed and not every frame.





The source code for the demo, in its current state, is not available for download, I’m afraid.








I know various people are using the VFP explicitly in the iPhone - there is code in the Oolong engine for instance. One drawback to this approach is that the new iPhone 3GS (and iPod) is based on a newer CPU and GPU and so such low-level optimisations are not compatible. This is also the reason we increasingly try to avoid such CPU-sepecific work as our technology is in such a wide variety of platforms.





Another source of information would be Apple’s developer forum concerning general optimisation, including VFP use. If you are a member of their developer programme some interesting threads can be found in the OpenGL ES section.





I’m sorry that I can’t be more helpful in regard to this demo - if you do have specific questions concerning the MBX, SGX or POWERVR technology we would be happy to answer these.


eighth wrote:
Yes, it's an excellent demo. But we can't access the source code. There is even no a guide to show how to do this. What a pity!



We're actually looking to release a better demo with source code soon (time willing) - which techniques are you interested in specifically?