Sign in to follow this  

DX 9,10,11?

This topic is 2492 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

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
[quote name='jojo1704' timestamp='1297901216' post='4775173']
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?[/quote]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.

Share this post


Link to post
Share on other sites
[quote name='Hodgman' timestamp='1297909943' post='4775238']
]See: [url="http://msdn.microsoft.com/en-us/library/ff476876%28v=vs.85%29.aspx"]http://msdn.microsof...v=vs.85%29.aspx[/url]

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.
[/quote]

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?

Share this post


Link to post
Share on other sites
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 [i]very[/i] 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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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.

[code] 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;
}[/code]

Share this post


Link to post
Share on other sites
[quote name='mhagain' timestamp='1298328594' post='4777268']
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.
[/quote]

Thank you for your help. I am sorry I meant www.directxtutorial.com (This site is pretty much skipping on feature levels)

The code you provided looks like the one from microsoft, or at least very similar to it. When I was debugging microsofts code I could see that my device is created with hardware drivers and D3D_FEATURE_LEVEL_10_0. In my own code I set up arrays only containing these entries and the device cannot be created which is very odd.

Share this post


Link to post
Share on other sites

This topic is 2492 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