“Shader components: modular and high performance shader development”

  • ©Yong He, Tim Foley, Teguh Hofstee, Haomin Long, and Kayvon Fatahalian




    Shader components: modular and high performance shader development

Session/Category Title:   Rendering Systems




    Modern game engines seek to balance the conflicting goals of high rendering performance and productive software development. To improve CPU performance, the most recent generation of real-time graphics APIs provide new primitives for performing efficient batch updates to shader parameters. However, modern game engines featuring large shader codebases have struggled to take advantage of these benefits. The problem is that even though shader parameters can be organized into efficient modules bound to the pipeline at various frequencies, modern shading languages lack corresponding primitives to organize shader logic (requiring these parameters) into modules as well. The result is that complex shaders are typically compiled to use a monolithic block of parameters, defeating the design, and performance benefits, of the new parameter binding API. In this paper we propose to resolve this mismatch by introducing shader components, a first-class unit of modularity in a shader program that encapsulates a unit of shader logic and the parameters that must be bound when that logic is in use. We show that by building sophisticated shaders out of components, we can retain essential aspects of performance (static specialization of the shader logic in use and efficient update of parameters at component granularity) while maintaining the modular shader code structure that is desirable in today’s high-end game engines.


    1. Amazon. 2016. Lumberyard Engine. https://aws.amazon.com/lumberyard/. (2016).Google Scholar
    2. David Blythe. 2006. The Direct3D 10 System. ACM Transactions on Graphics 25, 3 (July 2006), 724–734. Google ScholarDigital Library
    3. Eric Bruneton and Fabrice Neyret. 2008. Precomputed Atmospheric Scattering. Computer Graphics Forum (2008). Google ScholarDigital Library
    4. Woflgang F. Engel. 2006. Cascaded Shadow Maps. In ShaderX5 – Advanced Rendering Techniques, Woflgang F. Engel (Ed.). Boston, Massachusetts, Chapter 4, 197–206.Google Scholar
    5. Epic Games. 2015. Unreal Engine 4 Documentation. http://docs.unrealengine.com. (2015).Google Scholar
    6. Tim Foley and Pat Hanrahan. 2011. Spark: Modular, Composable Shaders for Graphics Hardware. ACM Trans. Graph. 30, 4, Article 107 (July 2011), 12 pages.Google ScholarDigital Library
    7. Pat Hanrahan and Jim Lawson. 1990. A Language for Shading and Lighting Calculations. SIGGRAPH Comput. Graph. 24, 4 (Sept. 1990), 289–298. Google ScholarDigital Library
    8. Yong He, Tim Foley, and Kayvon Fatahalian. 2016. A System for Rapid Exploration of Shader Optimization Choices. ACM Trans. Graph. 35, 4, Article 112 (July 2016), 12 pages.Google ScholarDigital Library
    9. Brian Karis. 2013. Real Shading in Unreal Engine 4. In SIGGRAPH 2013 Course Notes: Physically Based Shading in Theory and Practice. http://blog.selfshadow.com/publications/s2013-shading-course/.Google Scholar
    10. John Kessenich, Dave Baldwin, and Randi Rost. 2014. The OpenGL© Shading Language (Version 4.50). https://www.opengl.org/registry/doc/GLSLangSpec4.50.pdf.Google Scholar
    11. John Kessenich, Boaz Ouriel, and Raun Krisch. 2016. SPIR-V Specification Provisional (Version 1.1, Revision 4). https://www.khronos.org/registry/spir-v/specs/1.1/SPIRV.pdf.Google Scholar
    12. Khronos Group, Inc. 2009. ARB_shader_subroutine. https://www.opengl.org/registry/specs/ARB/shader_subroutine.txt. (2009).Google Scholar
    13. Khronos Group, Inc. 2016. Vulkan 1.0.38 Specification.Google Scholar
    14. William R. Mark, R. Steven Glanville, Kurt Akeley, and Mark J. Kilgard. 2003. Cg: A System for Programming Graphics Hardware in a C-like Language. ACM Trans. Graph. 22, 3 (July 2003), 896–907. Google ScholarDigital Library
    15. Michael D. McCool and Stefanus Du Toit. 2004. Metaprogramming GPUs with Sh. A K Peters. I-XVII, 1–290 pages.Google Scholar
    16. Michael D. McCool, Zheng Qin, and Tiberiu S. Popa. 2002. Shader Metaprogramming. In Proceedings of the ACM SIGGRAPH/EUROGRAPHICS Conference on Graphics Hardware (HWWS ’02). 57–68. http://dl.acm.org/citation.cfm?id=569046.569055Google ScholarDigital Library
    17. John McDonald. 2016. High Performance Vulkan: Lessons Learned from Source 2. In GPU Technology Conference 2016 (GTC). http://on-demand.gputechconf.com/gtc/2016/events/vulkanday/High_Performance_Vulkan.pdf.Google Scholar
    18. Microsoft. 2011. Interfaces and Classes. https://msdn.microsoft.com/en-us/library/windows/desktop/ff471421.aspx. (2011).Google Scholar
    19. Microsoft. 2017. Direct3D 12 Programming Guide. https://msdn.microsoft.com/en-us/library/windows/desktop/dn899121(v=vs.85).aspx. (2017).Google Scholar
    20. Matt Pharr. 2004. An Introduction to Shader Interfaces. In GPU Gems: Programming Techniques, Tips and Tricks for Real-Time Graphics, Randima Fernando (Ed.). Pearson Higher Education.Google Scholar
    21. Aras Pranckevičius. 2015. Porting Unity to new APIs. In SIGGRAPH 2015 Course Notes: An Overview of Next-generation Graphics APIs. http://nextgenapis.realtimerendering.com/presentations/7_Pranckevicius_Unity.pptx. Google ScholarDigital Library
    22. Kekoa Proudfoot, William R. Mark, Svetoslav Tzvetkov, and Pat Hanrahan. 2001. A Real-Time Procedural Shading System for Programmable Graphics Hardware. In Proceedings of SIGGRAPH 01, Annual Conference Series. ACM, New York, NY, USA, 159–170. Google ScholarDigital Library
    23. Natalya Tatarchuk. 2006. Dynamic Parallax Occlusion Mapping with Approximate Soft Shadows. In Proceedings of the 2006 Symposium on Interactive 3D Graphics and Games (I3D ’06). ACM, New York, NY, USA, 63–69. Google ScholarDigital Library
    24. Alex Vlachos, Jörg Peters, Chas Boyd, and Jason L. Mitchell. 2001. Curved PN Triangles. In Proceedings of the 2001 Symposium on Interactive 3D Graphics (I3D ’01). ACM, New York, NY, USA, 159–166. Google ScholarDigital Library

ACM Digital Library Publication:

Overview Page: