VFP Math Lib

View previous topic View next topic Go down

VFP Math Lib

Post  uprise78 on Fri Apr 17, 2009 10:03 am

Just curious if anyone has seen this project on Google Code: http://code.google.com/p/vfpmathlibrary/

I'm not sure if it would be worth the time to try to integrate it inyo SIO2 or not so perhaps someone smarter than I can comment.

uprise78

Posts : 228
Join date : 2008-10-31

View user profile

Back to top Go down

Re: VFP Math Lib

Post  zzajin on Fri Apr 17, 2009 2:11 pm

One of the creators is also the creator of the Oolong Engine. I don't believe they have integrated it into Oolong in any concrete way.

It's beyond me, but it seems like people on Apple's official dev forums have been able to wrangle some usefulness out of the VFP. It seems it's only beneficial when you can align a bunch of data a certain way and stream it into the VFP. Sounds like it would be useful for software based skeletal animation. Or maybe physics?

zzajin

Posts : 81
Join date : 2008-10-14

View user profile

Back to top Go down

Re: VFP Math Lib

Post  autology on Fri Apr 17, 2009 2:25 pm

I've always been interested about this as well but it is well-beyond me in terms of implementing it into any useful way into sio2. VFP calls plus in-line switches between thumb and arm compilation seem to be a nice speed-up all around. Basically optimizing the float ops and matrix math should lend a great bit of speed to calculations done outside of opengl calls.

That said, I'm pretty sure that sio2/rom is well aware of the benefits of each and doing his best to implement them.

autology

Posts : 22
Join date : 2008-12-29

View user profile

Back to top Go down

Re: VFP Math Lib

Post  sio2interactive on Fri Apr 17, 2009 5:49 pm

Well yes I check it out... and can't even compile it... (for some reasons). What SIO2 would need is an extension to SIO2transform that uses VFP to replace the function such as: glTranslate, glRotate, glScale on the matrix operation etc... if someone is interested I can give more specifications...

_________________
SIO2 Interactive
Free Open Source 3D Game Engine for iPhone and iPod Touch
http://sio2interactive.com
avatar
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 38
Location : Shanghai

View user profile http://sio2interactive.com

Back to top Go down

I'm pretty intrigued by it...

Post  goldfrapp0x0309 on Mon Apr 20, 2009 7:33 am

Can i get some details, i'd love to look into it...
avatar
goldfrapp0x0309

Posts : 43
Join date : 2009-02-28

View user profile

Back to top Go down

Re: VFP Math Lib

Post  sio2interactive on Mon Apr 20, 2009 11:19 am

Well like I said, what I need is functions that replace the GL one to translate, rotate etc... and also for sqrtf, sin, cos, tan etc...

In other words, floating points operations and matrix operations implemented using VFP. All you need to do is add inside sio2_transform.cc new functions such as:

sio2Translate, sio2Rotate, sio2Sqrtf etc... with a #define on top to switch between regular function or the VFP ones.

That's pretty much it Wink

_________________
SIO2 Interactive
Free Open Source 3D Game Engine for iPhone and iPod Touch
http://sio2interactive.com
avatar
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 38
Location : Shanghai

View user profile http://sio2interactive.com

Back to top Go down

Re: VFP Math Lib

Post  uprise78 on Tue May 12, 2009 9:37 am

@Goldfrapp, any luck on implementing this? Did you look at Ooolong's source to see what they are doing?

uprise78

Posts : 228
Join date : 2008-10-31

View user profile

Back to top Go down

Rundown...

Post  goldfrapp0x0309 on Tue May 12, 2009 1:58 pm

After some research, the sio2 transforms call the opengl es matrix functions, which are optimized (actually all floating point stuff) n sent to the vfp unit. After scanning the oolong source, all transforms and math stuff is programmed as is, i believe they realized that the compiler takes care of sending that "type" to the VFP unit.

Where asm programming is most helpful, is actual algorithms (image n processing effects etc.) but rudimentary stuff like add, subtract, which is what the vfp uses, doesn't make any noticeable difference.
avatar
goldfrapp0x0309

Posts : 43
Join date : 2009-02-28

View user profile

Back to top Go down

Re: VFP Math Lib

Post  sio2interactive on Tue May 12, 2009 4:12 pm

Something that might do a difference is to replace the Bullet matrices with VFP... since all the calculations are aligned... it might be more than noticeable...

Anyone interested?

_________________
SIO2 Interactive
Free Open Source 3D Game Engine for iPhone and iPod Touch
http://sio2interactive.com
avatar
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 38
Location : Shanghai

View user profile http://sio2interactive.com

Back to top Go down

Re: VFP Math Lib

Post  yarri on Tue May 12, 2009 6:14 pm

John Owens posted his code for btMatrix3x3.h which uses vfpMath lib on the Oolong engine mailing list, and Erwin from the Bullet team is working to incorporate a fix into the next version. I haven't tried it. You can look at the source, here:
http://pastie.org/476292

And you should review this thread, I'm seeing dramatic fps improvements compiling with -O3:
http://www.bulletphysics.com/Bullet/phpBB3/viewtopic.php?f=9&t=3225&start=15

--yarri

yarri

Posts : 81
Join date : 2009-04-10

View user profile

Back to top Go down

Re: VFP Math Lib

Post  sio2interactive on Tue May 12, 2009 6:24 pm

Yeah I've seen this but Im not getting dramatic FPS boost with -O3... Have you tried with a plain tutorial like tutorial06_1?

Im on iPod 2nd Gen, so maybe on iPhone -O3 really change something...

_________________
SIO2 Interactive
Free Open Source 3D Game Engine for iPhone and iPod Touch
http://sio2interactive.com
avatar
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 38
Location : Shanghai

View user profile http://sio2interactive.com

Back to top Go down

Re: VFP Math Lib

Post  Francescu on Tue May 12, 2009 6:32 pm

sio2interactive wrote:Yeah I've seen this but Im not getting dramatic FPS boost with -O3... Have you tried with a plain tutorial like tutorial06_1?

Im on iPod 2nd Gen, so maybe on iPhone -O3 really change something...
Not really - I'm on a 3G and I'm not seeing dramatic FPS boost with -03 - at least with my project. Bullet physics performance are still pretty much the same at runtime.

I'll try and provide numbers when I can

Francescu

Posts : 136
Join date : 2009-03-18

View user profile

Back to top Go down

Re: VFP Math Lib

Post  sio2interactive on Tue May 12, 2009 7:51 pm

Same here dude... Since I don't see no performance gain whatsoever im using -Os

_________________
SIO2 Interactive
Free Open Source 3D Game Engine for iPhone and iPod Touch
http://sio2interactive.com
avatar
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 38
Location : Shanghai

View user profile http://sio2interactive.com

Back to top Go down

Re: VFP Math Lib

Post  yarri on Tue May 12, 2009 9:17 pm

I see a +10 fps improvement in my game, which is somewhat based on Tutorial06_2. I commented on the issue in this thread:
http://sio2interactive.forumotion.net/sio2-engine-f3/28-fps-with-particle-system-added-to-tutorial06-t535.htm

Haven't tried it on plain tutorials.

--yarri

yarri

Posts : 81
Join date : 2009-04-10

View user profile

Back to top Go down

Re: VFP Math Lib

Post  Francescu on Fri Jun 12, 2009 2:36 pm

yarri wrote:John Owens posted his code for btMatrix3x3.h which uses vfpMath lib on the Oolong engine mailing list, and Erwin from the Bullet team is working to incorporate a fix into the next version. I haven't tried it. You can look at the source, here:
http://pastie.org/476292
--yarri
Has anyone tried this with SIO2 yet? I mean with an updated bullet (with John's btMatrix3x3.h) along with the vfpMath lib...

Francescu

Posts : 136
Join date : 2009-03-18

View user profile

Back to top Go down

Re: VFP Math Lib

Post  yarri on Fri Jun 12, 2009 4:44 pm

Yup, it works on the current devices. Although I only saw a 1 or 2fps increase with using the VFPlib on my 1st gen iPhone. In this thread you'll see the debate about the effectiveness of VFP versus compiling with -O3. I see a much bigger improvement with -O3 than VFP.

You should know that next gen iPhone 3GS will most likely use the Cortex-A8 with VFP3 and NEON:
http://www.arm.com/products/multimedia/neon/index.html
http://www.anandtech.com/gadgets/showdoc.aspx?i=3579

I'm not sure if the current VFPlib is forward compatible with VFP3, and so I'm *not* using VFPlib. My opinion may change once I try out the 3Gs!

--yarri

yarri

Posts : 81
Join date : 2009-04-10

View user profile

Back to top Go down

Re: VFP Math Lib

Post  Francescu on Fri Jun 12, 2009 4:56 pm

Thanks Yarri - very interesting.

I have to say I'm a bit surprised you did not notice much more improvement.

Of course it could be tied to how much bullet cpu power you application needed during your test runs.

Right now, I'm dealing with a severe bullet performance blocker with my application when there are more than 3-4 (convexhull but optimized with not many vertices) dynamic bodies active in the scene at the same time...Even when all of them are not colliding I'm seeing a huge FPS drop (7-9 fps) when physics (e.g. moving one of them) are involved until physics are not involved (back to 40fps)...Bullet takes into account all of the bodies in the scene even when some are not even in close vicinity... ;-( so this is affecting the CPU more than it should...I was hoping the bullet VFP changes could help and maybe it will but right now am a bit disheartened by this...

Cheers

Francescu

Posts : 136
Join date : 2009-03-18

View user profile

Back to top Go down

Re: VFP Math Lib

Post  Francescu on Fri Jun 12, 2009 8:17 pm

Well I think I'm going to go the route of dropping convexhull shapes for collision physics and instead go with an invisible primitive mesh shape (e.g. Cube, sphere, rectangle, etc) around the convexhull mesh which I will only use for rendering. Hopefully that should bring me back to some acceptable performance ;-)

I guess I need to go and play with some Parent->Child set-up in blender like in tutorial14...

Cheers

Francescu

Posts : 136
Join date : 2009-03-18

View user profile

Back to top Go down

Re: VFP Math Lib

Post  sio2interactive on Fri Jun 12, 2009 8:33 pm

That performance drop is really strange... Are you experiencing same performance drop on the device using tutorial06_1 and duplicating monkeys (triple click on them)?

Lemme know...

_________________
SIO2 Interactive
Free Open Source 3D Game Engine for iPhone and iPod Touch
http://sio2interactive.com
avatar
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 38
Location : Shanghai

View user profile http://sio2interactive.com

Back to top Go down

Re: VFP Math Lib

Post  Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum