“Staged metaprogramming for shader system development” by Seitz, Foley, Porumbescu and Owens – ACM SIGGRAPH HISTORY ARCHIVES

“Staged metaprogramming for shader system development” by Seitz, Foley, Porumbescu and Owens

  • 2019 SA Technical Papers_Seitz_Staged metaprogramming for shader system development

Conference:


Type(s):


Title:

    Staged metaprogramming for shader system development

Session/Category Title:   Watch Your Language


Presenter(s)/Author(s):


Moderator(s):



Abstract:


    The shader system for a modern game engine comprises much more than just compilation of source code to executable kernels. Shaders must also be exposed to art tools, interfaced with engine code, and specialized for performance. Engines typically address each of these tasks in an ad hoc fashion, without a unifying abstraction. The alternative of developing a more powerful compiler framework is prohibitive for most engines.In this paper, we identify staged metaprogramming as a unifying abstraction and implementation strategy to develop a powerful shader system with modest effort. By using a multi-stage language to perform metaprogramming at compile time, engine-specific code can consume, analyze, transform, and generate shader code that will execute at runtime. Staged metaprogramming reduces the effort required to implement a shader system that provides earlier error detection, avoids repeat declarations of shader parameters, and explores opportunities to improve performance.To demonstrate the value of this approach, we design and implement a shader system, called Selos, built using staged metaprogramming. In our system, shader and application code are written in the same language and can share types and functions. We implement a design space exploration framework for Selos that investigates static versus dynamic composition of shader features, exploring the impact of shader specialization in a deferred renderer. Staged metaprogramming allows Selos to provide compelling features with a simple implementation.

References:


    1. Johan Andersson. 2011. DirectX 11 Rendering in Battlefield 3. Game Developers Conference 2011. http://www.dice.se/news/directx-11-rendering-battlefield-3/Google Scholar
    2. Alan Bawden and Jonathan Rees. 1988. Syntactic Closures. In Proceedings of the 1988 ACM Conference on LISP and Functional Programming (LFP ’88). 86–95. Google ScholarDigital Library
    3. Sean Baxter. 2019. Circle. https://github.com/seanbaxter/circleGoogle Scholar
    4. Nir Benty, Kai-Hwa Yao, Tim Foley, Matthew Oakes, Conor Lavelle, and Chris Wyman. 2018. The Falcor Rendering Framework. https://github.com/NVIDIAGameWorks/Falcor https://github.com/NVIDIAGameWorks/Falcor.Google Scholar
    5. David Blythe. 2006. The Direct3D 10 System. ACM Transactions on Graphics 25, 3 (July 2006), 724–734. Google ScholarDigital Library
    6. Cristiano Calcagno, Walid Taha, Liwen Huang, and Xavier Leroy. 2003. Implementing Multi-stage Languages Using ASTs, Gensym, and Reflection. In Proceedings of the 2nd International Conference on Generative Programming and Component Engineering (GPCE ’03). 57–76. Google ScholarCross Ref
    7. Shigeru Chiba. 1995. A Metaobject Protocol for C++. In Proceedings of the Tenth Annual Conference on Object-oriented Programming Systems, Languages, and Applications (OOPSLA ’95). 285–299. Google ScholarDigital Library
    8. Matus Chochlik, Axel Naumann, and David Sankel. 2018. Static reflection. C++ Standards Committee Papers. http://wg21.link/p0194Google Scholar
    9. Petrik Clarberg and Jacob Munkberg. 2014. Deep Shading Buffers on Commodity GPUs. ACM Transactions on Graphics 33, 6, Article 227 (Nov. 2014), 12 pages. Google ScholarDigital Library
    10. Robert L. Cook. 1984. Shade Trees. In Computer Graphics (Proceedings of SIGGRAPH 84). 223–231.Google Scholar
    11. Russ Cox, Tom Bergan, Austin T. Clements, Frans Kaashoek, and Eddie Kohler. 2008. Xoc, an Extension-oriented Compiler for Systems Programming. In Proceedings of the 13th International Conference on Architectural Support for Programming Languages and Operating Systems (ASPLOS XIII). 244–254. Google ScholarDigital Library
    12. Zachary DeVito, James Hegarty, Alex Aiken, Pat Hanrahan, and Jan Vitek. 2013. Terra: A Multi-Stage Language for High-Performance Computing. In Proceedings of the 34th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI ’13). 105–116. Google ScholarDigital Library
    13. Ramy El Garawany. 2016. Advances in Real-time Rendering, Part I: Deferred Lighting in Uncharted 4. In ACM SIGGRAPH 2016 Courses (SIGGRAPH ’16). http://advances.realtimerendering.com/s2016/index.htmlGoogle Scholar
    14. Conal Elliott. 2004. Programming Graphics Processors Functionally. In Proceedings of the 2004 ACM SIGPLAN Workshop on Haskell (Haskell ’04). 45–56. Google ScholarDigital Library
    15. Dawson R. Engler, Wilson C. Hsieh, and M. Frans Kaashoek. 1996. ‘C: A Language for High-level, Efficient, and Machine-independent Dynamic Code Generation. In Proceedings of the 23rd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL ’96). 131–144. Google ScholarDigital Library
    16. Epic Games. 2017. Unreal Engine Sun Temple, Open Research Content Archive (ORCA). https://developer.nvidia.com/ue4-sun-templeGoogle Scholar
    17. Epic Games, Inc. 2019. Unreal Engine 4 Documentation. https://docs.unrealengine.com/en-us/Google Scholar
    18. Matthew Flatt. 2002. Composable and Compilable Macros: You Want It When?. In Proceedings of the Seventh ACM SIGPLAN International Conference on Functional Programming (ICFP ’02). 72–83. Google ScholarDigital Library
    19. Tim Foley and Pat Hanrahan. 2011. Spark: Modular, Composable Shaders for Graphics Hardware. ACM Transactions on Graphics 30, 4 (July 2011), 107:1–107:12. Google ScholarDigital Library
    20. Yoshihiko Futamura. 1982. Partial Computation of Programs. In RIMS Symposium on Software Science and Engineering, Kyoto, Japan, 1982, Proceedings. 1–35. Google ScholarCross Ref
    21. Romain Guy and Mathias Agopian. 2019. Filament. https://github.com/google/filament https://github.com/google/filament.Google Scholar
    22. Pat Hanrahan and Jim Lawson. 1990. A Language for Shading and Lighting Calculations. In Computer Graphics (Proceedings of SIGGRAPH 90). 289–298.Google Scholar
    23. Yong He, Kayvon Fatahalian, and Tim Foley. 2018. Slang: Language Mechanisms for Extensible Real-time Shading Systems. ACM Transactions on Graphics 37, 4, Article 141 (July 2018), 13 pages. Google ScholarDigital Library
    24. Yong He, Tim Foley, and Kayvon Fatahalian. 2016. A System for Rapid Exploration of Shader Optimization Choices. ACM Transactions on Graphics 35, 4, Article 112 (July 2016), 12 pages. Google ScholarDigital Library
    25. Roberto Ierusalimschy, Luiz Henrique de Figueiredo, and Waldemar Celes Filho. 1996. Lua—An Extensible Extension Language. Software: Practice and Experience 26, 6 (June 1996), 635–652. <635::AID-SPE26>3.0.CO;2-P Google ScholarCross Ref
    26. John Kessenich and Boaz Ouriel. 2018. SPIR-V Specification (Version 1.00). https://www.khronos.org/registry/spir-v/specs/1.0/SPIRV.pdf.Google Scholar
    27. Khronos Group. 2016. Vulkan 1.0.12 – A Specification. https://www.khronos.org/registry/vulkan/specs/1.0/pdf/vkspec.pdf.Google Scholar
    28. Calle Lejdfors and Lennart Ohlsson. 2004. PyFX – An active effect framework. In Proceedings of SIGRAD 2004. Linköping University Electronic Press, 17–24. http://www.ep.liu.se/ecp/article.asp?issue=013&article=006Google Scholar
    29. Ronan Marchalot. 2018. Cluster Forward Rendering and Anti-Aliasing in ‘Detroit: Become Human’. Game Developers Conference 2018. https://www.gdcvault.com/play/1025420/Cluster-Forward-Rendering-and-AntiGoogle Scholar
    30. Stephen McAuley. 2018. Advances in Real-time Rendering in Games, Part I: The Challenges of Rendering an Open World in Far Cry 5. In ACM SIGGRAPH 2018 Courses (SIGGRAPH ’18). ACM. http://advances.realtimerendering.com/s2018/index.htmGoogle Scholar
    31. John McCarthy. 1960. Recursive Functions of Symbolic Expressions and Their Computation by Machine, Part I. Commun. ACM 3, 4 (April 1960), 184–195. Google ScholarDigital Library
    32. 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
    33. Morgan McGuire, George Stathis, Hanspeter Pfister, and Shriram Krishnamurthi. 2006. Abstract Shade Trees. In Proceedings of the 2006 Symposium on Interactive 3D Graphics and Games (I3D ’06). 79–86. Google ScholarDigital Library
    34. Microsoft. 2010. Effect Format (Direct3D 11). (2010). https://msdn.microsoft.com/en-us/library/windows/desktop/ff476118(v=vs.85).aspx.Google Scholar
    35. Microsoft. 2017. Direct3D 12 Programming Guide. https://docs.microsoft.com/en-us/windows/desktop/direct3d12/directx-12-programming-guideGoogle Scholar
    36. Microsoft. 2019. DirectX Shader Compiler. https://github.com/Microsoft/DirectXShaderCompiler https://github.com/Microsoft/DirectXShaderCompiler.Google Scholar
    37. NVIDIA Corporation. 2007. NVIDIA CUDA Compute Unified Device Architecture Programming Guide. (Jan. 2007). http://developer.nvidia.com/cuda.Google Scholar
    38. NVIDIA Corporation. 2010. Introduction to CgFX. (2010). http://http.developer.nvidia.com/CgTutorial/cg_tutorial_chapter01.html.Google Scholar
    39. Arsène Pérard-Gayot, Richard Membarth, Roland Leißa, Sebastian Hack, and Philipp Slusallek. 2019. Rodent: Generating Renderers without Writing a Generator. In ACM Transactions on Graphics (TOG), Vol. 38. 40:1–40:12. Google ScholarDigital Library
    40. Aras Pranckevičius. 2013. HLSL to GLSL shader language translator. https://github.com/aras-p/hlsl2glslforkGoogle Scholar
    41. Aras Pranckevičius. 2016. Personal Communication.Google Scholar
    42. 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 2001. 159–170. Google ScholarDigital Library
    43. Rust Project Developers. 2015. The Rust Programming Language. https://doc.rustlang.org/book/.Google Scholar
    44. Adrian Sampson, Kathryn S. McKinley, and Todd Mytkowicz. 2017. Static Stages for Heterogeneous Programming. Proceedings of the ACM on Programming Languages 1, OOPSLA, Article 71 (Oct. 2017), 27 pages. Google ScholarDigital Library
    45. Mark Segal, Kurt Akeley, Chris Frazier, Jon Leech, and Pat Brown. 2015. The OpenGL© Graphics System: A Specification (Version 4.5 (Core Profile) – May 28, 2015). https://www.opengl.org/registry/doc/glspec45.core.pdf.Google Scholar
    46. Tiago Sousa and Jean Geffroy. 2016. Advances in Real-time Rendering, Part II: The Devil is in the Details: idTech 666. In ACM SIGGRAPH 2016 Courses (SIGGRAPH ’16). http://advances.realtimerendering.com/s2016/index.htmlGoogle Scholar
    47. Gerald Jay Sussman and Guy L. Steele, Jr. 1998. Scheme: A Interpreter for Extended Lambda Calculus. Higher-Order and Symbolic Computation 11, 4 (Dec. 1998), 405–439. Google ScholarDigital Library
    48. Herb Sutter. 2018. Metaclasses: Generative C++. C++ Standards Committee Papers. https://wg21.link/P0707Google Scholar
    49. Walid Taha and Tim Sheard. 2000. MetaML and multi-stage programming with explicit annotations. Theoretical Computer Science 248, 1–2 (Oct. 2000), 211–242. Google ScholarDigital Library
    50. Walid Mohamed Taha. 1999. Multistage Programming: Its Theory and Applications. Ph.D. Dissertation. Oregon Graduate Institute of Science and Technology.Google Scholar
    51. Natalya Tatarchuk and Chris Tchou. 2017. Destiny Shader Pipeline. Game Developers Conference 2017. http://advances.realtimerendering.com/destiny/gdc_2017/Google Scholar
    52. Unity Technologies. 2019. Unity User Manual (2019.1). https://docs.unity3d.com/Manual/index.htmlGoogle Scholar
    53. Daveed Vandevoorde and Louis Dionne. 2017. Exploring the design space of metaprogramming and reflection. C++ Standards Committee Papers. https://wg21.link/P0633Google Scholar


ACM Digital Library Publication:



Overview Page:



Submit a story:

If you would like to submit a story about this presentation, please contact us: historyarchives@siggraph.org