Cover image for Metaprogramming GPUs with Sh
Title:
Metaprogramming GPUs with Sh
Personal Author:
Publication Information:
Wellesley, MA : A K Peters, 2004
Physical Description:
xvii, 290 p. : ill. ; 24 cm.
ISBN:
9781568812298

Available:*

Library
Item Barcode
Call Number
Material Type
Item Category 1
Status
Searching...
30000010195864 T385 M322 2004 Open Access Book Book
Searching...

On Order

Summary

Summary

This book is a high-level overview of Sh and its relationship to other realtime shading and Graphics processing unit programming languages. It is a reference manual and language specification and methodically and exhaustively presents details of the various features of Sh.


Author Notes

McCool , Michael


Table of Contents

List of Tablesp. xi
List of Listingsp. xv
Prefacep. xvii
I Introductionp. 1
1 Overviewp. 3
1.1 Programmable GPUsp. 8
1.2 Shading Languagesp. 10
1.3 Stream Processingp. 13
1.4 Metaprogrammingp. 16
1.5 The Sh Metaprogramming Toolkitp. 19
1.5.1 Immediate Modep. 20
1.5.2 Stream Programmingp. 20
1.5.3 Shader Programmingp. 24
1.6 Conventions and Notationp. 27
1.6.1 Typesetting and Stylistic Conventionsp. 27
1.6.2 Coordinate Systemsp. 28
1.6.3 Standard Vectors and Variable Namesp. 29
1.6.4 Global Parametersp. 32
1.7 License, History, and Accessp. 35
1.8 Status and Future Developmentp. 36
1.8.1 Beta Release Featuresp. 37
1.8.2 Year-End Featuresp. 38
1.8.3 Future Featuresp. 40
2 Tuples, Matrices, Operators, and Functionsp. 43
2.1 Tuplesp. 43
2.2 Operators and Library Functionsp. 44
2.3 Matricesp. 46
2.4 Functionsp. 47
2.4.1 Example: Glass Support Functionsp. 47
2.4.2 Example: Reflectance Modelsp. 50
3 Programs, Parameters, and Attributesp. 63
3.1 Programsp. 63
3.2 Example: Blinn-Phong Point-Source Lightingp. 64
3.2.1 Vertex Shaderp. 64
3.2.2 Fragment Shaderp. 67
3.2.3 Modularityp. 68
3.2.4 Shader Frameworkp. 71
3.3 Shader Algebrap. 72
3.4 Example: Surfaces, Lights, and Postprocessingp. 74
3.5 Example: Metaprogrammed CSG Textp. 77
3.6 Control Constructsp. 83
3.7 Example: Julia Setp. 84
4 Arrays and Texturesp. 89
4.1 Texture Typesp. 89
4.2 Example: Texture Mapped Blinn-Phongp. 91
4.3 Example: Encapsulated BRDF Representationp. 93
4.4 Example: Shiny Bump Mapp. 96
4.4.1 Vertex Shaderp. 97
4.4.2 Fragment Shaderp. 98
4.5 Example: Glassp. 98
4.6 Example: Lucitep. 100
4.7 Example: Wood and Marblep. 102
4.7.1 Parametersp. 103
4.7.2 Vertex Shaderp. 104
4.7.3 Fragment Shaderp. 104
4.8 Example: Worley Noise Shadersp. 105
4.9 Example: Wood from Phongp. 106
5 Streams and Channelsp. 119
5.1 Channelsp. 119
5.2 Combining Channels into Streamsp. 119
5.3 Applying Programs to Streamsp. 120
5.4 Example: Particle Systemsp. 121
II Referencep. 127
6 Reference Overviewp. 129
6.1 Setupp. 129
6.2 Sample OpenGL GLUT Applicationp. 130
6.3 The shrike Testbedp. 134
6.4 API Documentationp. 135
7 Typesp. 137
7.1 Programsp. 137
7.2 Tuplesp. 138
7.2.1 Semantic Typesp. 138
7.2.2 Storage Typesp. 139
7.2.3 Binding Typesp. 141
7.2.4 Template Declarationp. 142
7.3 Matricesp. 144
7.4 Arrays, Tables, and Texturesp. 145
7.5 Contextsp. 146
7.6 Exceptions and Error Handlingp. 146
7.7 Metadatap. 146
7.7.1 Object Namesp. 148
8 Standard Operators and Functionsp. 151
8.1 Swizzling and Write Maskingp. 153
8.2 Arithmeticp. 156
8.3 Derivativesp. 159
8.4 Noisep. 161
8.5 Trigonometric and Exponential Functionsp. 163
8.6 Interpolation and Approximationp. 165
8.7 Geometryp. 166
8.8 Linear Algebrap. 167
8.9 Logical and Comparison Functionsp. 171
8.10 Discontinuitiesp. 173
8.11 Miscellaneous Functionsp. 173
9 Arrays, Tables and Texturesp. 177
9.1 Texture Formatsp. 178
9.2 Trait Modifiersp. 180
9.3 Texture Memory and Storagep. 180
9.4 Texture and Array Accessp. 181
10 Programs and Streamsp. 183
10.1 Defining Programsp. 183
10.1.1 Compiling Programsp. 184
10.2 Binding Programs and Datap. 185
10.2.1 Binding Programsp. 185
10.2.2 Binding and Updating Datap. 186
10.2.3 Unbindingp. 186
10.2.4 Querying Binding Statep. 186
10.3 Introspectionp. 187
10.4 Algebrap. 189
10.4.1 Connectionp. 190
10.4.2 Combinationp. 190
10.5 Nibblesp. 191
10.5.1 Interface Adaptation and Specializationp. 191
10.5.2 Passthroughp. 192
10.5.3 Texture Accessp. 193
10.5.4 Type and Size Conversionp. 193
10.5.5 Transformationsp. 194
10.5.6 Basis Conversionp. 194
10.5.7 Primitive Computationsp. 195
10.6 Manipulatorsp. 196
10.6.1 Fixed Manipulatorsp. 197
10.6.2 Expandable Manipulatorsp. 197
10.7 Kernelsp. 198
10.7.1 Universal Vertex Shader Kernelp. 199
10.7.2 Surface Shader Kernelsp. 201
10.7.3 Light Shader Kernelsp. 203
10.7.4 Surface Map Kernelsp. 205
10.7.5 Postprocessing Kernelsp. 206
10.8 Streamsp. 206
11 Control Constructsp. 209
11.1 Selectionp. 210
11.1.1 IFp. 211
11.1.2 Whenp. 212
11.2 Iterationp. 212
11.2.1 Forp. 213
11.2.2 Whilep. 214
11.2.3 Do/Untilp. 214
11.2.4 Break/Continuep. 214
12 Backendsp. 217
12.1 OpenGL Backendsp. 218
12.1.1 Input and Output Bindingp. 218
12.1.2 Texture Bindingsp. 219
12.1.3 Parameter Bindingsp. 220
12.2 CPU Backendsp. 220
12.3 The Sm Backendp. 221
III Engineeringp. 223
13 Engineering Overviewp. 225
13.1 Code Organization and Build Systemp. 226
13.2 Template Instantiationp. 227
14 Intermediate Representationp. 229
14.1 Reference Countingp. 229
14.2 Basic Blocksp. 230
14.2.1 Special Statementsp. 234
14.3 The Control-Flow Graphp. 235
14.4 Parsingp. 236
14.4.1 Basic Blocksp. 236
14.4.2 Control Constructsp. 237
15 Streams and Texturesp. 241
15.1 Stream Representationp. 241
15.2 Texture Representationp. 242
15.3 Stream and Texture Memoryp. 242
15.3.1 Memory and Storage Objectsp. 242
15.3.2 Finding Storagesp. 244
15.3.3 Transfer Operatorsp. 244
15.3.4 Existing Implementationsp. 244
15.4 Future Workp. 245
15.4.1 Stream Interface Improvementsp. 245
15.4.2 Index Streamsp. 246
15.4.3 Reductionsp. 246
15.4.4 Stream Orderingp. 246
15.4.5 Memory Abstraction Improvementsp. 247
16 Optimizationp. 249
16.1 Copy Propagation and Forward Substitutionp. 249
16.2 Dead Code Removalp. 251
16.2.1 Block Predecessorsp. 252
16.2.2 Reaching Definitionsp. 252
16.2.3 Use-Def Chainsp. 252
16.2.4 Live and Dead Codep. 253
16.3 Graph Straighteningp. 253
16.4 Future Workp. 254
16.4.1 Eliminating Redundanciesp. 254
16.4.2 Constant Folding and Uniform Liftingp. 255
16.4.3 Algebraic Simplificationp. 256
16.4.4 Conditional Assignmentp. 257
16.4.5 Static Single Assignment and Other Formsp. 257
17 Backendp. 261
17.1 The Backend Interfacep. 261
17.2 Linear Register Allocationp. 263
17.3 Transformersp. 263
17.3.1 Splitting Long Tuplesp. 264
17.3.2 Input and Output Conversionp. 265
17.3.3 Texture Indexing Conversionp. 266
17.4 Future Workp. 266
17.4.1 New Backendsp. 266
17.4.2 Better Transformationsp. 267
17.4.3 Better Reusep. 267
17.4.4 Instruction Count Virtualizationp. 268
17.4.5 Data-Dependent Control Flow Virtualizationp. 268
Bibliographyp. 271
Indexp. 285