Even with the continuing downturn in the economy, one market segment, which continues to thrive, is the entertainment market. The games market has now even surpassed the film industry's profits. Existing general-purpose processors have been steadily extended (SSE, 3Dnow, and Altivec) to better support the game industry. Custom graphics processors or GPUs have been available for a few years now and these graphics processors are slowly evolving to generalized stream processors. Recently, Microsoft, and 3D Labs (Open GL ARB) have developed virtual execution environments to abstract the underlying graphics processors. Additionally new languages including Cg, HLSL, and GLSlang have been developed to target these graphics virtual machines.
The objective of this demonstration is to illustrate the issues involved in targeting graphics processors. I will start with a concrete example of a high-end film style "special effect" and then illustrate how it can be written in both Pixar's Renderman Shading Language and Nvidia's Cg. I will then disassemble the code and illustrate how the Cg compiler generates vertex and pixel "shader" assembly language. Using the "special effect" as an example, how the domain specific "shading language" constructs are mapped to the underlying GPU data types and instructions will be explained in depth. Additionally, I plan to discuss what underlying hardware mechanisms are needed in the GPU instruction set in order to add object-oriented constructs to shading languages. Finally, I will conclude with a discussion on targeting object-oriented virtual machine technologies such as the JVM, Squeak and the CLI to graphics processors.