fixed point in irrlicht?

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.

fixed point in irrlicht?

Postby huntersh2014 » Mon Jun 25, 2012 3:16 am

I am trying to port irrlicht to android platform, the port is done, but the fps on android is very low. I heard that replacing float point with fixed point could improve the performance on mobile platform. Anyone has experience on this? Thanks very much
huntersh2014
 
Posts: 12
Joined: Mon Mar 26, 2012 6:37 am

Re: fixed point in irrlicht?

Postby hybrid » Mon Jun 25, 2012 7:32 am

Which driver do you use? Best thing is to move most calculations to the GPU, which has FP support. Doing calculations in fixed point would mean that you have to find enough consecutive calculations that would make the initial and final conversions from and to floating point neglectable. So meaning to change a lot of the engine. And there have been many reports that Irrlicht on Android does work with decent FPS as well. So I guess the problem is elsewhere for you.
hybrid
Admin
 
Posts: 13979
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany

Re: fixed point in irrlicht?

Postby huntersh2014 » Mon Jun 25, 2012 12:09 pm

hybrid wrote:Which driver do you use? Best thing is to move most calculations to the GPU, which has FP support. Doing calculations in fixed point would mean that you have to find enough consecutive calculations that would make the initial and final conversions from and to floating point neglectable. So meaning to change a lot of the engine. And there have been many reports that Irrlicht on Android does work with decent FPS as well. So I guess the problem is elsewhere for you.



Yes, I see there're many posts talking about the irrlicht optimization on android, but seems no one mention which technology being used. So I just wonder the fixed point might be a good choice.

Yes, there are lots of things to do in the engine when swtiching from float point to fixed point. But I don't think we need to change all of floats, but just those key ones. I used intel vtune tool to find out operator + - and dotproduct in vector3d are the top 3 time consuming float compution functions. So I tried to use fixed point in these 3 function, but without luck,I even got performance downgrade - I think the reason of the downgrade is the overahead of fixed point, the right way should be convert float to fixed once and do the compuation for many times, but here converion is called for every single computation. but anyway I didn't find a good way to resolve it yet.
huntersh2014
 
Posts: 12
Joined: Mon Mar 26, 2012 6:37 am

Re: fixed point in irrlicht?

Postby hendu » Mon Jun 25, 2012 12:57 pm

Intel VTune, isn't that only on Intel-based Windows? Most ARM vendors have their own profiling toolchains with which you can profile on the actual device, those would give better stats, as with a PC profile you're just guessing what goes down on the device.

Also, many of the ARM profilers are able to profile the GPU too, which may prove useful.

edit: Most features of vtune requre Intel/windows, basic ones seem available for amd and linux too. Doesn't change the main point.
hendu
 
Posts: 1621
Joined: Sat Dec 18, 2010 12:53 pm

Re: fixed point in irrlicht?

Postby huntersh2014 » Mon Jun 25, 2012 2:49 pm

hendu wrote:Intel VTune, isn't that only on Intel-based Windows? Most ARM vendors have their own profiling toolchains with which you can profile on the actual device, those would give better stats, as with a PC profile you're just guessing what goes down on the device.

Also, many of the ARM profilers are able to profile the GPU too, which may prove useful.

edit: Most features of vtune requre Intel/windows, basic ones seem available for amd and linux too. Doesn't change the main point.



vtune doesn't matter too much here, the key thing is if replacing float point with fixed point is the right approach and how to do that
huntersh2014
 
Posts: 12
Joined: Mon Mar 26, 2012 6:37 am

Re: fixed point in irrlicht?

Postby CuteAlien » Mon Jun 25, 2012 3:44 pm

You could try replacing f32 and f64 by corresponding fixed-point classes. Can't help you much with that - it's been decades since I last worked with fixed-point math as optimization and my classes from back then probably sucked (I was learning c++ at the time). But in theory it sounds like that could work, although there are probably troubles (like if the sizes are not the same, so anything using sizeof would fail).

edit: Uhm, no - horrible idea. Will not work. As there are lots of places where we pass on f32 to system-functions expecting floats (for example opengl...).
IRC: #irrlicht on irc.freenode.net
My patches&stuff: http://www.michaelzeilfelder.de/irrlicht.htm
Games with Irrlicht: http://www.irrgheist.com/
News: http://www.reddit.com/r/irrlicht/
User avatar
CuteAlien
Admin
 
Posts: 5398
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany

Re: fixed point in irrlicht?

Postby hendu » Mon Jun 25, 2012 5:43 pm

The point is that you can't know if floats are the bottleneck by only testing on a PC.
hendu
 
Posts: 1621
Joined: Sat Dec 18, 2010 12:53 pm

Re: fixed point in irrlicht?

Postby huntersh2014 » Tue Jun 26, 2012 1:04 am

CuteAlien wrote:You could try replacing f32 and f64 by corresponding fixed-point classes. Can't help you much with that - it's been decades since I last worked with fixed-point math as optimization and my classes from back then probably sucked (I was learning c++ at the time). But in theory it sounds like that could work, although there are probably troubles (like if the sizes are not the same, so anything using sizeof would fail).

edit: Uhm, no - horrible idea. Will not work. As there are lots of places where we pass on f32 to system-functions expecting floats (for example opengl...).



I think you're pointing out the right thing. My original thought is also to replace f32 and f64 with some fixed-point classes, but I got so many build errors there and the most important thing is I am not sure if the rendering still works even get the build works - because I don't know where and when should we convert the fixed point back in the engine.
huntersh2014
 
Posts: 12
Joined: Mon Mar 26, 2012 6:37 am

Re: fixed point in irrlicht?

Postby huntersh2014 » Tue Jun 26, 2012 1:29 am

CuteAlien wrote:edit: Uhm, no - horrible idea. Will not work. As there are lots of places where we pass on f32 to system-functions expecting floats (for example opengl...).


this is also my concern, we need to convert the fixed point back on the right places, such as when passing f32 to opengl as you mentioned here. So it looks a horrible and complicate work to do if we want to replace f32 with some fixed point class for the whole engine.
huntersh2014
 
Posts: 12
Joined: Mon Mar 26, 2012 6:37 am


Return to Beginners Help

Who is online

Users browsing this forum: No registered users and 1 guest