Chapter 8: Shader Reference

OVERVIEW

Results! Why, man, I have gotten a lot of results. I know several thousand things that won't work.

--Thomas A. Edison

Chapter 8 contains detailed explanations about the vertex and pixel shader registers, instructions, macros, and other operations that can be programmed into shaders. There's a general discussion on coding style and other issues that are common to both pixel shaders and vertex shaders. Note that there's a section in this chapter that discusses new and updated shader features by DirectX release, which compliments the features and changes by shader version that can be found in the introduction to each of the vertex and pixel reference collections.

In addition, each vertex instruction contains C-like pseudocode that should give you a concrete example of how the instruction actually works. Since some of the instructions have a low precision and a high precision output simultaneously, there's a bit mask that simulates this precision restriction on the output as well. Each of these pseudocode sections look like this.

 SetSourceRegisters(); // Simulate some shader instruction WriteDestinationRegisters(); 

The SetSourceRegisters() section is some "magic" code that will take the input arguments and any modifiers (swizzles negates, etc.) and write them into some temporary source and destination register placeholders. The pseudocode then operates on that entire register (when appropriate). Then there's the SetDestinationRegisters() section that will take into consideration any destination write masks on the instruction argument and only write out those register elements.

In an effort to keep things up to date, I have provided an online version of this reference at http://www.directx.com/shader/reference/.



Real-Time Shader Programming(c) Covering Directx 9. 0
Real-Time Shader Programming (The Morgan Kaufmann Series in Computer Graphics)
ISBN: 1558608532
EAN: 2147483647
Year: 2005
Pages: 104
Authors: Ron Fosner

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net