转载请注明出处为KlayGE游戏引擎,本文的永久链接为http://www.klayge.org/?p=626

在WinXP下,即使GPU支持D3D10+,也只能用D3D9的API。但实际上各个厂商都对D3D9做了一些扩展,把部分D3D10+的特性暴露给了D3D9 API。以下是一些特殊的纹理格式,通过FOURCC的方式来使用。通过CheckDeviceFormat可以检测是否支持该格式,在CreateTexture的时候传入即可。下表的源头是各厂商的GPU文档,经过Unity的Aras整理而来:

Usage列:DS=DepthStencil,RT=RenderTarget;Resource列:tex=texture,surf=surface。越绿表示越多硬件支持。

Format Usage Resource Description NVIDIA GeForce ATI Radeon Intel
Shadow mapping
D3DFMT_D16 DS tex Sample depth buffer directly as shadow map. 3+ HD 2xxx+ 965+
D3DFMT_D24X8 DS tex 3+ HD 2xxx+ 965+
Depth Buffer As Texture
DF16 DS tex Read depth buffer as texture. 9500+ G45+
DF24 DS tex X1300+
INTZ DS tex 8+ HD 4xxx+ G45+
RAWZ DS tex 6 & 7
Anti-Aliasing related
RESZ RT surf Resolve MSAA’d depth stencil surface into non-MSAA’d depth texture. HD 4xxx+ G45+
ATOC 0 surf Transparency anti-aliasing. 7+
SSAA 0 surf 7+
All ATI SM2.0+ hardware 9500+
n/a Coverage Sampled Anti-Aliasing 8+
Texturing
ATI1 0 tex ATI1n & ATI2n texture compression formats. 8+ X1300+ G45+
ATI2 0 tex 6+ 9500+ G45+
DF24 DS tex Fetch 4: when sampling 1 channel texture, return four touched texel values. Check for DF24 support. X1300+
Misc
NULL RT surf Dummy render target surface that does not consume video memory. 6+ HD 4xxx+
NVDB 0 surf Depth Bounds Test. 6+
R2VB 0 surf Render into vertex buffer. 6 & 7 9500+
INST 0 surf Geometry Instancing on pre-SM3.0 hardware. 9500+

完整的GPU扩展功能,请看: