AnySL: Efficient and Portable Shading for Ray Tracing
Karrenberg, Ralf; Rubinstein, Dmitri; Slusallek, Philipp; Hack, Sebastian
While a number of different shading languages have been developed, their efficient integration into an existing renderer is notoriously difficult, often boiling down to implementing an entire compiler toolchain for each language. Furthermore, no shading language is broadly supported across the variety of rendering systems. AnySL attacks this issue from multiple directions: We compile shaders from different languages into a common, portable representation, which uses subroutine threaded code: Every language operator is translated to a function call. Thus, the compiled shader is generic with respect to the used types and operators. The key component of our system is an embedded compiler that instantiates this generic code in terms of the renderer’s native types and operations. It allows for flexible code transformations to match the internal structure of the renderer and eliminates all overhead due to the subroutine threaded code. For SIMD architectures we automatically perform vectorization of scalar shaders which speeds up rendering by a factor of 3.9 on average on SSE. The results are highly optimized, parallel shaders that operate directly on the internal data structures of a renderer. We show that both traditional shading languages such as RenderMan, but also C/C++-based shading languages, can be fully supported and deliver high performance across different CPU renderers.
In Proceedings of the Conference on High Performance Graphics (HPG), pp. 97-105, Saarbrücken, Germany, June 25-27, 2010