Direct3D9 GPU Hacks

http://aras-p.info/texts/D3D9GPUHacks.html

 

Direct3D9 GPU Hacks

I've been trying to catch up what hacks GPU vendors have exposed in Direct3D9, and turns out there's a lot of them!

If you know more hacks or more details, please let me know! (mail or comment on my blog post).

Most hacks are exposed as custom ("FOURCC") formats. So to check for that, you do CheckDeviceFormat. Here's the list (Usage column codes: DS=DepthStencil, RT=RenderTarget; Resource column codes: tex=texture, surf=surface). More green = more hardware support.

FormatUsageResourceDescriptionNVIDIA GeForceATI RadeonIntel
Shadow mapping
D3DFMT_D16DStexSample depth buffer directly as shadow map.3+HD 2xxx+?
D3DFMT_D24X8DStex3+HD 2xxx+?
Depth Buffer As Texture
DF16DStexRead depth buffer as texture. 9500+?
DF24DStex X1300+?
INTZDStex8+HD 4xxx+?
RAWZDStex6 & 7 ?
Anti-Aliasing related
RESZRTsurfResolve MSAA'd depth stencil surface into non-MSAA'd depth texture. HD 4xxx+?
ATOC0surfTransparency anti-aliasing.7+ ?
SSAA0surf7+ ?
All ATI SM2.0+ hardware 9500+?
n/a  Coverage Sampled Anti-Aliasing[6]8+ ?
Texturing
ATI10texATI1n & ATI2n texture compression formats.8+X1300+?
ATI20tex6+9500+?
DF24DStexFetch 4: when sampling 1 channel texture, return four touched texel values[1]. Check for DF24 support. X1300+?
Misc
NULLRTsurfDummy render target surface that does not consume video memory.6+HD 4xxx+?
NVDB0surfDepth Bounds Test.6+ ?
R2VB0surfRender into vertex buffer.6 & 79500+?
INST0surfGeometry Instancing on pre-SM3.0 hardware. 9500+?

Native Shadow Mapping

Native support for shadow map sampling & filtering was introduced ages ago by NVIDIA. Turns out ATI also implemented the same feature for it's DX10 level cards. Yay!

The usage is quite simple; just create a texture with regular depth/stencil format and render into it. When reading from the texture, one extra component in texture coordiantes will be the depth to compare with. Compared & filtered result will be returned.

Also useful:

  • Creating NULL color surface to keep D3D runtime happy and save on video memory.

 

Depth Buffer as Texture

For some rendering schemes (anything with "deferred") or some effects (SSAO, depth of field, volumetric fog, ...) having access to a depth buffer is needed. If native depth buffer can be read as a texture, this saves both memory and a rendering pass or extra output for MRTs.

Depending on hardware, this can be achieved via INTZ, RAWZ, DF16 or DF24 formats:

  • INTZ is for recent hardawre from both NVIDIA and ATI. According to ATI [1], it also allows using stencil buffer while rendering. Also allows reading from depth texture while it's still being used for depth testing (but not depth writing). Not sure if those capabilities apply to NVIDIA.
  • RAWZ is for GeForce 6 & 7 series only. Depth is specially encoded into four channels of returned value.
  • DF16 and DF24 is for ATI cards, including older cards that don't support INTZ.
Also useful when using depth textures:
  • Creating NULL color surface to keep D3D runtime happy and save on video memory.
  • RESZ allows resolving multisampled depth surfaces into non-multisampled depth textures (result will be sample zero for each pixel).

 

Depth Bounds Test

Direct equivalent of GL_EXT_depth_bounds_test OpenGL extension. See [3] for more information.

Transparency Anti-Aliasing

NVIDIA exposes two controls: transparency multisampling (ATOC) and transparency supersampling (SSAA) [5]. ATI says that all Radeons since 9500 support "alpha to coverage" [1].

Render Into Vertex Buffer

Similar to "stream out" or "memexport" in other APIs/platforms. See [2] for more information. Apparently some NVIDIA GPUs (or drivers?) support this as well.

Geometry Instancing

Instancing is supported on all Shader Model 3.0 hardware by Direct3D 9.0c, so there's no extra hacks necessary there. ATI has exposed a capability to enable instancing on their Shader Model 2.0 hardware as well. Check for "INST" support, and do dev->SetRenderState (D3DRS_POINTSIZE, kFourccINST); at startup to enable instancing.

I can't find any document on instancing from AMD now. Other references: [7] and [8].

References

All this information gathered mostly from:

  1. Advanced DX9 Capabilities for ATI Radeon Cards (pdf)
  2. ATI R2VB Programming (pdf)
  3. NVIDIA GPU Programming Guide (pdf)
  4. ATI Tesselation
  5. NVIDIA Transparency AA
  6. NVIDIA Coverage Sampled AA
  7. Humus' Instancing Demo
  8. Arseny's article on particles

 

Changelog

  • 2009 11 21: Added instancing on SM2.0 hardware.
  • 2009 11 20: Added Fetch-4, CSAA.
  • 2009 11 20: Initial version.
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值