This topic is not a problem or question - it's an explaination, so if you know everything, then get out :P


So, to the point:
As I got frustrated trying to properly and fully enumerate all possible rendering modes on all possible devices of all possible adapters in the system, i decided to visualize it.



The image shows D3D9's internal object dependency.
We can see, that for every "Adapter" there are possible "Devices".
For every "Device" there are "Display Formats".
For every "Display Format" there are "Display Resolutions" a "Fullscreen Mode" and "Windowed Mode".
For every Mode there is a "BackBuffer Format".
For every "BackBuffer Format" there is a "Multisampling Type" and "Depth/Stencil Format"
For every "Depth/Stencil Format" there is also "Multisampling Type"

So:
I)? We get number of adapters (IDirect3D9::GetAdapterCount)
II) For Every Adapter do:
? ?1) Get valid Devices. A devices is considered 'valid' if there are valid Capabilities for it,
? ? ? returned by IDirect3D9::GetDeviceCaps. Also the "IDirect3D9::GetDeviceCaps" call must return
? ? ? S_OK. if you really wish - you can skip this test, since almost all GFX adapters do support HAL
? ?2) For every valid device (or just for HAL, since 99% of all apps use HAL) do:
? ? ? a) Get Valid Display Formats. Display format is considered valid if there is at least 1 Display
? ? ? ? ?Resolution for it. So we do "IDirect3D9::GetAdapterModeCount" for every format.
? ? ? b) For every valid format (with at least 1 display resolution) do:
? ? ? ? ?- ) loop through 0 to (valid_display_resolutions-1) with a call to
? ? ? ? ? ? ?IDirect3D9::EnumAdapterModes.
? ? ? ? ?--) for Windowed mode do:?
? ? ? ? ? ? ?x? ?) Get valid backbuffer formats (IDirect3D9::CheckDeviceType must return S_OK)
? ? ? ? ? ? ?xx? ) For every valid backbuffer format check for valid Depth/stencil formats
? ? ? ? ? ? ? ? ? ?(IDirect3D9::CheckDeviceFormat) and also confirm, that a valid depth/stencil
? ? ? ? ? ? ? ? ? ?can be used on actual device, in actual display format, and actual backbuffer
? ? ? ? ? ? ? ? ? ?format (IDirect3D9::CheckDepthStencilMatch)
? ? ? ? ? ? ?xxx ) Check for valid multisample types. Repeat IDirect3D9::CheckDeviceMultiSampleType
? ? ? ? ? ? ? ? ? ?for actual backbuffer format.
? ? ? ? ? ? ?xxxx) for every valid babkcuffer-multisampling type, check this type again, only this
? ? ? ? ? ? ? ? ? ?time for depth/stencil format. multisampling can be used only if it's supported
? ? ? ? ? ? ? ? ? ?by backbuffer's format, and corresponding depth/stencil's format (quite logical :P)
? ? ? ? ? ? ? ? ? ?*** note: if you plan to support Z-LESS HSR, you don't have to create depth/stencil
? ? ? ? ? ? ? ? ? ?surface, and thus you can skip point "xx" and "xxxx", since you won't be using
? ? ? ? ? ? ? ? ? ?any 'z' or 'w' buffers :) ***
? ? ? ? ?---) repeat "--" for fullscreen mode.


this is the 'proper way' which is used by all microsoft's tutorials and demos.
it works fine with D3D9 and it SHOULD work with D3D8 (but i haven't tested it)

I hope it'll help anyone :P
Posted on 2005-03-17 17:55:52 by ti_mo_n