GPU Programming Guide.pdf
(
999 KB
)
Pobierz
NVIDIA GPU Programming Guide
Version 2.5.0
1
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
NVIDIA GPU Programming Guide
Table of Contents
Chapter 1. About This Document ..................................................................9
1.1.
Introduction ..............................................................................9
Chapter 2. How to Optimize Your Application ............................................11
2.1.
Making Accurate Measurements ................................................ 11
2.2.
Finding the Bottleneck.............................................................. 12
2.2.1.
Understanding Bottlenecks 12
2.2.2.
Basic Tests 13
2.2.3.
Using PerfHUD 14
2.3.
Bottleneck: CPU ....................................................................... 14
2.4.
Bottleneck: GPU....................................................................... 15
Chapter 3. General GPU Performance Tips .................................................17
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.
Compile Pixel Shaders Using the
ps_2_a
Profile
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
3.4.13.
Use
D3DTADDRESS_CLAMP
(or
GL_CLAMP_TO_EDGE
) Instead of
saturate()
for Dependent Texture Coordinates 26
3.4.14.
Use Lower-Numbered Interpolants First 26
3.5.
Texturing ................................................................................ 26
3.5.1.
Use Mipmapping 26
3.5.2.
Use Trilinear and Anisotropic Filtering Prudently 26
3.5.3.
Replace Complex Functions with Texture Lookups 27
3.6.
Performance............................................................................ 29
3.6.1.
Double-Speed Z-Only and Stencil Rendering 29
3.6.2.
Early-Z Optimization 29
3.6.3.
Lay Down Depth First 30
3.6.4.
Allocating Memory 30
3.7.
Antialiasing.............................................................................. 31
Chapter 4. GeForce 6 & 7 Series Programming Tips ...................................33
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
4.5.
Separate Alpha Blending........................................................... 38
4.6.
Supported Texture Formats ...................................................... 39
4.7.
Floating-Point Textures............................................................. 40
4.7.1.
Limitations 40
4.8.
Multiple Render Targets (MRTs) ................................................ 40
4.9.
Vertex Texturing ...................................................................... 42
4.10.
General Performance Advice ..................................................... 42
4.11.
Normal Maps ........................................................................... 43
Chapter 5. GeForce FX Programming Tips ..................................................45
5.1.
Vertex Shaders ........................................................................ 45
5.2.
Pixel Shader Length ................................................................. 45
5.3.
DirectX-Specific Pixel Shaders ................................................... 46
5.4.
OpenGL-Specific Pixel Shaders .................................................. 46
5.5.
Using 16-Bit Floating-Point........................................................ 47
5.6.
Supported Texture Formats ...................................................... 48
5.7.
Using
ps_2_x
and
ps_2_a
in DirectX ....................................... 49
5.8.
Using Floating-Point Render Targets .......................................... 49
5.9.
Normal Maps ........................................................................... 49
5.10.
Newer Chips and Architectures.................................................. 50
5.11.
Summary ................................................................................ 50
Chapter 6. General Advice...........................................................................51
6.1.
Identifying GPUs ...................................................................... 51
6.2.
Hardware Shadow Maps ........................................................... 52
Chapter 7. 2D and Video Programming.......................................................55
7.1.
OpenGL Performance Tips for Video .......................................... 55
7.1.1.
POT with and without Mipmaps 56
7.1.2.
NP2 with Mipmaps 56
7.1.3.
NP2 without Mipmaps (Recommended) 57
7.1.4.
Texture Performance with Pixel Buffer Objects (PBOs) 57
Chapter 8. NVIDIA SLI and Multi-GPU Performance Tips...........................59
5
Plik z chomika:
darekisap
Inne pliki z tego folderu:
DirectX 3D Graphics Programming Bible.pdf
(53946 KB)
GameProgrammingGems5-CDROM.rar
(113929 KB)
Game Physics.pdf
(70470 KB)
3D Geometry Tuts.rar
(11543 KB)
Cutting Edge Direct3D Programming.chm
(4949 KB)
Inne foldery tego chomika:
Biblioteka Informatyka
Courseware
Kurs Flash
Kurs MYSQL w PHP
Kurs_PHP
Zgłoś jeśli
naruszono regulamin