GLES2.0 3D Android game performance and multi threading the update?
- by Ofer
I have profiled my mixed Java\C++ Android game and I got the following result:
https://dl.dropbox.com/u/8025882/PompiDev/AndroidProfile.png
As you can see, the pink think is a C++ functions that updates the game. It does things like updating the logic but it mostly it generates a "request list" for rendering.
The thing is, I generate DrawLists on C++ and then send them to Java to process and draw using GLES2.0.
Since then I was able to improve update from 9ms down to about 7ms, but I would like to ask if I would benefit from multi threading the update?
As I understand from that diagram is that the function that takes the most time is the one you see it's color on the timeline. So the pink area is taken mostly by update. The other area has MainOpenGL.Handle as it's main contributor(whch is my java function), but since it's not drawn to the top of the diagram I can conclude other things are happening at the same time that use the CPU? Or even GPU stuff that isn't shown in this diagram.
I am not sure how the GPU works on this. Does it calculate stuff in parallel to the CPU? Or is it part of the CPU usage as in SoC? I am not sure.
Anyway, in case GPU things DO happen in parallel to CPU, then I would guess that if I do this C++ Update in parallel to the thread that makes the OpenGL calls, I might make use of "dead CPU time" due to GPU stalling or maybe have the GPU calls getting processed earlier because it won't have to wait for Update to finish?
How do you suggest to improve performance based on that?
Thanks.