GPU Programming Guide.pdf

(999 KB) Pobierz
NVIDIA GPU Programming Guide
Version 2.5.0
1
238833662.001.png
Notice
ALL NVIDIA DESIGN SPECIFICATIONS, REFERENCE BOARDS, FILES, DRAWINGS,
DIAGNOSTICS, LISTS, AND OTHER DOCUMENTS (TOGETHER AND SEPARATELY,
“MATERIALS”) ARE BEING PROVIDED “AS IS.” NVIDIA MAKES NO WARRANTIES,
EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO THE
MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF
NONINFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A PARTICULAR
PURPOSE.
Information furnished is believed to be accurate and reliable. However, NVIDIA
Corporation assumes no responsibility for the consequences of use of such
information or for any infringement of patents or other rights of third parties that
may result from its use. No license is granted by implication or otherwise under
any patent or patent rights of NVIDIA Corporation. Specifications mentioned in this
publication are subject to change without notice. This publication supersedes and
replaces all information previously supplied. NVIDIA Corporation products are not
authorized for use as critical components in life support devices or systems without
express written approval of NVIDIA Corporation.
Trademarks
NVIDIA, the NVIDIA logo, GeForce, and NVIDIA Quadro are registered trademarks
of NVIDIA Corporation. Other company and product names may be trademarks of
the respective companies with which they are associated.
Copyright
© 2006 by NVIDIA Corporation. All rights reserved.
H ISTORY OF M AJOR R EVISIONS
Version Date
Changes
2.5.0
03/01/2006 Updated Performance Tools and PerfHUD-
related sections
2.4.0
07/08/2005 Updated cover
Added GeForce 7 Series content
2.3.0
02/08/2005 Added 2D & Video Programming chapter
Added more SLI information
2.2.1
11/23/2004 Minor formatting improvements
2.2.0
11/16/2004 Added normal map format advice
Added ps_3_0 performance advice
Added General Advice chapter
2.1.0
07/20/2004 Added Stereoscopic Development chapter
2.0.4
07/15/2004 Updated MRT section
2
238833662.002.png 238833662.003.png
NVIDIA GPU Programming Guide
Table of Contents
3.1.
List of Tips .............................................................................. 17
3.2.
Batching.................................................................................. 19
3.2.1.
Use Fewer Batches
19
3.3.
Vertex Shader.......................................................................... 19
3.3.1.
Use Indexed Primitive Calls
19
3.4.
Shaders .................................................................................. 20
3.4.1.
Choose the Lowest Pixel Shader Version That Works
20
3.4.2.
20
3.4.3.
Choose the Lowest Data Precision That Works
21
3.4.4.
Save Computations by Using Algebra
22
3.4.5.
Don’t Pack Vector Values into Scalar Components of Multiple
Interpolants
23
3.4.6.
Don’t Write Overly Generic Library Functions
23
3
3.4.7.
Don’t Compute the Length of Normalized Vectors
23
3.4.8.
Fold Uniform Constant Expressions
24
3.4.9.
Don’t Use Uniform Parameters for Constants That Won’t Change
Over the Life of a Pixel Shader
24
3.4.10.
Balance the Vertex and Pixel Shaders
25
3.4.11.
Push Linearizable Calculations to the Vertex Shader If You’re Bound
by the Pixel Shader
25
3.4.12.
Use the mul() Standard Library Function
25
4.1.
Shader Model 3.0 Support ........................................................ 33
4.1.1.
Pixel Shader 3.0
34
4.1.2.
Vertex Shader 3.0
35
4.1.3.
Dynamic Branching
35
4.1.4.
Easier Code Maintenance
36
4.1.5.
Instancing
36
4.1.6.
Summary
37
4.2.
GeForce 7 Series Features ........................................................ 37
4.3.
Transparency Antialiasing ......................................................... 37
4.4.
sRGB Encoding ........................................................................ 38
4
NVIDIA GPU Programming Guide
5
Zgłoś jeśli naruszono regulamin