DeviceType's, which to choose first and then second and so on?

Started by
4 comments, last by Evil Steve 15 years, 7 months ago
I'm creating my first device initialization system and I'm curious, as I couldn't find any internet information on it, which to choose first, then second and third, so on. ie: Try to get hardware support... else try to get software support... else try to get reference support... else try ? Thanks, Devin
Advertisement
None. You don't try one and see if it fails, you check for support, then create the correct device type.

E.g. to check if you should use software or hardware vertex processing, you should check the DevCaps:
DWORD dwFlags;if(caps.DevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT)   dwFlags = D3DCREATE_HARDWARE_VERTEXPROCESSING;else   dwFlags = D3DCREATE_SOFTWARE_VERTEXPROCESSING;


This link may be of relevance to you.


EDIT: As for the actual device type, you only have a choice of D3DDEVTYPE_HAL. The software device doesn't exist unless you write one, and the reference device is only for testing, and only exists if you have the SDK installed (I.e. not on end-user machines).
Quote:EDIT: As for the actual device type, you only have a choice of D3DDEVTYPE_HAL. The software device doesn't exist unless you write one, and the reference device is only for testing, and only exists if you have the SDK installed (I.e. not on end-user machines).


Thanks I didn't know that and was confused. Great info.

-Devin

[Edited by - devronious on September 17, 2008 9:20:05 AM]
Quote:Original post by devronious
[qoute]EDIT: As for the actual device type, you only have a choice of D3DDEVTYPE_HAL. The software device doesn't exist unless you write one, and the reference device is only for testing, and only exists if you have the SDK installed (I.e. not on end-user machines).


Thanks I didn't know that and was confused. Great info.

-DevinTo expand on it a little more, the HAL device means "Use the hardware", and will always be available - I'm not aware of any situations it wouldn't be available, if the machine has no graphics card or drivers, then Direct3DCreate9() will return NULL so you won't even get as far as creating a device.
The software device is only available if you create one yourself and register it with IDirect3D9::RegisterSoftwareDevice, and is used for writing software renderers (Which nobody really does these days, at least not with D3D9). I can't think of any reason you'd want to do this in a normal 3D application.
The reference rasteriser is just that; a reference device. It's designed to be "perfect hardware", and all graphics cards should behave exactly as it does. The only reason you'd want to use this is when you're testing a feature that your card doesn't support (E.g. if you need SM3 and you only have a GeForce 2), or if you're testing a suspected driver bug - the refrast is correct, and if there's a difference in output then it's likely a driver bug. The reference rasteriser is only available on machines with the DirectX SDK installed, so the average user won't have it. And you wouldn't want to let an end user use it anyway, since it's incredibly slow.
Ahhhh, that's making complete sense. Thanks for the explanation. I remember looking at software of different types and having the ability to select hardware or software, perhaps that was OpenGL only or something. Well this makes things much easier.

Thanks Again,

Devin
Quote:Original post by devronious
Ahhhh, that's making complete sense. Thanks for the explanation. I remember looking at software of different types and having the ability to select hardware or software, perhaps that was OpenGL only or something. Well this makes things much easier.
You can chose to run vertex shaders in hardware or software, if that's what you were thinking of. You'd always want hardware vertex processing, unless your graphics card doesn't support the shader version you need (Since you can still run complex shaders in software without too great a performance penalty). Every card since the GeForce 2 supports fixed function vertex processing.

This topic is closed to new replies.

Advertisement