List of Tables |
|
xi | |
List of Listings |
|
xv | |
Preface |
|
xvii | |
I Introduction |
|
1 | (126) |
|
|
3 | (40) |
|
|
8 | (2) |
|
|
10 | (3) |
|
|
13 | (3) |
|
|
16 | (3) |
|
1.5 The Sh Metaprogramming Toolkit |
|
|
19 | (8) |
|
|
20 | (1) |
|
|
20 | (4) |
|
|
24 | (3) |
|
1.6 Conventions and Notation |
|
|
27 | (8) |
|
1.6.1 Typesetting and Stylistic Conventions |
|
|
27 | (1) |
|
|
28 | (1) |
|
1.6.3 Standard Vectors and Variable Names |
|
|
29 | (3) |
|
|
32 | (3) |
|
1.7 License, History, and Access |
|
|
35 | (1) |
|
1.8 Status and Future Development |
|
|
36 | (7) |
|
1.8.1 Beta Release Features |
|
|
37 | (1) |
|
|
38 | (2) |
|
|
40 | (3) |
|
2 Tuples, Matrices, Operators, and Functions |
|
|
43 | (20) |
|
|
43 | (1) |
|
2.2 Operators and Library Functions |
|
|
44 | (2) |
|
|
46 | (1) |
|
|
47 | (16) |
|
2.4.1 Example: Glass Support Functions |
|
|
47 | (3) |
|
2.4.2 Example: Reflectance Models |
|
|
50 | (13) |
|
3 Programs, Parameters, and Attributes |
|
|
63 | (26) |
|
|
63 | (1) |
|
3.2 Example: Blinn-Phong Point-Source Lighting |
|
|
64 | (8) |
|
|
64 | (3) |
|
|
67 | (1) |
|
|
68 | (3) |
|
|
71 | (1) |
|
|
72 | (2) |
|
3.4 Example: Surfaces, Lights, and Postprocessing |
|
|
74 | (3) |
|
3.5 Example: Metaprogrammed CSG Text |
|
|
77 | (6) |
|
|
83 | (1) |
|
|
84 | (5) |
|
|
89 | (30) |
|
|
89 | (2) |
|
4.2 Example: Texture Mapped Blinn-Phong |
|
|
91 | (2) |
|
4.3 Example: Encapsulated BRDF Representation |
|
|
93 | (3) |
|
4.4 Example: Shiny Bump Map |
|
|
96 | (2) |
|
|
97 | (1) |
|
|
98 | (1) |
|
|
98 | (2) |
|
|
100 | (2) |
|
4.7 Example: Wood and Marble |
|
|
102 | (3) |
|
|
103 | (1) |
|
|
104 | (1) |
|
|
104 | (1) |
|
4.8 Example: Worley Noise Shaders |
|
|
105 | (1) |
|
4.9 Example: Wood from Phong |
|
|
106 | (13) |
|
|
119 | (8) |
|
|
119 | (1) |
|
5.2 Combining Channels into Streams |
|
|
119 | (1) |
|
5.3 Applying Programs to Streams |
|
|
120 | (1) |
|
5.4 Example: Particle Systems |
|
|
121 | (6) |
II Reference |
|
127 | (96) |
|
|
129 | (8) |
|
|
129 | (1) |
|
6.2 Sample OpenGL GLUT Application |
|
|
130 | (4) |
|
|
134 | (1) |
|
|
135 | (2) |
|
|
137 | (14) |
|
|
137 | (1) |
|
|
138 | (6) |
|
|
138 | (1) |
|
|
139 | (2) |
|
|
141 | (1) |
|
7.2.4 Template Declaration |
|
|
142 | (2) |
|
|
144 | (1) |
|
7.4 Arrays, Tables, and Textures |
|
|
145 | (1) |
|
|
146 | (1) |
|
7.6 Exceptions and Error Handling |
|
|
146 | (1) |
|
|
146 | (5) |
|
|
148 | (3) |
|
8 Standard Operators and Functions |
|
|
151 | (26) |
|
8.1 Swizzling and Write Masking |
|
|
153 | (3) |
|
|
156 | (3) |
|
|
159 | (2) |
|
|
161 | (2) |
|
8.5 Trigonometric and Exponential Functions |
|
|
163 | (2) |
|
8.6 Interpolation and Approximation |
|
|
165 | (1) |
|
|
166 | (1) |
|
|
167 | (4) |
|
8.9 Logical and Comparison Functions |
|
|
171 | (2) |
|
|
173 | (1) |
|
8.11 Miscellaneous Functions |
|
|
173 | (4) |
|
9 Arrays, Tables and Textures |
|
|
177 | (6) |
|
|
178 | (2) |
|
|
180 | (1) |
|
9.3 Texture Memory and Storage |
|
|
180 | (1) |
|
9.4 Texture and Array Access |
|
|
181 | (2) |
|
|
183 | (1) |
|
|
183 | (2) |
|
10.1.1 Compiling Programs |
|
|
184 | (1) |
|
10.2 Binding Programs and Data |
|
|
185 | (2) |
|
|
185 | (1) |
|
10.2.2 Binding and Updating Data |
|
|
186 | (1) |
|
|
186 | (1) |
|
10.2.4 Querying Binding State |
|
|
186 | (1) |
|
|
187 | (2) |
|
|
189 | (2) |
|
|
190 | (1) |
|
|
190 | (1) |
|
|
191 | (5) |
|
10.5.1 Interface Adaptation and Specialization |
|
|
191 | (1) |
|
|
192 | (1) |
|
|
193 | (1) |
|
10.5.4 Type and Size Conversion |
|
|
193 | (1) |
|
|
194 | (1) |
|
|
194 | (1) |
|
10.5.7 Primitive Computations |
|
|
195 | (1) |
|
|
196 | (2) |
|
10.6.1 Fixed Manipulators |
|
|
197 | (1) |
|
10.6.2 Expandable Manipulators |
|
|
197 | (1) |
|
|
198 | (8) |
|
10.7.1 Universal Vertex Shader Kernel |
|
|
199 | (2) |
|
10.7.2 Surface Shader Kernels |
|
|
201 | (2) |
|
10.7.3 Light Shader Kernels |
|
|
203 | (2) |
|
10.7.4 Surface Map Kernels |
|
|
205 | (1) |
|
10.7.5 Postprocessing Kernels |
|
|
206 | (1) |
|
|
206 | (3) |
|
|
209 | (1) |
|
|
210 | (2) |
|
|
211 | (1) |
|
|
212 | (1) |
|
|
212 | (6) |
|
|
213 | (1) |
|
|
214 | (1) |
|
|
214 | (1) |
|
|
214 | (3) |
|
|
217 | (1) |
|
|
218 | (2) |
|
12.1.1 Input and Output Binding |
|
|
218 | (1) |
|
|
219 | (1) |
|
12.1.3 Parameter Bindings |
|
|
220 | (1) |
|
|
220 | (1) |
|
|
221 | (2) |
III Engineering |
|
223 | (1) |
|
|
225 | (46) |
|
13.1 Code Organization and Build System |
|
|
226 | (1) |
|
13.2 Template Instantiation |
|
|
227 | (2) |
|
14 Intermediate Representation |
|
|
229 | (1) |
|
|
229 | (1) |
|
|
230 | (5) |
|
14.2.1 Special Statements |
|
|
234 | (1) |
|
14.3 The Control-Flow Graph |
|
|
235 | (1) |
|
|
236 | (5) |
|
|
236 | (1) |
|
14.4.2 Control Constructs |
|
|
237 | (4) |
|
|
241 | (1) |
|
15.1 Stream Representation |
|
|
241 | (1) |
|
15.2 Texture Representation |
|
|
242 | (1) |
|
15.3 Stream and Texture Memory |
|
|
242 | (3) |
|
15.3.1 Memory and Storage Objects |
|
|
242 | (2) |
|
|
244 | (1) |
|
15.3.3 Transfer Operators |
|
|
244 | (1) |
|
15.3.4 Existing Implementations |
|
|
244 | (1) |
|
|
245 | (4) |
|
15.4.1 Stream Interface Improvements |
|
|
245 | (1) |
|
|
246 | (1) |
|
|
246 | (1) |
|
|
246 | (1) |
|
15.4.5 Memory Abstraction Improvements |
|
|
247 | (2) |
|
|
249 | (3) |
|
16.1 Copy Propagation and Forward Substitution |
|
|
249 | (2) |
|
|
251 | (2) |
|
16.2.1 Block Predecessors |
|
|
252 | (1) |
|
16.2.2 Reaching Definitions |
|
|
252 | (1) |
|
|
252 | (1) |
|
16.2.4 Live and Dead Code |
|
|
253 | (1) |
|
|
253 | (1) |
|
|
254 | (7) |
|
16.4.1 Eliminating Redundancies |
|
|
254 | (1) |
|
16.4.2 Constant Folding and Uniform Lifting |
|
|
255 | (1) |
|
16.4.3 Algebraic Simplification |
|
|
256 | (1) |
|
16.4.4 Conditional Assignment |
|
|
257 | (1) |
|
16.4.5 Static Single Assignment and Other Forms |
|
|
257 | (4) |
|
|
261 | (3) |
|
17.1 The Backend Interface |
|
|
261 | (2) |
|
17.2 Linear Register Allocation |
|
|
263 | (1) |
|
|
263 | (3) |
|
17.3.1 Splitting Long Tuples |
|
|
264 | (1) |
|
17.3.2 Input and Output Conversion |
|
|
265 | (1) |
|
17.3.3 Texture Indexing Conversion |
|
|
266 | (1) |
|
|
266 | (5) |
|
|
266 | (1) |
|
17.4.2 Better Transformations |
|
|
267 | (1) |
|
|
267 | (1) |
|
17.4.4 Instruction Count Virtualization |
|
|
268 | (1) |
|
17.4.5 Data-Dependent Control Flow Virtualization |
|
|
268 | (3) |
Bibliography |
|
271 | (14) |
Index |
|
285 | |