|
|
Just as vertex shaders operate on a single vertex, pixel shaders operate on a single pixel. Pixel shaders' instructions break down into two categories: those that work on the color and alpha blending and those that work on texture addressing. Generally you can perform a color and/or alpha blending operation or a texture addressing operation with a single pixel shader instruction.
While vertex shaders are straightforward, pixel shaders are a bit more idiosyncratic since they more closely mimic the underlying hardware, and the hardware is evolving. Pixel shader versions 1.0 though 1.3 tend to show the influence of hardware manufactured by NVIDIA, while version 1.4 exposes the way the ATI hardware works. Version 2.0 shaders introduce yet another level of features while removing or subsuming some of the capabilities of the previous versions and provide a better experience.
Like vertex shaders, you can reference individual pieces of a register; in the case of pixel shaders, these are specified by rgb and a instead of xzy and w. Unlike vertex shaders, component swizzles are not supported by the pixel shader specification until PS 2.0.
In PS 1.0–1.3, the r, g, and b components are treated together as a single RGB color component, while the a component is treated as alpha, which can be routed separately. Whereas with PS 1.4 and 2.0, you can mask out or extract the components independently.
DirectX 9 introduced some significant changes with the pixel shader 2.0 specification. Flow control, higher-precision registers, separate texture coordinate and texture sampling registers, and a new output target are some of the significant changes introduced. DirectX 9 also introduced a high-level-shading-language (HLSL) that at the time of this writing is still being specified. |
While I've made every effort to try to get the basics of the changes up to date, I'm still awaiting the third beta release for DirectX 9, so I suggest that you get the latest version of the DirectX 9 SDK and check there for the latest changes. The http://www.directx.com Web site will also post any updates or errata for the documentation published in this book.
|
|