DX 9,10,11?

Started by
9 comments, last by jojo1704 13 years, 1 month ago
Hello guys!
Being a C programmer that wants to get into DirecX, which version of DirectX would you recommend atm?

Version 11 only runs on my machine when enabling D3D_DRIVER_TYPE_REFERENCE as I only have DX10 compatible hardware, which slows down the program alot. I might get new hardware soon so should I stick with 11 or learn 9 / 10?

Thanks for your replies!

Jojo
Advertisement
I think as long as you stay away from DX9's fixed function pipeline (you should be only using shaders) you should be fine with any of them. I'd be pretty annoyed trying to develop on a reference driver as I'd imagine it would be pretty painfully slow.

The techniques you learn and knowledge you gain will still be applicable no matter which version you develop for. In your case I'd just use DX10 if you can support it (unless you really want to get into the windowsXP market anytime soon), in which case I would start messing with DX9 with shaders. It's not that difficult to switch from one to the other as they all do essentially the same thing, with a few new tweaks and features.
[size=2]My Projects:
[size=2]Portfolio Map for Android - Free Visual Portfolio Tracker
[size=2]Electron Flux for Android - Free Puzzle/Logic Game
IMHO D3D10, as it's very close to D3D11. D3D9 is a little different from D3D10/11 and even if D3D9 hardware is (very) present still, I'm not sure there really is any reason in getting started with an 'old' and outdated API. If you check most new AAA games for PC use D3D11. If you do get some D3D11 hw, switch over to dx11, the transition from 10 to 11 is easy.

Version 11 only runs on my machine when enabling D3D_DRIVER_TYPE_REFERENCE as I only have DX10 compatible hardware, which slows down the program alot. I might get new hardware soon so should I stick with 11 or learn 9 / 10?
See: http://msdn.microsoft.com/en-us/library/ff476876%28v=vs.85%29.aspx

You can create a DX11 device even on DX9-only compatible hardware (without using the reference driver).

The only reason to use DX9 is to support WindowsXP.
There is no reason to use DX10.
If you don't care about WinXP support, then use DX11.

]See: http://msdn.microsof...v=vs.85%29.aspx

You can create a DX11 device even on DX9-only compatible hardware (without using the reference driver).

The only reason to use DX9 is to support WindowsXP.
There is no reason to use DX10.
If you don't care about WinXP support, then use DX11.


I tried setting the device to DX10 but it makes no difference. I can still only run it with reference drivers.

Could you please tell me what exactly I have to do?
You probably have to update your graphic-cards driver to a newer version.
IMO there is no reason whatsoever to learn D3D10 any more; it has been completely superseded by D3D11 in every way. As mentioned above, using a downlevel feature level in your initialization code should normally be fine. The fact that your code only runs on the reference device suggests that either (1) you're doing something wrong, or (2) you need to update your drivers, or (3) you need to update your DirectX. Do (2) and (3) first and if the problem persists then post some code, and maybe some information about what - if any - errors you get when you try to run it.

D3D9 still has it's uses, not least if you want to eventually run your program on Windows XP machines. It's possible to write very D3D10/11-ish code in D3D9 which can ease the porting path if you eventually ever want to upgrade. About the only use I find for the fixed pipeline these days is small test programs and you can safely assume that any hardware will have shaders available.

Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls.

I updated everything and still got the error, but then checked Microsofts way of doing it.

In the DirectX Sample Browser Tutorials for DX11 the feature levels are implemented and work perfectly with Hardware drivers on my machine. However when I try to implement their approach in my code it doesn't work. "My code" is the code from www.directxtutorials.com. Do I need to specify more than the feature level array, the number of feature levels and a pointer to output the used feature level in the CreateDevice Method?
Nobody knows an answer?
If Microsoft's works but your's doesn't then you're doing something wrong. Unfortunately www.directxtutorials.com seems to have been taken over by a domain squatter so I can't check it out, but if I was a betting man I'd guess that you've changed something like your DXGI_SWAP_CHAIN_DESC format to something that your hardware doesn't support. Here's a chunk of code I've grabbed from somewhere (can't remember, so credit to the original author whoever they are) that works fine for me on a machine that only supports D3D10.

HRESULT hr = S_OK;

RECT rc;
GetClientRect (appWindow, &rc);
UINT width = rc.right - rc.left;
UINT height = rc.bottom - rc.top;

UINT createDeviceFlags = 0;

#ifdef _DEBUG
createDeviceFlags |= D3D11_CREATE_DEVICE_DEBUG;
#endif

D3D_DRIVER_TYPE driverTypes[] =
{
D3D_DRIVER_TYPE_HARDWARE,
D3D_DRIVER_TYPE_WARP
};

UINT numDriverTypes = _countof (driverTypes);

D3D_FEATURE_LEVEL featureLevels[] =
{
D3D_FEATURE_LEVEL_11_0,
D3D_FEATURE_LEVEL_10_1,
D3D_FEATURE_LEVEL_10_0
};

UINT numFeatureLevels = _countof (featureLevels);
D3D_FEATURE_LEVEL featureLevelOut;
DXGI_SWAP_CHAIN_DESC sd;

ZeroMemory (&sd, sizeof (sd));
sd.BufferCount = 1;
sd.BufferDesc.Width = width;
sd.BufferDesc.Height = height;
sd.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
sd.BufferDesc.RefreshRate.Numerator = 60;
sd.BufferDesc.RefreshRate.Denominator = 1;
sd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
sd.OutputWindow = appWindow;
sd.SampleDesc.Count = 1;
sd.SampleDesc.Quality = 0;
sd.Windowed = TRUE;

D3D_DRIVER_TYPE driverType;

createDeviceFlags |= D3D11_CREATE_DEVICE_SINGLETHREADED;

for (UINT driverTypeIndex = 0; driverTypeIndex < numDriverTypes; driverTypeIndex++)
{
driverType = driverTypes[driverTypeIndex];
hr = D3D11CreateDeviceAndSwapChain (NULL, driverType, NULL, createDeviceFlags,
featureLevels, numFeatureLevels, D3D11_SDK_VERSION,
&sd, &d3d_SwapChain, &d3d_Device, &featureLevelOut,
&d3d_Context);

if (SUCCEEDED (hr))
break;
}

Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls.

This topic is closed to new replies.

Advertisement