Semantic Composition of Language-Integrated Shaders

  • Georg Haaser
  • Harald Steinlechner
  • Michael May
  • Michael Schwärzler
  • Stefan Maierhofer
  • Robert Tobler
Conference paper
Part of the Communications in Computer and Information Science book series (CCIS, volume 550)

Abstract

In order to simplify shader programming we propose a system to specify composable shaders in a functional way directly in typical implementation languages of modern rendering frameworks. In constrast to existing pipeline shader frameworks, our system exposes a radically simplified pipeline, which we purposefully aligned with our basic intuition of shaders as compositions of per-primitive and per-pixel operations. By programming the shaders in the host language, we additionally remove the complexity of handling different programming languages for shaders and the rest of the framework.

The resulting simplicity lends itself to structure modules purely based on their semantic, instead of dealing with structure enforced by specific versions of graphics APIs. Thus our system offers great flexibility when it comes to reusing and combining shaders with completely different semantics, or when targeting different graphics APIs: our high level shaders can be automatically translated into the shading language of the backend (e.g. HLSL, GLSL, CG).

Keywords

Shader Composition Rendering Language Embedded 

Notes

Acknowledgements

We would like to thank Manuel Wieser for providing 3D models, especially Eigi, The Dinosaur. The competence center VRVis is funded by BMVIT, BMWFJ, and City of Vienna (ZIT) within the scope of COMET Competence Centers for Excellent Technologies. The program COMET is managed by FFG.

References

  1. 1.
    Austin, C.A.: Renaissance: a functional shading language. Master’s thesis, Iowa State University, Ames, Iowa, USA (2005). http://www.aegisknight.org/hci_portfolio/thesis.pdf
  2. 2.
    Cook, R.L.: Shade trees. SIGGRAPH Comput. Graph. 18(3), 223–231 (1984). http://doi.acm.org/10.1145/964965.808602CrossRefGoogle Scholar
  3. 3.
    Elliott, C.: Programming graphics processors functionally. Proceedings of the 2004 ACM SIGPLAN Workshop on Haskell. Haskell 2004, pp. 45–56. ACM, New York (2004)Google Scholar
  4. 4.
    Foley, T., Hanrahan, P.: Spark: modular, composable shaders for graphics hardware. ACM Trans. Graph. 30(4), 107:1–107:12 (2011)CrossRefGoogle Scholar
  5. 5.
    Fraser, C.W., Henry, R.R., Proebsting, T.A.: BURG: fast optimal instruction selection and tree parsing. SIGPLAN Not. 27(4), 68–76 (1992). http://doi.acm.org/10.1145/131080.131089CrossRefGoogle Scholar
  6. 6.
    Hanrahan, P., Lawson, J.: A language for shading and lighting calculations. SIGGRAPH Comput. Graph. 24(4), 289–298 (1990)CrossRefGoogle Scholar
  7. 7.
    Kessenich, J., Baldwin, D., Rost, R.: OpenGL Shading Language, v 4.3 (2012). http://www.opengl.org/documentation/glsl/. Accessed 23 October 2012
  8. 8.
    Knoop, J., Rüthing, O., Steffen, B.: Lazy code motion. SIGPLAN Not. 27(7), 224–234 (1992). http://doi.acm.org/10.1145/143103.143136CrossRefGoogle Scholar
  9. 9.
    Kuck, R., Wesche, G.: A framework for object-oriented shader design. In: Bebis, G., Boyle, R., Parvin, B., Koracin, D., Kuno, Y., Wang, J., Wang, J.-X., Wang, J., Pajarola, R., Lindstrom, P., Hinkenjann, A., Encarnação, M.L., Silva, C.T., Coming, D. (eds.) ISVC 2009, Part I. LNCS, vol. 5875, pp. 1019–1030. Springer, Heidelberg (2009) CrossRefGoogle Scholar
  10. 10.
    Mark, W.R., Glanville, R.S., Akeley, K., Kilgard, M.J.: Cg: a system for programming graphics hardware in a C-like language. ACM Trans. Graph. 22(3), 896–907 (2003)CrossRefGoogle Scholar
  11. 11.
    McCool, M., Du Toit, S., Popa, T., Chan, B., Moule, K.: Shader algebra. ACM SIGGRAPH 2004 Papers. SIGGRAPH 2004, pp. 787–795. ACM, New York (2004)Google Scholar
  12. 12.
    McCool, M.D., Qin, Z., Popa, T.S.: Shader metaprogramming. Proceedings of the ACM SIGGRAPH/EUROGRAPHICS Conference on Graphics Hardware, HWWS 2002, pp. 57–68. Eurograph. Assoc, Aire-la-Ville (2002)Google Scholar
  13. 13.
    McCool, M.D., Toit, S.D.: Metaprogramming GPUs with Sh. A K Peters, Stanford (2004)Google Scholar
  14. 14.
    McGuire, M.: The SuperShader. In: Shader X4: Advanced Rendering Techniques, chap. 8.1, pp. 485–498. Cengage Learning Emea (2005). http://www.cs.brown.edu/research/graphics/games/SuperShader/index.html
  15. 15.
    McGuire, M., Stathis, G., Pfister, H., Krishnamurthi, S.: Abstract shade trees. Proceedings of the 2006 Symposium on Interactive 3D Graphics and Games. I3D 2006, pp. 79–86. ACM, New York (2006)Google Scholar
  16. 16.
    Microsoft: Shader model 5 DirectX HLSL (2010). http://msdn.microsoft.com/en-us/library/windows/desktop/ff471356%28v=vs.85%29.aspx. Accessed 23 October 2012
  17. 17.
    Microsoft: Programming Guide for HLSL (2012). http://msdn.microsoft.com/en-us/library/bb509635(v=VS.85).aspx. Accessed 23 October 2012
  18. 18.
    Perlin, K.: An image synthesizer. Proceedings of the 12th Annual Conference on Computer Graphics and Interactive Techniques. SIGGRAPH 1985, pp. 287–296. ACM, N.Y. (1985)Google Scholar
  19. 19.
    Proudfoot, K., Mark, W.R., Tzvetkov, S., Hanrahan, P.: A real-time procedural shading system for programmable graphics hardware. Proceedings of the 28th Annual Conference on Computer Graphics and Interactive Techniques. SIGGRAPH 2001, pp. 159–170. ACM, New York (2001)Google Scholar
  20. 20.
    Sitthi-Amorn, P., Lawrence, J., Yang, L., Sander, P.V., Nehab, D., Xi, J.: Automated reprojection-based pixel shader optimization. ACM Trans. Graph. 27(5), 127:1–127:11 (2008). http://doi.acm.org/10.1145/1409060.1409080CrossRefGoogle Scholar
  21. 21.
    Sitthi-Amorn, P., Modly, N., Weimer, W., Lawrence, J.: Genetic programming for shader simplification. ACM Trans. Graph. 30(6), 152:1–152:12 (2011). http://doi.acm.org/10.1145/2070781.2024186CrossRefGoogle Scholar
  22. 22.
    Trapp, M., Döllner, J.: Automated combination of real-time shader programs. In: Cignoni, P., Sochor, J. (eds.) Eurographics 2007 Shortpaper, pp. 53–56. Eurograph. Assoc. (2007)Google Scholar

Copyright information

© Springer International Publishing Switzerland 2015

Open Access This chapter is distributed under the terms of the Creative Commons Attribution Noncommercial License, which permits any noncommercial use, distribution, and reproduction in any medium, provided the original author(s) and source are credited.

Authors and Affiliations

  • Georg Haaser
    • 1
  • Harald Steinlechner
    • 1
  • Michael May
    • 1
  • Michael Schwärzler
    • 1
  • Stefan Maierhofer
    • 1
  • Robert Tobler
    • 1
  1. 1.VRVis Research CenterViennaAustria

Personalised recommendations