Let's Fix OpenGL

Author Adrian Sampson

Thumbnail PDF


  • Filesize: 443 kB
  • 12 pages

Document Identifiers

Author Details

Adrian Sampson

Cite AsGet BibTex

Adrian Sampson. Let's Fix OpenGL. In 2nd Summit on Advances in Programming Languages (SNAPL 2017). Leibniz International Proceedings in Informatics (LIPIcs), Volume 71, pp. 14:1-14:12, Schloss Dagstuhl – Leibniz-Zentrum für Informatik (2017)


From windowing systems to virtual reality, real-time graphics code is ubiquitous. Programming models for constructing graphics software, however, have largely escaped the attention of programming languages researchers. This essay introduces the programming model of OpenGL, a ubiquitous API for real-time graphics applications, for a language-oriented audience. It highlights six broad problems with the programming model and connects them to traditions in PL research. The issues range from classic pitfalls, where established thinking can apply, to new open problems, where novel research is needed.
  • language design
  • real-time graphics
  • OpenGL
  • GPUs
  • heterogeneity


  • Access Statistics
  • Total Accesses (updated on a weekly basis)
    PDF Downloads


  1. Apple. Metal shading language specification, version 1.2. URL: https://developer.apple.com/metal/metal-shading-language-specification.pdf.
  2. Chad Austin and Dirk Reiners. Renaissance: A functional shading language. In ACM SIGGRAPH/EUROGRAPHICS Conference on Graphics Hardware, 2005. Google Scholar
  3. Baggers. Varjo: Lisp to GLSL language translator. URL: https://github.com/cbaggers/varjo.
  4. Daniel W. Barowy, Charlie Curtsinger, Emery D. Berger, and Andrew McGregor. AutoMan: A platform for integrating human-based and digital computation. In ACM Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA), 2012. Google Scholar
  5. Tobias Bexelius. GPipe. URL: http://hackage.haskell.org/package/GPipe.
  6. Kovas Boguta. Gamma. URL: https://github.com/kovasb/gamma.
  7. Brett Boston, Adrian Sampson, Dan Grossman, and Luis Ceze. Probability type inference for flexible approximate programming. In ACM Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA), 2015. Google Scholar
  8. William J. Bowman, Swaha Miller, Vincent St-Amour, and R. Kent Dybvig. Profile-guided meta-programming. In ACM Conference on Programming Language Design and Implementation (PLDI), 2015. Google Scholar
  9. Michael Carbin, Sasa Misailovic, and Martin Rinard. Verifying quantitative reliability of programs that execute on unreliable hardware. In ACM Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA), 2013. Google Scholar
  10. Advanced Micro Devices. Mantle programming guide and API reference 1.0. URL: https://www.amd.com/Documents/Mantle-Programming-Guide-and-API-Reference.pdf.
  11. Alastair F. Donaldson. Crashes, hangs and crazy images by adding zero. Medium, November 2016. URL: https://medium.com/@afd_icl/689d15ce922b.
  12. Alastair F. Donaldson and Andrei Lascu. Metamorphic testing for (graphics) compilers. In Workshop on Metamorphic Testing (MET), 2016. Google Scholar
  13. Conal Elliott. Programming graphics processors functionally. In Haskell Workshop, 2004. Google Scholar
  14. Nicolas Feltman, Carlo Angiuli, Umut A. Acar, and Kayvon Fatahalian. Automatically splitting a two-stage lambda calculus. In European Symposium on Programming (ESOP), 2016. Google Scholar
  15. Matthew Flatt. Composable and compilable macros: You want it when? In ACM SIGPLAN International Conference on Functional Programming (ICFP), 2002. Google Scholar
  16. Tim Foley and Pat Hanrahan. Spark: Modular, composable shaders for graphics hardware. In SIGGRAPH, 2011. Google Scholar
  17. Mark Guzdial. Trip report on Dagstuhl seminar on live coding, September 2013. Blog@CACM. URL: http://cacm.acm.org/blogs/blog-cacm/168153.
  18. Axel Habermaier. The model of computation of CUDA and its formal semantics. Master’s thesis, Institut für Informatik, Universität Augsburg, 2011. Google Scholar
  19. Shawn Hargreaves. Generating shaders from HLSL fragments. In ShaderX3: Advanced Rendering with DirectX and OpenGL. 2004. Google Scholar
  20. Chris Hathhorn, Michela Becchi, William L. Harrison, and Adam M. Procter. Formal semantics of heterogeneous CUDA-C: a modular approach with applications. In Conference on Systems Software Verification (SSV), 2012. Google Scholar
  21. Yong He, Tim Foley, and Kayvon Fatahalian. A system for rapid exploration of shader optimization choices. In SIGGRAPH, 2016. Google Scholar
  22. Yong He, Tim Foley, Natalya Tatarchuk, and Kayvon Fatahalian. A system for rapid, automatic shader level-of-detail. In SIGGRAPH Asia, 2015. Google Scholar
  23. Görel Hedin and Eva Magnusson. JastAdd: An aspect-oriented compiler construction system. Science of Computer Programming, 47:37-58, 2003. Google Scholar
  24. Khronos Group. glslang. URL: https://github.com/KhronosGroup/glslang.
  25. Khronos Vulkan registry. URL: https://www.khronos.org/registry/vulkan/.
  26. LambdaCube 3D. URL: http://lambdacube3d.com.
  27. Guodong Li, Peng Li, Geof Sawaya, Ganesh Gopalakrishnan, Indradeep Ghosh, and Sreeranga P. Rajan. GKLEE: Concolic verification and test generation for GPUs. In ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming (PPoPP), 2012. Google Scholar
  28. Michael McCool, Stefanus Du Toit, Tiberiu Popa, Bryan Chan, and Kevin Moule. Shader algebra. In SIGGRAPH, 2004. Google Scholar
  29. Michael McCool, Zheng Qin, and Tiberiu S. Popa. Shader metaprogramming. In ACM SIGGRAPH/EUROGRAPHICS Conference on Graphics Hardware, 2002. Google Scholar
  30. Sean McDirmid. Two lightweight DSLs for rich UI programming. URL: http://research.microsoft.com/pubs/191794/ldsl09.pdf.
  31. Microsoft. Direct3D. URL: https://msdn.microsoft.com/en-us/library/windows/desktop/hh309466.aspx.
  32. Newzoo. Top 100 countries by 2015 game revenues, 2015. URL: https://newzoo.com/insights/articles/newzoos-top-100-countries-by-2015-game-revenues/.
  33. F. Nielson and R. H. Nielson. Automatic binding time analysis for a typed λ-calculus. In ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL), 1988. Google Scholar
  34. Nathaniel Nystrom, Michael R. Clarkson, and Andrew C. Myers. Polyglot: An extensible compiler framework for Java. In Compiler Construction (CC), 2003. Google Scholar
  35. Fabio Pellacini. User-configurable automatic shader simplification. In SIGGRAPH, 2005. Google Scholar
  36. Bui Tuong Phong. Illumination for computer generated pictures. Communications of the ACM, 18(6):311-317, June 1975. Google Scholar
  37. Tiark Rompf, Arvind K. Sujeeth, Nada Amin, Kevin J. Brown, Vojin Jovanovic, HyoukJoong Lee, Manohar Jonnalagedda, Kunle Olukotun, and Martin Odersky. Optimizing data structures in high-level programs: New directions for extensible compilers based on staging. In ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL), 2013. Google Scholar
  38. Adrian Sampson, James Bornholt, and Luis Ceze. Hardware–software co-design: Not just a cliché. In Summit on Advances in Programming Languages (SNAPL), 2015. Google Scholar
  39. Adrian Sampson, Werner Dietl, Emily Fortuna, Danushen Gnanapragasam, Luis Ceze, and Dan Grossman. EnerJ: Approximate data types for safe and general low-power computation. In ACM Conference on Programming Language Design and Implementation (PLDI), 2011. Google Scholar
  40. Adrian Sampson, Pavel Panchekha, Todd Mytkowicz, Kathryn S. McKinley, Dan Grossman, and Luis Ceze. Expressing and verifying probabilistic assertions. In ACM Conference on Programming Language Design and Implementation (PLDI), 2014. Google Scholar
  41. Carlos Scheidegger. Lux: the DSEL for WebGL graphics. URL: http://cscheid.github.io/lux/.
  42. Mark Segal and Kurt Akeley. The OpenGL 4.5 graphics system: A specification. URL: https://www.opengl.org/registry/doc/glspec45.core.pdf.
  43. Pitchaya Sitthi-Amorn, Nicholas Modly, Westley Weimer, and Jason Lawrence. Genetic programming for shader simplification. In SIGGRAPH Asia, 2011. Google Scholar
  44. Chris Stucchio. Type-safe vector addition with dependent types, December 2014. URL: https://www.chrisstucchio.com/blog/2014/type_safe_vector_addition_with_dependent_types.html.
  45. Walid Taha and Tim Sheard. Multi-stage programming with explicit annotations. In ACM SIGPLAN Workshop on Partial Evaluation and Program Manipulation (PEPM), 1997. Google Scholar
  46. Unity game engine. URL: https://unity3d.com.
  47. Unreal game engine. URL: https://www.unrealengine.com/.
  48. Rui Wang, Xianjin Yang, Yazhen Yuan, Wei Chen, Kavita Bala, and Hujun Bao. Automatic shader simplification using surface signal approximation. ACM Transactions on Graphics, 33(6), November 2014. Google Scholar
  49. Steven Wittens. ShaderGraph: Functional GLSL linker. URL: https://github.com/unconed/shadergraph.