Sign in to follow this  

Identifying device caps

This topic is 4835 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi there, I have a quick question about dtermining what type of device to create based on the identifier struct. I have a book here that tells me what to call but it doesnt tell me how to tell based on the identfiers information on what device to create, weather to use D3DDEVTYPE_HAL or D3DDEVTYPE_REF. Any info appreciated.

Share this post


Link to post
Share on other sites
You never really want to use the reference device (D3DDEVTYPE_REF). This implements all the Direct3D features in software and is excruciatingly slow. It would never be used in a product. It is just for testing purposes and can emulate features that your hardware doesn't support but usually at less than one frame per second [smile]

Use CAPS to test for active feature on the graphics hardware (e.g. programmable shaders).

Share this post


Link to post
Share on other sites
REF is only available if you have installed the developer version of DirectX. It does software vertex transform AND software texture/framebuffer processing. It's terribly slow.

SW is only available if the user (or your installer) has installed a pluggable software device. These are not common. SW devices may be optimized for certain bit depths, and faster than REF, but certainly slower than HAL.

HAL means that, at a minimum, you will get hardware texturing and framebuffers. That's what you should be using, unless you use REF to investigate a potential driver bug.

You should also first try to specify PUREDEVICE and HARDWARE_VERTEXPROCESSING when calling CreateDevice(). If this fails, call it again, and instead specify SOFTWARE_VERTEXPROCESSING. This will make sure that you get the fastest hardware support for cards that have it, but fall back to the still-decent software vertex processor for cards that don't (such as about 60% of all cards out there).

Share this post


Link to post
Share on other sites
Quote:
Original post by hplus0603
You should also first try to specify PUREDEVICE and HARDWARE_VERTEXPROCESSING when calling CreateDevice(). If this fails, call it again, and instead specify SOFTWARE_VERTEXPROCESSING. This will make sure that you get the fastest hardware support for cards that have it, but fall back to the still-decent software vertex processor for cards that don't (such as about 60% of all cards out there).


You can tell if hardware processing is available by checking one of the caps (something like HWTRANSFORMANDLIGHT). Some drivers can take 2-3 seconds to realize they're going to fail so this check is a way to avoid that cost.

Also, if you are going to require a certain vertex shader version, and hardware doesn't support it, you might want to create a mixed or software device despite the card having hardware processing available. This will allow the software path to emulate the shader code.

Share this post


Link to post
Share on other sites
Quote:
Original post by Namethatnobodyelsetook
You can tell if hardware processing is available by checking one of the caps (something like HWTRANSFORMANDLIGHT). Some drivers can take 2-3 seconds to realize they're going to fail so this check is a way to avoid that cost.

Also, if you are going to require a certain vertex shader version, and hardware doesn't support it, you might want to create a mixed or software device despite the card having hardware processing available. This will allow the software path to emulate the shader code.

Seconded. Straight out of my code:

// Get device type //
if(m_theCaps.DevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT)
{
dwFlags = D3DCREATE_HARDWARE_VERTEXPROCESSING;
m_dwVPType = 0;
Log("INIT: Hardware vertex processing enabled\n");
}
else
{
dwFlags = D3DCREATE_SOFTWARE_VERTEXPROCESSING;
m_dwVPType = D3DUSAGE_SOFTWAREPROCESSING;
Log("INIT: Software vertex processing enabled\n");
}
if(m_theCaps.DevCaps & D3DDEVCAPS_PUREDEVICE)
{
dwFlags |= D3DCREATE_PUREDEVICE;
Log("INIT: Pure device selected\n");
}

Share this post


Link to post
Share on other sites

This topic is 4835 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this