When standard KGL just isn't fast enough for your needs it's time to summon the forces of Direct Render. Direct Render, from this point forward referred to as DR, lets you mix the convenience features of KGL with a number of macros and glKOS functions. When used properly you can expect get 3 to 4 times more polys per frame than KGL alone.
The peformace impact of DR methods are so great that the techniques have been applied to the core KGL drawing functions for a nice performance boost. Some benchmarks taken before and after the conversion are posted below. GL_TRIANGLES were used since they are easy to draw and are the least efficient way draw objects, so any improvements in terms of polygons per second (pps) are pretty impressive. The raw PVR benckmarks are even more impressive.
KGL GL_TRIANGLES (trimark): Before conversion to DR
Beginning new test: 1013 polys per frame (60780 per second at 60fps)
Average Frame Rate: 59.356900 fps (60128 pps)
Entering PHASE_FINAL
Average Frame Rate: 60.924400 fps (61716 pps)
Average Frame Rate: 59.356900 fps (60128 pps)
Average Frame Rate: 61.187100 fps (61982 pps)
Average Frame Rate: 59.875900 fps (60654 pps)
Average Frame Rate: 61.186900 fps (61982 pps)
KGL GL_TRIANGLES (trimark): After conversion to DRThe raw PVR benchmarks for triangles are even more impressive. These benchmarks are from the pvrmark and pvrmark_strip test programs.
Beginning new test: 3125 polys per frame (187500 per second at 60fps)
Average Frame Rate: 59.873900 fps (187106 pps)
Entering PHASE_FINAL
Average Frame Rate: 60.928600 fps (190401 pps)
Average Frame Rate: 60.924800 fps (190390 pps)
Average Frame Rate: 59.349700 fps (185468 pps)
Average Frame Rate: 59.995800 fps (187487 pps)
Average Frame Rate: 59.875900 fps (187112 pps)
PVR pvrmark test:The DCPVR2 can draw long triangles strips even more efficiently.
Beginning new test: 6466 polys per frame (387960 per second at 60fps)
Average Frame Rate: 59.890300 fps (387251 pps)
Entering PHASE_FINAL
Average Frame Rate: 61.187100 fps (395635 pps)
Average Frame Rate: 59.875900 fps (387158 pps)
Average Frame Rate: 59.873900 fps (387145 pps)
Average Frame Rate: 60.927500 fps (393957 pps)
Average Frame Rate: 59.414400 fps (384173 pps)
PVR pvrmark_strips test:You're probably sick of benchmarks but I have to show you the results of the pure PVR API in action. This is the output of the pvrmark_strips_direct program:
Beginning new test: 12433 polys per frame (745980 per second at 60fps)
Average Frame Rate: 57.953400 fps (720535 pps)
Entering PHASE_FINAL
Average Frame Rate: 55.270300 fps (687176 pps)
Average Frame Rate: 59.290100 fps (737154 pps)
Average Frame Rate: 59.004700 fps (733606 pps)
Average Frame Rate: 60.719300 fps (754923 pps)
Average Frame Rate: 58.388400 fps (725943 pps)
PVR pvrmark_strips_direct test:These PVR benchmark test programs were used in the development of the Direct Render methods, macros, and glKos functions described in this chapter. We owe this all the Dan Potters' desire to put 6 transparent spheres on the screen at once. DR can do far more then that. In the words of the wizard himself in response to a question about the GL_TRIANGLE benchmarks:
Beginning new test: 40233 polys per frame (2413980 per second at 60fps)
Average Frame Rate: 59.414300 fps (2390419 pps)
Entering PHASE_FINAL
Average Frame Rate: 60.924800 fps (2451190 pps
Average Frame Rate: 59.414300 fps (2390419 pps)
Average Frame Rate: 59.348800 fps (2387782 pps)
Average Frame Rate: 59.890300 fps (2409568 pps)
Average Frame Rate: 59.348800 fps (2387782 pps)
1) Every extra amount of time that you spend transmitting polygons to the TA for rendering is less time you have available for doing things like playing background music, updating AI, etc. So the faster we can make this, the better. That's why I started the whole DR thing anyway - I could have made my graphics stuff fast enough without it, but wouldn't have had any time left over for anything else. Plus if you have extra polys left over then you can go about improving the visual quality of the effects.
2) It's a lot easier to rack up tons of polygons than you might think. For example, if you have a spaceship with 100 quads in it (not very many, let me tell you! =) and you have 10 of them on screen, that's about a fifth of the available time there if you did nothing else.