Archived

This topic is now archived and is closed to further replies.

MarkO

Mixed_vertexprocessing?

Recommended Posts

I am trying to figure out how and perhaps when i would want to try to enable harware and or mixed vertex processing when i create my device. Right now I think lighting is potentially the only thing i am looking to use hardware accel on...so when i create my initial device i check to see if the hardware is capable of hardware directional and positional lighting and then try to create a mixed_vertexprocessing device The problem is my roomate has a voodoo3 card which the caps say can do those two types of lighting...however when i try to create a mixed_vertexprocessing device it fails in the creation...it does however work when creating the software_vertexprocessing At this stage if I dont plan on doing any special graphics stuff outside of perhaps the lighting is there any/many advatages to using the mixed/hardware_vertexprocessing My goal is to make our first project compatible with older videocards such as the TNT2 and voodoo3''s etc. I have read as much as i can in the MSSDK and my head is still spinning Any help would be appreciated

Share this post


Link to post
Share on other sites
Hardware vertex processing means hardware T&L (Like the GeForce cards etc).

The Voodoo cards don''t do hardware T&L, they only do hardware rasterisation, so all vertex processing can only be done in software on the host CPU.

Mixed vertex processing implies you''ll be using both hardware T&L and software T&L - since the Voodoo (and any pre-T&L card like TNTs, G400s etc) doesn''t support the HW T&L creating a mixed device will fail!


New graphics cards which are coming out support vertex shaders, these are a programmable version of hardware T&L. Cards like GeForce1 and 2 however don''t support programmable shaders in hardware so to use a vertex shader on one of those cards you must use software vertex processing. If you created the device as only software VP you''d be throwing away the extra acceleration you get with hardware T&L.

The following code snippets from our engine startup might make things clearer - our engine uses vertex shaders for some things:

  
D3DCAPS8 caps;
m_pD3D->GetDeviceCaps( uiAdapter, D3DDEVTYPE_HAL, &caps );

...


// work out how much vertex processing can be done in hardware

if (caps.DevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT)
{
// Device has some vertex processing in hardware


// we need vertex shaders, this is a H/W T&L device

// so check if the shader version is what we require

// if no support we must use mixed mode vertex processing

if ( caps.VertexShaderVersion < D3DVS_VERSION(1,1) )
{
// device doesn''t do 1.1 vertex shaders in hardware

// but it still does fixed function T&L (GeForce1 etc)


info->dwCreationFlags = D3DCREATE_MIXED_VERTEXPROCESSING;
info->dwFixedVPUsage = 0;
info->dwShaderVPUsage = D3DUSAGE_SOFTWAREPROCESSING;
}
else
{
// device supports hardware vertex shaders

// (programmable T&L) - (GeForce3, ATI R200 etc)


info->dwCreationFlags = D3DCREATE_HARDWARE_VERTEXPROCESSING;
info->dwFixedVPUsage = 0;
info->dwShaderVPUsage = 0;

// if device can be pure, do it

// (pure devices can be faster but don''t allow any Get*

// calls to be made so GetRenderState etc will fail on pure)

if (caps.DevCaps & D3DDEVCAPS_PUREDEVICE )
{
info->dwCreationFlags |= D3DCREATE_PUREDEVICE;
}
}
}
else
{
// device doesn''t do any hardware vertex processing

// (TNT, Voodoo, Kyro, G400, Mystique, ViRGE etc etc)

info->dwCreationFlags = D3DCREATE_SOFTWARE_VERTEXPROCESSING;
info->dwFixedVPUsage = D3DUSAGE_SOFTWAREPROCESSING;
info->dwShaderVPUsage = D3DUSAGE_SOFTWAREPROCESSING;
}


info->dwCreationFlags is what gets passed to CreateDevice.

info->dwFixedVPUsage is what gets passed to CreateVertexBuffer etc when the buffer is intended for fixed function processing (using FVFs).

info->dwShaderVPUsage us what gets passed to CreateVertexBuffer etc when the buffer will be used with vertex shaders (programmable vertex processing).


--
Simon O''''Connor
Creative Asylum Ltd
www.creative-asylum.com

Share this post


Link to post
Share on other sites
Many thanks for the explanation...
After jumping over to dx8 from ddraw7 and d3d7 a lot of the device setup checking is still wierd to me...
but I am slowly getting the hang of it and more of it is making sense to me.

Again thanks for the help in this post and other posts that i have been reading from other peoples subjects

Share this post


Link to post
Share on other sites