Tuesday, March 15, 2005

Unicon, OpenGL and Compilers

So, I'm only on the Unicon project as a volunteer right now (IE I'm not actually doing anything). However, before downgrading myself (more on that later) I noticed a number of interesting parallels between computer graphics optimizations and compiler optimizations.

One big thing that the Unicon 3D graphics facilities does is create a display list of everything that you have commited to the scene. Everytime something changes (the camera moves, some animation occurs, new objects are placed in the scene) this display list is processed from front to back; automatically redrawing the scene for you.

It's convient and definitely not something that OpenGL does for you. However, calls placed to GLBegin() and GLEnd() (which are analogous to C's scoping facilities: '{' and '}') aren't, to the best of my knowledge, free. Hence, good programmers try to draw all of their triangles/quads/lines/etc at once. The afforementioned Unicon display list is obviously temporaly ordered. This likely creates instances where numerous display list elements could be combined together inside of one set of GLBegin and GLEnd.

Unfortunately, textures, materials, recursive drawing routines, et cetera make the problem unsolvable by simply combining list elements that use identical drawing primitives. It finds itself relatively analogous to the out-of-order-execution problem that Intel tried to hoist on compiler writers with the IA-64 (Itanium) architecture.

I really wish that my compiler course had covered optimizations, we only covered correctness, and a little bit of context sensitive error reporting.

0 Comments:

Post a Comment

<< Home