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
Added Author:
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 Tables | p. xi |
List of Listings | p. xv |
Preface | p. xvii |
I Introduction | p. 1 |
1 Overview | p. 3 |
1.1 Programmable GPUs | p. 8 |
1.2 Shading Languages | p. 10 |
1.3 Stream Processing | p. 13 |
1.4 Metaprogramming | p. 16 |
1.5 The Sh Metaprogramming Toolkit | p. 19 |
1.5.1 Immediate Mode | p. 20 |
1.5.2 Stream Programming | p. 20 |
1.5.3 Shader Programming | p. 24 |
1.6 Conventions and Notation | p. 27 |
1.6.1 Typesetting and Stylistic Conventions | p. 27 |
1.6.2 Coordinate Systems | p. 28 |
1.6.3 Standard Vectors and Variable Names | p. 29 |
1.6.4 Global Parameters | p. 32 |
1.7 License, History, and Access | p. 35 |
1.8 Status and Future Development | p. 36 |
1.8.1 Beta Release Features | p. 37 |
1.8.2 Year-End Features | p. 38 |
1.8.3 Future Features | p. 40 |
2 Tuples, Matrices, Operators, and Functions | p. 43 |
2.1 Tuples | p. 43 |
2.2 Operators and Library Functions | p. 44 |
2.3 Matrices | p. 46 |
2.4 Functions | p. 47 |
2.4.1 Example: Glass Support Functions | p. 47 |
2.4.2 Example: Reflectance Models | p. 50 |
3 Programs, Parameters, and Attributes | p. 63 |
3.1 Programs | p. 63 |
3.2 Example: Blinn-Phong Point-Source Lighting | p. 64 |
3.2.1 Vertex Shader | p. 64 |
3.2.2 Fragment Shader | p. 67 |
3.2.3 Modularity | p. 68 |
3.2.4 Shader Framework | p. 71 |
3.3 Shader Algebra | p. 72 |
3.4 Example: Surfaces, Lights, and Postprocessing | p. 74 |
3.5 Example: Metaprogrammed CSG Text | p. 77 |
3.6 Control Constructs | p. 83 |
3.7 Example: Julia Set | p. 84 |
4 Arrays and Textures | p. 89 |
4.1 Texture Types | p. 89 |
4.2 Example: Texture Mapped Blinn-Phong | p. 91 |
4.3 Example: Encapsulated BRDF Representation | p. 93 |
4.4 Example: Shiny Bump Map | p. 96 |
4.4.1 Vertex Shader | p. 97 |
4.4.2 Fragment Shader | p. 98 |
4.5 Example: Glass | p. 98 |
4.6 Example: Lucite | p. 100 |
4.7 Example: Wood and Marble | p. 102 |
4.7.1 Parameters | p. 103 |
4.7.2 Vertex Shader | p. 104 |
4.7.3 Fragment Shader | p. 104 |
4.8 Example: Worley Noise Shaders | p. 105 |
4.9 Example: Wood from Phong | p. 106 |
5 Streams and Channels | p. 119 |
5.1 Channels | p. 119 |
5.2 Combining Channels into Streams | p. 119 |
5.3 Applying Programs to Streams | p. 120 |
5.4 Example: Particle Systems | p. 121 |
II Reference | p. 127 |
6 Reference Overview | p. 129 |
6.1 Setup | p. 129 |
6.2 Sample OpenGL GLUT Application | p. 130 |
6.3 The shrike Testbed | p. 134 |
6.4 API Documentation | p. 135 |
7 Types | p. 137 |
7.1 Programs | p. 137 |
7.2 Tuples | p. 138 |
7.2.1 Semantic Types | p. 138 |
7.2.2 Storage Types | p. 139 |
7.2.3 Binding Types | p. 141 |
7.2.4 Template Declaration | p. 142 |
7.3 Matrices | p. 144 |
7.4 Arrays, Tables, and Textures | p. 145 |
7.5 Contexts | p. 146 |
7.6 Exceptions and Error Handling | p. 146 |
7.7 Metadata | p. 146 |
7.7.1 Object Names | p. 148 |
8 Standard Operators and Functions | p. 151 |
8.1 Swizzling and Write Masking | p. 153 |
8.2 Arithmetic | p. 156 |
8.3 Derivatives | p. 159 |
8.4 Noise | p. 161 |
8.5 Trigonometric and Exponential Functions | p. 163 |
8.6 Interpolation and Approximation | p. 165 |
8.7 Geometry | p. 166 |
8.8 Linear Algebra | p. 167 |
8.9 Logical and Comparison Functions | p. 171 |
8.10 Discontinuities | p. 173 |
8.11 Miscellaneous Functions | p. 173 |
9 Arrays, Tables and Textures | p. 177 |
9.1 Texture Formats | p. 178 |
9.2 Trait Modifiers | p. 180 |
9.3 Texture Memory and Storage | p. 180 |
9.4 Texture and Array Access | p. 181 |
10 Programs and Streams | p. 183 |
10.1 Defining Programs | p. 183 |
10.1.1 Compiling Programs | p. 184 |
10.2 Binding Programs and Data | p. 185 |
10.2.1 Binding Programs | p. 185 |
10.2.2 Binding and Updating Data | p. 186 |
10.2.3 Unbinding | p. 186 |
10.2.4 Querying Binding State | p. 186 |
10.3 Introspection | p. 187 |
10.4 Algebra | p. 189 |
10.4.1 Connection | p. 190 |
10.4.2 Combination | p. 190 |
10.5 Nibbles | p. 191 |
10.5.1 Interface Adaptation and Specialization | p. 191 |
10.5.2 Passthrough | p. 192 |
10.5.3 Texture Access | p. 193 |
10.5.4 Type and Size Conversion | p. 193 |
10.5.5 Transformations | p. 194 |
10.5.6 Basis Conversion | p. 194 |
10.5.7 Primitive Computations | p. 195 |
10.6 Manipulators | p. 196 |
10.6.1 Fixed Manipulators | p. 197 |
10.6.2 Expandable Manipulators | p. 197 |
10.7 Kernels | p. 198 |
10.7.1 Universal Vertex Shader Kernel | p. 199 |
10.7.2 Surface Shader Kernels | p. 201 |
10.7.3 Light Shader Kernels | p. 203 |
10.7.4 Surface Map Kernels | p. 205 |
10.7.5 Postprocessing Kernels | p. 206 |
10.8 Streams | p. 206 |
11 Control Constructs | p. 209 |
11.1 Selection | p. 210 |
11.1.1 IF | p. 211 |
11.1.2 When | p. 212 |
11.2 Iteration | p. 212 |
11.2.1 For | p. 213 |
11.2.2 While | p. 214 |
11.2.3 Do/Until | p. 214 |
11.2.4 Break/Continue | p. 214 |
12 Backends | p. 217 |
12.1 OpenGL Backends | p. 218 |
12.1.1 Input and Output Binding | p. 218 |
12.1.2 Texture Bindings | p. 219 |
12.1.3 Parameter Bindings | p. 220 |
12.2 CPU Backends | p. 220 |
12.3 The Sm Backend | p. 221 |
III Engineering | p. 223 |
13 Engineering Overview | p. 225 |
13.1 Code Organization and Build System | p. 226 |
13.2 Template Instantiation | p. 227 |
14 Intermediate Representation | p. 229 |
14.1 Reference Counting | p. 229 |
14.2 Basic Blocks | p. 230 |
14.2.1 Special Statements | p. 234 |
14.3 The Control-Flow Graph | p. 235 |
14.4 Parsing | p. 236 |
14.4.1 Basic Blocks | p. 236 |
14.4.2 Control Constructs | p. 237 |
15 Streams and Textures | p. 241 |
15.1 Stream Representation | p. 241 |
15.2 Texture Representation | p. 242 |
15.3 Stream and Texture Memory | p. 242 |
15.3.1 Memory and Storage Objects | p. 242 |
15.3.2 Finding Storages | p. 244 |
15.3.3 Transfer Operators | p. 244 |
15.3.4 Existing Implementations | p. 244 |
15.4 Future Work | p. 245 |
15.4.1 Stream Interface Improvements | p. 245 |
15.4.2 Index Streams | p. 246 |
15.4.3 Reductions | p. 246 |
15.4.4 Stream Ordering | p. 246 |
15.4.5 Memory Abstraction Improvements | p. 247 |
16 Optimization | p. 249 |
16.1 Copy Propagation and Forward Substitution | p. 249 |
16.2 Dead Code Removal | p. 251 |
16.2.1 Block Predecessors | p. 252 |
16.2.2 Reaching Definitions | p. 252 |
16.2.3 Use-Def Chains | p. 252 |
16.2.4 Live and Dead Code | p. 253 |
16.3 Graph Straightening | p. 253 |
16.4 Future Work | p. 254 |
16.4.1 Eliminating Redundancies | p. 254 |
16.4.2 Constant Folding and Uniform Lifting | p. 255 |
16.4.3 Algebraic Simplification | p. 256 |
16.4.4 Conditional Assignment | p. 257 |
16.4.5 Static Single Assignment and Other Forms | p. 257 |
17 Backend | p. 261 |
17.1 The Backend Interface | p. 261 |
17.2 Linear Register Allocation | p. 263 |
17.3 Transformers | p. 263 |
17.3.1 Splitting Long Tuples | p. 264 |
17.3.2 Input and Output Conversion | p. 265 |
17.3.3 Texture Indexing Conversion | p. 266 |
17.4 Future Work | p. 266 |
17.4.1 New Backends | p. 266 |
17.4.2 Better Transformations | p. 267 |
17.4.3 Better Reuse | p. 267 |
17.4.4 Instruction Count Virtualization | p. 268 |
17.4.5 Data-Dependent Control Flow Virtualization | p. 268 |
Bibliography | p. 271 |
Index | p. 285 |