vanattab / slimdx

Automatically exported from code.google.com/p/slimdx
MIT License
0 stars 0 forks source link

Determine if a device creation will succeed before calling "new Device(...)" #830

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hello,

I have code that needs to run on machines without D3D10 capable gfx cards (or 
indeed any gfx cards at all). On these machines I will use the WARP software 
rasterizer.

I'd like to be able to detect if a hardware device is available before calling:

new Device1(DriverType.Warp, deviceCreationFlags, FeatureLevel.Level_10_1);

Or similar. Currently the only way to do this is try it and catch the 
expception.

I believe in D3D11 you can query feature levels before creating the device? 
Something like this would be perfect.

Original issue reported on code.google.com by gro...@gmail.com on 1 Sep 2011 at 10:39

GoogleCodeExporter commented 9 years ago
This is done by attempting to call D3DxxCreateDevice() with the appropriate 
options and checking the result; we need to expose a static method on the 
Device classes to do this (next to CreateDeviceAndSwapChain) so that it can 
return a Result instead of throwing on failure.

Original comment by josh.petrie on 4 Sep 2011 at 5:45

GoogleCodeExporter commented 9 years ago
Would it not be better to expose a GetSupportedFeatureLevel method, as with 
D3D11?

Original comment by gro...@gmail.com on 6 Sep 2011 at 1:35

GoogleCodeExporter commented 9 years ago
D3D10.1 does not support being able to test for the feature level like D3D11 
does, so there's really no way for us to give you the same functionality. There 
are two ways to deal with this:

1. Use the Configuration class to disable exceptions before creating the device 
and checking the Result to see if it succeeded.

2. Just use Direct3D 11.

The second choice is preferable I think, especially since D3D11 can target all 
lower end hardware and has the same OS restrictions that 10.1 does.

Original comment by Mike.Popoloski on 15 Nov 2011 at 7:24