GFX now handles non-default adapters

The GFX (DirectX) pipeline did not respect the choice of adapter and
always went for the default one.  Normally this isn't an issue unless
you wish to target a particular adapter and display device combination.
This has been corrected.

The GFX initialize functions now attempt to find the best adapter that
matches a given display device (i.e. monitor) if one has been passed in.
To aid with choosing a display device some new monitor enumeration
methods have been added to the platform window manager.  These methods
have been exposed to the Canvas.
This commit is contained in:
DavidWyand-GG 2013-04-09 12:50:17 -04:00
parent 1ed1a41256
commit 0d77cdc270
18 changed files with 282 additions and 45 deletions

View file

@ -56,6 +56,16 @@ class Win32WindowManager : public PlatformWindowManager
// is intended for offscreen rendering
bool mOffscreenRender;
/// Internal structure used when enumerating monitors
struct MonitorInfo {
HMONITOR monitorHandle;
RectI region;
String name;
};
/// Array of enumerated monitors
Vector<MonitorInfo> mMonitors;
/// Callback to receive information about available monitors.
static BOOL CALLBACK MonitorEnumProc(
HMONITOR hMonitor, // handle to display monitor
@ -64,6 +74,14 @@ class Win32WindowManager : public PlatformWindowManager
LPARAM dwData // data
);
/// Callback to receive information about available monitor regions
static BOOL CALLBACK MonitorRegionEnumProc(
HMONITOR hMonitor, // handle to display monitor
HDC hdcMonitor, // handle to monitor DC
LPRECT lprcMonitor, // monitor intersection rectangle
LPARAM dwData // data
);
/// If a curtain window is present, then its HWND will be stored here.
HWND mCurtainWindow;
@ -75,6 +93,15 @@ public:
virtual S32 getDesktopBitDepth();
virtual Point2I getDesktopResolution();
/// Build out the monitors list. Also used to rebuild the list after
/// a WM_DISPLAYCHANGE message.
virtual void buildMonitorsList();
virtual S32 findFirstMatchingMonitor(const char* name);
virtual U32 getMonitorCount();
virtual const char* getMonitorName(U32 index);
virtual RectI getMonitorRect(U32 index);
virtual void getMonitorRegions(Vector<RectI> &regions);
virtual PlatformWindow *createWindow(GFXDevice *device, const GFXVideoMode &mode);
virtual void getWindows(VectorPtr<PlatformWindow*> &windows);