Shader algebra
Computer Graphics Lab, School of Computer Science, University of Waterloo
In SIGGRAPH ’04: ACM SIGGRAPH 2004 Papers (2004), pp. 787-795
@article{mccool2004shader,
title={Shader algebra},
author={McCool, M. and Du Toit, S. and Popa, T. and Chan, B. and Moule, K.},
journal={ACM Transactions on Graphics (TOG)},
volume={23},
number={3},
pages={787–795},
issn={0730-0301},
year={2004},
publisher={ACM}
}
An algebra consists of a set of objects and a set of operators that act on those objects. We treat shader programs as first-class objects and define two operators: connection and combination. Connection is functional composition: the outputs of one shader are fed into the inputs of another. Combination concatenates the input channels, output channels, and computations of two shaders. Similar operators can be used to manipulate streams and apply computational kernels expressed as shaders to streams. Connecting a shader program to a stream applies that program to all elements of the stream; combining streams concatenates the record definitions of those streams.In conjunction with an optimizing compiler, these operators can manipulate shader programs in many useful ways, including specialization, without modifying the original source code. We demonstrate these operators in Sh, a metaprogramming shading language embedded in C++.
November 29, 2010 by hgpu