Spark: Modular, Composable Shaders for Graphics Hardware

Published:08/07/2011   Last Updated:08/07/2011

By Tim Foley1,2, Pat Hanrahan2
1Intel Corporation, 2Stanford University

In creating complex real-time shaders, programmers should be able to decompose code into independent, localized modules of their choosing. Current real-time shading languages, however, enforce a fixed decomposition into per-pipeline-stage procedures. Program concerns at other scales - including those that cross-cut multiple pipeline stages - cannot be expressed as reusable modules.

We present a shading language, Spark, and its implementation for modern graphics hardware that improves support for separation of concerns into modules. A Spark shader class can encapsulate code that maps to more than one pipeline stage, and can be extended and composed using object-oriented inheritance. In our tests, shaders written in Spark achieve performance within 2% of HLSL.

Read the SIGGRAPH paper: Spark: Modular, Composable Shaders for Graphics Hardware [PDF 3.1 MB]

Download the source code:* [ZIP 36.3 MB];

Presented at: ACM SIGGRAPH 2011, Vancouver, B.C. Canada

Spark: Modular, Composable Shaders for Graphics Hardware. Tim Foley, Pat Hanrahan. In ACM Transactions on  Graphics (SIGGRRAPH 2011 Proceedings). Volume 30, Issue 4, Article 107. 2011.

Additional Resources

View all Rendering Research publications

*This software is subject to the U.S. Export Administration Regulations and other U.S. law, and may not be exported or re-exported to certain countries (Burma, Cuba, Iran, North Korea, Sudan, and Syria) or to persons or entities prohibited from receiving U.S. exports (including Denied Parties, Specially Designated Nationals, and entities on the Bureau of Export Administration Entity List or involved with missile technology or nuclear, chemical or biological weapons).

Product and Performance Information


Performance varies by use, configuration and other factors. Learn more at