Dynamic Code Generation for Realtime Shaders
Niklas Folkegård, Daniel Wesslén · 2004
Programming real time graphics has been made more efficient by introducing high level shading languages such as Cg and GLSL. Writing shader programs can be redundant since the same functions appear in many shaders. This article suggests a method to combine single functions and create compound shaders in runtime. Redundancy is avoided by dividing programs into smaller, reusable parts. An algorithm is presented for joining these parts into working shaders based on just a few parameters.