Chapter 1. Shader 101
It seems an obvious question to ask at the beginning of an HLSL and shader book; what exactly is a shader? It’s a small program or algorithm written explicitly to run on a computer Graphics Processing Unit (GPU). It provides a way for developers to extend the rendering capabilities of the GPU. Any program that works closely with graphics will benefit from using shaders. The video game industry spins off custom shaders by the thousands; they are as vital to game projects as business entity classes are to line-of-business (LOB) applications. Nothing prohibits business programmers from experimenting with shaders in their LOB applications; in fact, recent trends in user interface (UI) design and information visualization cry out for shader use.
Because shaders run at the kernel level of the GPU, they are automatically parallelized by the GPU hardware and are extremely fast at manipulating graphic output. Typically, the GPU can process shaders several orders of magnitude faster than if the shader code is run on a CPU.
Why Should XAML Developers Learn HLSL?
If you are an XAML developer, I’ll wager you’ve heard about pixel shaders. In fact, you may be using some of these effects in your application already. WPF introduced the DropShadowEffect and BlurEffect in .NET 3.5 SP1 and both of these classes take advantage of pixel shaders. Silverlight added pixel shaders in Silverlight 3. The Windows Phone team disappointed developers by dropping support for shaders before the ...