IDirect3D9::GetAdapterDisplayMode

Started by
5 comments, last by XGT08 9 years, 9 months ago

Hello,

I am a little confused about how the 'IDirect3D9::GetAdapterDisplayMode' function works when we have multiple adapters on our system.

For example, calling this function and passing it an ordinal of 1 on a system with 2 adapters. If that adapter is not currently active, what will be the display mode returned by the function?

I applogize if the question is silly or weird. It's probably due to the fact that I always had one adapter on my system and I have no idea what are the implications of using multiple adapters smile.png.

Thanks a lot!

Advertisement

If that adapter is not currently active, what will be the display mode returned by the function?

The documentation (do you have the docs?) provides:

If Adapter is out of range or pMode is invalid, this method returns D3DERR_INVALIDCALL.

You could also try it and examine values. wink.png

Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.

You don't forget how to play when you grow old; you grow old when you forget how to play.

Hello,

Thanks for the answer :)

I read the documentation, but from what it says I understand that if the adapter ordinal that you supply is bigger than the GetAdapterCount() - 1, it returns D3DERR_INVALIDCALL..

I would gladly try it, but I am using a laptop. I don't know... Is it possible to have more than one adapter on your laptop? Anyway, I was just hoping somebody would know the answer to this :).

The reason I am asking this question is because I saw this function being called in this way in a device enumeration code module. After the enumeration process, the client code can call a function like FindBestFullscreenMode(DisplaySettings& settings, D3DDISPLAYMODE& matchMode, bool bRequireHAL, bool bRequireREF). This function attempts to find an adapter which matches the requested settings as closely as possible (i.e. has a matching display mode with matchMode, and uses a HAL or REF device, depending on the values of 'requireHAL' and 'requireREF').

Inside the function there is a loop which does somehting like this:

for(UINT adapterIndex = 0; adaperIndex < adapterCount; adapterIndex++)

{

D3DDISPLAYMODE displayMode;

direct3D9->GetAdapterDisplayMode(adapters[adapterIndex]->Oridnal, &displayMode);

// The rest of the code...
}

... where 'adapterCount' is the current number of adapters installed on the system and 'adapters' is a std::vector which contains instances of a class which holds adapter information (like the adapter ordinal for example).

GetAdapterDisplayMode() will return a mode for every adapter in the range 1..GetAdapterCount(). If GetAdapterCount() can see it, then it is fair game for access.

Thanks Dave.

That's cool, but if I call this function specifying an ordinal which identifies an adapter installed on my system but which is currently inactive (i.e. it is not currenlty rendering my dekstop), then what is the returned display mode?

If it's enabled, it gets a number, if it's completely disabled somehow, then it doesn't. If it gets a number, then it's accessible. DirectX won't skip numbers for disabled devices, it will ignore them completely. There won't be a case where ordinal #2 is valid as an argument to the various DirectX methods and ordinal #1 is not.

What is the returned display mode? I have no idea, but you can bet it will be a valid one.

Thanks Dave! :)

This topic is closed to new replies.

Advertisement