R2VB VS VTF

来源:互联网 发布:三星电视网络无法设置 编辑:程序博客网 时间:2024/05/29 14:29

I have been porting R2VB and VTF for all our supported cards lately. Everything works now and the performance is very much acceptable on each card. However the driver support for these features in DX9 cards is a bit shaky to say at least.


Geforces:

Geforces seem to have lots of small problems in DX9 R2VB. It's quite understandable as it's originally a ATI DX9 API hack, and has been only recently added to Geforce drivers.

Geforce 8000 series:
No support for R2VB at all. Understandable as 8000 series has very fast VTF units (same texture units usable on both pixel and vertex shaders). However for some reason all texture formats are not supported in DX9 VTF API. In DX10 API the 8000 series supports much wider selection of texture formats in vertex shaders. This seems to be a driver issue, as sampling some "not supported" texture formats in the vertex shader works just fine (even if the driver doesn't list these formats as supported ones).

Geforce 6000 and 7000 series:
These cards support USAGE_DMAP only for very limited amount of texture formats (the driver certifies the call parameters and returns null texture). As this is the only way to instruct the card to store the texture scanlines linearly, there is no correct way to use R2VB on other texture formats. You can swizzle index buffer vertex indices manually, but it's very risky as there is no documentation how the swizzling is done on each Geforce model/memory configuration. A small driver "fix" would solve this issue easily: the API could return a valid texture pointer like all ATI cards do even if the USAGE_DMAP is not supported for the created texture format.

This issue limits DX9 R2VB formats on Geforces 6000 and 7000 series to:
A16B16G16R16
G16R16F
A16B16G16R16F
R32F
G32R32F
A32B32G32R32F

This is still considerably better than 6000 and 7000 series VTF support (only A32B32G32R32F and R32F). R2VB is much faster also on these cards, as they only have very limited amount of dedicated texture samplers for VTF.


Radeons:

Unsurprisingly all Radeons support DX9 R2VB better. All texture formats that have equivalent vertex format are usable. Only HD 2000 and 3000 series support VTF, but both support very generous amount of different formats in DX9 (basically all the same formats can be sampled in vertex shaders that can be in pixel shaders).

But there are minor problems in the Radeon drivers as well. All Radeons seems to have a similar driver bug in both of their VFT and R2VB implementation.

VTF: If you change the VFT texture (SetTexture), but do not change the stream source (SetStreamSource), the Radeon HD drivers do not notice the texture change at all, and the card continues to sample the old texture in the vertex shader. However if you use the same texture also in the pixel shader, the change is notified correctly, and the correct updated texture pointer is also used in the vertex shader.

R2VB: Similar bug also affects R2VB. If you change the D3DDMAPSAMPLER texture, the driver does not notice this change until you change the stream source associated with the same stream id as the R2VB_VSMP_OVR_DMAP.

This bug affects only scenarios where you render the same static vertex buffer several times in a row, and only change the vertex texture (or R2VB stream). Easiest way around this issue is to alternate between 2 identical vertex buffers. However it wastes some memory. Geforce drivers do not have this issue in their VTF or R2VB implementation.

I used the most recent WHQL certified Geforce and Radeon drivers for my testing

 

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/geoscience/archive/2009/09/06/4525500.aspx

原创粉丝点击