Computer Science Department
School of Computer Science, Carnegie Mellon University


Slang – A Shader Compilation System
for Extensible, Real-time Shading

Yong He

Ph.D. Thesis

September 2018


Keywords: Shading languages, real-time rendering

A modern production renderer may contain tens of thousands of code that define a diverse palette of shading effects. These effects model visual phenomena such as the light-scattering properties of materials, the animation of surfaces, or complex lighting environments. To support productive maintenance of the renderer codebase and the frequent addition of new shading features, it is desirable to implement these shading effects in a flexible and extensible framework that intuitively models the key rendering concepts. Unfortunately, shading system designs that offer high development productivity have historically not met the extreme performance requirements of real-time graphics systems. This thesis consists of a series of contributions that together form a blueprint for architecting modular, extensible real-time shading systems that also achieve state-of-the-art performance on modern CPU/GPU platforms. First, we established a set of shading system design principles, called shader components, which serve as a design pattern for realizing both intuitive decompositions of the rendering concepts and performance-critical global optimizations such as static GPU code specialization and efficient CPU–GPU communication. Next, we designed the Slang shading language and compilation system to facilitate implementation of shader components without the need for engine-specific or heavily preprocessor-based code generation techniques. Slang extends HLSL with generalpurpose programming language mechanisms: generics with interface constraints, associated types, and interface/structure extensions, that we identify as necessary and sufficient language features for implementing modern shading systems. Last, we demonstrated how to rearchitect a large open source renderer using Slang's compiler services to adopt the shader components pattern. In this case study, we highlight the benefits of Slang’s design by observing that the resulting shading system is substantially easier to extend with new features and achieves higher rendering performance than the original HLSL-based implementation.

Thesis Committee:
Kayvon Fatahalian (Chair)
Jonathan Aldrich
Jim McCann
Tim Foley (Nvidia)

Srinivasan Seshan, Head, Computer Science Department
Andrew W. Moore, Dean, School of Computer Science

163 pages

Return to: SCS Technical Report Collection
School of Computer Science

This page maintained by