## Programming graphics processors functionally (2004)

Venue: | In Haskell workshop |

Citations: | 23 - 0 self |

### BibTeX

@INPROCEEDINGS{Elliott04programminggraphics,

author = {Conal Elliott},

title = {Programming graphics processors functionally},

booktitle = {In Haskell workshop},

year = {2004},

pages = {45--56}

}

### OpenURL

### Abstract

Graphics cards for personal computers have recently undergone a radical transformation from fixed-function graphics pipelines to multi-processor, programmable architectures. Multi-processor architectures are clearly advantageous for graphics for the simple reason that graphics computations are naturally concurrent, mapping well to stateless stream processing. They therefore parallelize easily and need no random access to memory with its problematic latencies. This paper presents Vertigo, a purely functional, Haskell-embedded language for 3D graphics and an optimizing compiler that generates graphics processor code. The language integrates procedural surface modeling, shading, and texture generation, and the compiler exploits the unusual processor architecture. The shading sublanguage is based on a simple and precise semantic model, in contrast to previous shading languages. Geometry and textures are also defined via a very simple denotational semantics. The formal semantics yields not only programs that are easy to understand and reason about, but also very efficient implementation, thanks to a compiler based on partial evaluation and symbolic optimization, much in the style of Pan [2]. Haskell’s overloading facility is extremely useful throughout Vertigo. For instance, math operators are used not just for floating point numbers, but also expressions (for differentiation and compilation), tuples, and functions. Typically, these overloadings cascade, as in the case of surfaces, which may be combined via math operators, though they are really functions over tuples of expressions on floating point numbers. Shaders may be composed with the same notational convenience. Functional dependencies are exploited for vector spaces, cross products, and derivatives.

### Citations

164 | A user-programmable vertex engine
- LINDHOLM, KILGARD, et al.
- 2001
(Show Context)
Citation Context ...rocessors Vertigo targets the DirectX 8.1 vertex shader model shown in Figure 1, which is taken from [9]. This model and a multiprocessor Figure 1. Vertex shader model implementation are described in =-=[8]-=-. This unit is replicated, typically with four or eight instances. Every register is a quadruple of 32-bit floating point numbers (a “quad-float”). Every “vertex” is represented by up to 16 registers,... |

126 |
The RenderMan Companion
- Upstill
- 1990
(Show Context)
Citation Context ...rogrammable shaders”), and procedural geometry, textures, and animation. The accepted programming interfaces are assembler and C-like “shading languages”, having roots in RenderMan’s shading language =-=[5, 14, 3, 10]-=-. This is an unfortunate choice, because the computations performed are naturally functional. In fact, these Clike languages are only superfically imperative. This paper offers a functional alternativ... |

107 | A language for shading and lighting calculations
- Hanrahan, Lawson
- 1990
(Show Context)
Citation Context ...rogrammable shaders”), and procedural geometry, textures, and animation. The accepted programming interfaces are assembler and C-like “shading languages”, having roots in RenderMan’s shading language =-=[5, 14, 3, 10]-=-. This is an unfortunate choice, because the computations performed are naturally functional. In fact, these Clike languages are only superfically imperative. This paper offers a functional alternativ... |

85 |
Calculus on Manifolds
- Spivak
- 1965
(Show Context)
Citation Context ...rivatives The derivative operator maps functions to functions. In general, the derivative of a function of type α → β is a function of type α → L(α;β), where “L(α;β)” means the linear subset of α → β =-=[13]-=-. These linear maps are typically represented by real numbers, vectors, matrices, etc, depending on α and β. Because Vertigo uses these data representations rather than functions for derivative values... |

84 |
The Cg Tutorial: The definitive guide to programmable real-time graphics. Addison-Wesley Pub Co, February 2003. 212 Juan Fernndez-Recio, Maxim Totrov, and Ruben Abagyan. Soft proteinprotein docking in internal coordinates
- Fernando, Kilgard
(Show Context)
Citation Context ...rogrammable shaders”), and procedural geometry, textures, and animation. The accepted programming interfaces are assembler and C-like “shading languages”, having roots in RenderMan’s shading language =-=[5, 14, 3, 10]-=-. This is an unfortunate choice, because the computations performed are naturally functional. In fact, these Clike languages are only superfically imperative. This paper offers a functional alternativ... |

81 | Implicit Parameters: Dynamic Scoping with Static Types
- Lewis, Launchbury, et al.
- 2000
(Show Context)
Citation Context ... adding one or two ignored arguments, respectively. Similarly, there are overloaded toES and toSS functions. 5.3 Implicit parameters We also implemented the shading language using implicit parameters =-=[7]-=-. The following definitions describe dependencies on view, surface point, and light information, abstracting out the details: type ViewDep a = (?ca :: Color, ?eye :: R 3 , ?lights :: [Light]) ⇒ a type... |

81 | A Real-Time Procedural Shading System for Programmable Graphics Hardware
- Proudfoot, Mark
- 2001
(Show Context)
Citation Context |

41 | Compiling embedded languages
- Elliott, Finne, et al.
- 2000
(Show Context)
Citation Context ...nly programs that are easy to understand and reason about, but also very efficient implementation, thanks to a compiler based on partial evaluation and symbolic optimization, much in the style of Pan =-=[2]-=-. Haskell’s overloading facility is extremely useful throughout Vertigo. For instance, math operators are used not just for floating point numbers, but also expressions (for differentiation and compil... |

30 | Generative modeling: A symbolic system for geometric modeling
- Snyder, Kajiya
- 1992
(Show Context)
Citation Context ...are as follows: • Optimized compilation of a functional language to modern graphics hardware. • A simple and practical embedding of parametric surfaces definition and composition (generative modeling =-=[12]-=-) in a functional programming language. (See also [6].) • A simple but powerful semantic model for shading languages, with direct implementation of that model. 2 Why Functional Graphics? Functional pr... |

25 |
Generative Modeling for Computer Graphics and CAD: Symbolic Shape Design using Interval Analysis
- Snyder
- 1992
(Show Context)
Citation Context ...π and π, while φ varies between −π/2 and π/2 (south and north poles). More powerfully, using higher-order functions, we can construct surfaces compositionally, as in the method of generative modeling =-=[12, 11]-=-. The next several examples introduce and demonstrate a collection of useful combinators for surface composition. 4.1 Height fields “Height fields” are simply functions from R 2 to R , and may be visu... |

5 | Geometric Modelling in Functional Style
- Karczmarczuk
- 1999
(Show Context)
Citation Context ...l language to modern graphics hardware. • A simple and practical embedding of parametric surfaces definition and composition (generative modeling [12]) in a functional programming language. (See also =-=[6]-=-.) • A simple but powerful semantic model for shading languages, with direct implementation of that model. 2 Why Functional Graphics? Functional programming is a natural fit for computer graphics simp... |

1 |
Why is graphics hardware so fast? Unpublished talk
- Hanrahan
- 2002
(Show Context)
Citation Context ...mance, multi-processor, datastreaming computers are now found on consumer-level graphics cards. The performance of these cards is growing at a much faster rate than CPUs, at roughly Moore’s law cubed =-=[4]-=-. Soon the computational power of these graphics processing units (“GPUs”) will surpass that of the system CPU. Some common applications of GPUs include geometric transformation, traditional and alter... |

1 |
Microsoft DirectX 8.1 programmable vertex shader architecture. http://msdn.microsoft.com
- Microsoft
(Show Context)
Citation Context ...jective, or might be arbitrary spatial deformations, such as bends, twists, or tapers. 3 Graphics processors Vertigo targets the DirectX 8.1 vertex shader model shown in Figure 1, which is taken from =-=[9]-=-. This model and a multiprocessor Figure 1. Vertex shader model implementation are described in [8]. This unit is replicated, typically with four or eight instances. Every register is a quadruple of 3... |