🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Multi-monitor pain.

posted in OMG NUB! for project Gorgon
Published August 29, 2011
Advertisement
sitelogo.pngSo, one of the shortcomings of the original Gorgon was that there was no support for multi-monitor. And I see now why I didn't bother... what a pain in the ass.

Anyway, I finally figured it out. See, there are two ways to do multi-mon support in Direct 3D 9:


  1. Create 2 devices, one for each adapter. This is actually simple, and is the only way to get multi-mon going for 2 discreet video cards. The down side is that they can't share data between them, so you'll have to double up on your textures, vertices, etc... if you want to have a copy of the same data on a difference device. Not ideal, but manageable. Of course, that's just getting the 2 devices working in windowed mode... when you go to full screen mode, then it becomes, in scientific terms, a clusterfuck. Apparently, you can only have 1 device in full screen at any given time. However, it's possible to make both devices full screen if they meet a certain set of conditions:* The devices must be created by the same IDirect3D9 object. - That's easy, I did that anyway.
    * The devices must share the same focus window. - Oh, ok... how do I determine which window is the focus window? Well, for now, it's the first window that's created with a IDirect3DDevice9 object attached to it.
    * Must be a different adapter ID. - This was actually more of a pain to get around than you might think.



    Anyway, in the end, it works. You can create multiple windows on multiple monitors and have them in full screen mode. It was horrible. And I really don't know how well this is going to work on multiple physical cards since that's a setup I don't have access to.
  2. Create a multi-head device object. Multi-head cards are the more common cards (look on the back, see a VGA and DVI or 2 DVI connectors? Yeah, you got a multi-head card). Direct 3D 9 treats both heads as separate devices for compatibility reasons (and indeed, that's how the previous method works), but as stated before, we lose shared data with that method. With a mult-head device we can go full screen on multiple monitors, -and- share the data. It does this by creating 2 swap chains for the device (one IDirect3DDevice9 object with multiple swap chains). Sounds good, but in Direct 3D 9, this is not without its own set of caveats:

    * It's fullscreen only, if you want shared data across multiple heads in windowed mode, use additional swap chains. - Since the heads are driven by the same video card, the multiple swap chained windows will work just fine as is (they're already sharing a device). As for full screen, well, you can't go full screen with an additional swap chain while having the device in full screen (i.e. the implicit swap chain on the device object is already full screen, in essence only one swap chain can be fullscreen at a time). In the case of multi-head devices, they cheat a little (or that's how it looks to me) and create 2 swap chains for one device in full screen mode.
    * You cannot create additional swap chains while in fullscreen mode. - This is not really a big deal, as I limit the creation of multiple swap chains to windowed mode only in Gorgon anyway.
    * You must create swap chains for -all- heads, even if you're only using 2. - While this is not that common a scenario, it's annoying and wasteful.
    * You must destroy the device object and recreate it to switch to windowed mode. - This is my biggest annoyance of all, it makes management of these objects quite difficult. Because of this, I have to rethink how I want to design the implementation for the device objects. It won't be fun.

I've yet to get the multi-head stuff working the way I want. As it is, it works, but it's not very flexible (it'll crash hard if you try to modify the device, see the last point of item 2). Compared to Direct 3D 10/11, multiple monitor stuff is needlessly complicated. The beauty of D3D10 and 11 is that you only need to create swap chains for the video outputs (heads) that you want. Everything is far more flexible that way.
Anyway, that's my rant on multiple monitors.



Source
Previous Entry MSAA (Gorgon v2.x
Next Entry Gorgon the 2nd
0 likes 1 comments

Comments

Krohm
Hello Tape Worm, I also spent considerable effort with multi-monitor.
I am surprised you're still positive with heterogeneous-device support... it drove me crazy.
September 12, 2011 06:38 AM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement

Latest Entries

Gorgon 3.2

10336 views

Gorgon v3.1.46.255

3527 views

Gorgon v3.1.45.248

3159 views

Gorgon v3.1.29.243

4453 views

Gorgon v3.1

4267 views

Gorgon Update #10

3184 views

Gorgon Update #9

3374 views

Gorgon Update #8

3122 views

Gorgon Update #7

3343 views

v3.0 Release

3903 views
Advertisement