Author:http://www.cnblogs.com/open-coder/p/3898224.html
This is a short tutorial on how to does frame capture with Nvidia Prefhud. You could find a detail tutorial from here.
Before frame capture, some requirement should be fullfilled:
1) OpenGL ES 2.0 at least!
2) Internet permission required. <uses-permission android:name= "Android.permission.INTERNET" ></uses-permission>
3) Tegra 4.0 at least device.
4) must be Nvidia Android adb. You'll failed using other ADB version, Nvidia Android adb requried, no exception.
5) Before Run app, type following under command line:
ADB shell SetProp debug.perfhudes 1
The following is some screen shots that I frame captured "Shadowgun":
With Prefhud ES Frame Capture, you could find the bottle neck and find the optimaztion direction:
1) How many trianges would be drawn within one frame:whether we need to reduce the scene trianges or character traingles;
2) which one draw call cost the longgest time, is it reasonable? Too many traingles? Too complicated shader? Vertex shader or fragment shader? Can Some shader operations could be do in application code?
Can We move some operation from fragment shader to vertex shader? Use vertex lighting instead of pixel shader light? Precalcualte the result and save to the texture?
3) Too Many objects overlap draw with each other? Enable occlusion culling could fix this problem well.
4) Too Many draw calls? Batch the objects with the same material and Atlas texture.
5) Too much textures? Reduce texture size, use small texture to tiling instead of big texture to blend. Use Bilinear filter mode would be much faster than trilinear filter mode.
6) Reduce ' glclear ' calls, it'll depends on the device, some device would consume much time with ' glclear '. Generally, we could only clear depth buffer would work. One time for main scene, and the other one for HUD.
7) Avoid use complicated and switch statement in the shader. Later some super shader would support those feature well, but well those features is not supported well currently.
8) by Ingore the whole render loop, and check the FPS. You could figure out whether the game is CPU bind and GPU bind.
9) LOD for scene objects.
Batch some small objects. Seperate some big objects into smaller one, let view volume to cull them.
One) Above method would opimize under low level. If you had a good level design, you could save a lot of FPS. Set up a door between a indoor area and outdoor area? Seperate the outdoor area with some view occlusion objects and equipments?
......