Sign in to follow this  

Multiple Devices

This topic is 3724 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, Is there any tutorial how to manage multiple devices, in my case two. I've tried to create one Class that does some rendering and it works fine. But when i have two of that class and only change the contructor so that the adapter changes in CreateDevice it seems that they never gets active at the same time. One monitor use the right resolution while the other one does about nothing. The only static information they share is the D3D object. And one other thing, can I share the backbuffer between them in case I'd like one to be a copy of the other but with some additional drawing?

Share this post


Link to post
Share on other sites
Not sure about the first question, but you can't share interfaces between devices in D3D9. I think you can in D3D10 though.

Do any functions fail? Are you using the debug runtime? Does it work if you only create one device on the second adapter?

Share this post


Link to post
Share on other sites
Have a look at this MSDN document:
http://msdn2.microsoft.com/en-us/library/bb206364.aspx

That's if you are using DX9, with DX10 things seems to be simpler. Unfortunately I can't get the DX10 MultiMon sample to work on my rig, tested with non-SLI Dual 8800GTXs.

Oh, and DX10 is built for much better inter-device cooperation so it supports sharing of texture data. DX9 never implemented this feature, though it was seemingly planned.

Share this post


Link to post
Share on other sites
Quote:
Original post by Evil Steve
Not sure about the first question, but you can't share interfaces between devices in D3D9. I think you can in D3D10 though.


Even D3D10 doesn’t allow interface sharing. You can only share the resources but this requires that you open them on the second device again. This will give you a different interface.

The same feature can be used with Direct3D9ex.

Share this post


Link to post
Share on other sites
Quote:
Original post by Werrock
I'm using Dx9. So I prolly need to call Direct3DCreate9 twice, one for each adapter? I'll get back with the results after some more tests then.
Nope, you only need one IDirect3D9 interface, but two IDirect3DDevice9's.

Share this post


Link to post
Share on other sites
Generally you don't need multiple devices and since noone else has asked, I'll ask: why do you think you need more than one device? If you are showing results in multiple windows on the same screen, you most definately don't need multiple devices to do that.

Share this post


Link to post
Share on other sites
I only use one interface but two IDirect3DDevice9, that was my first try at this.

Why I need this. I'm not sure it's the right thing to do. I need it to pressent two full screen pictures. One is the usuall graphics and the other shall be a copy of this first but some addtional redeing. Some texts and lines. And I want it efficient :).

Share this post


Link to post
Share on other sites
Quote:
Original post by Werrock
Why I need this. I'm not sure it's the right thing to do. I need it to pressent two full screen pictures. One is the usuall graphics and the other shall be a copy of this first but some addtional redeing. Some texts and lines. And I want it efficient :).


If the two displays are connected to a single graphics card, then you can do this with an adapter group device. If the two displays are connected to separate graphics cards, then you will need two devices and only one of the graphics cards can be in exclusive mode at a time. If you want to display fullscreen images on two different graphics cards simultaneously, then use both devices in windowed mode and make your window the size of the screen with no client decorations.

Adapter group devices are covered in Chapter 2. Direct3D in my book.

Share this post


Link to post
Share on other sites
Richard,

I haven't read your book, but what you posted isn't exactly the same thing that is mentioned in the D39 SDK docs (Working with Multiple Monitor Systems).

The docs state that you can have a fullscreen mode D3D device on multiple adapters at the same time if they were all created from the same IDirect3D9 interface, share the same focus window, and are created for separate display adapters.

You don't need to run in a window to do this and can take advantage of page flipping and alternate display modes that fullscreen mode gives you.

At least that's the way I interpret what the docs say. If you've verified that this isn't the way that things work, let me know and I'll make sure that the D3D SDK docs get updated.


Working with Multiple Monitor Systems

Share this post


Link to post
Share on other sites
Quote:
Original post by don
The docs state that you can have a fullscreen mode D3D device on multiple adapters at the same time if they were all created from the same IDirect3D9 interface, share the same focus window, and are created for separate display adapters.


The first bit is saying that when you go exclusive, all the other devices can't get exclusive mode:

Quote:

Whenever a device is successfully reset or created in full-screen operation, the Direct3D object that created the device is marked as owning all adapters on that system. This state is known as exclusive mode, and at this point the Direct3D object owns exclusive mode. Exclusive mode means that devices created by any other Direct3D9 object can neither assume full-screen operation nor allocate video memory.


The second bit is saying that only one of the devices created from this Direct3D9 object can be full screen:

Quote:

In addition, when a Direct3D9 object assumes exclusive mode, all devices other than the device that went full-screen are placed into the lost state.


So I don't see it as any different from what I've described.

Because this issue comes up so often, I should probably integrate all this multimonitor crap into my rt_Views sample.

Share this post


Link to post
Share on other sites
What it is saying is that you can have multiple D3D devices running in fullscreen exclusive mode simultaneously as long as you abide by the following rules:

1) Each device must have been created off of the same IDirect3D9 object.

2) Each device must use the same focus window.

3) Each device must be created for a unique display adapter.

If you do this, your app can set whatever display mode it chooses for each particular adapter and can use hardware page flipping during presentation. You do not have to resort to running in windowed mode.

There is a note in the SDK docs that states that when you create a second FSE device off of the same D3D object, the first device will become lost, but you can reset this device and then both devices will be running fullscreen. This is because fullscreen exclusive mode is actually a property of the D3D object and not the device.




Share this post


Link to post
Share on other sites
A while ago I wrote a test program which put four screens in full-screen mode, using two separate graphics cards.

1 x Direct3D9 object.
2 x Direct3D9Device objects with common focus window.
(Used adaptor groups to render to the 2 DVI outputs on each card)

The trick (as the MSDN document suggests) is that each new device created will cause a temporary lost of the other devices. Just create the devices in a loop, then go back round resetting them. They should stay valid this time.

Share this post


Link to post
Share on other sites
Quote:
Original post by don
There is a note in the SDK docs that states that when you create a second FSE device off of the same D3D object, the first device will become lost, but you can reset this device and then both devices will be running fullscreen. This is because fullscreen exclusive mode is actually a property of the D3D object and not the device.


Interesting. OK, I'll have to incorporate that into the multiple adapter discussion in my book. I haven't had a box with multiple display adapters capable of Direct3D9 in it; I'll have to try and configure a machine like this for testing and incorporate this business into my rt_Views application so that this is clearer for people coming to Direct3D for the first time. I know I've been confused about it, exactly because I haven't had a HW configuration in order to experiment with and frankly the docs have been so all-over-the-map in quality of comments that I've come to not trust them fully. The real proof of concept is what can you make the code do, not what the docs say, because too often the docs are wrong about little details like this, or just written in such a way that its possible to interpret it in multiple ways.

Share this post


Link to post
Share on other sites
Quote:
Original post by don
What it is saying is that you can have multiple D3D devices running in fullscreen exclusive mode simultaneously as long as you abide by the following rules:

1) Each device must have been created off of the same IDirect3D9 object.

2) Each device must use the same focus window.

3) Each device must be created for a unique display adapter.

If you do this, your app can set whatever display mode it chooses for each particular adapter and can use hardware page flipping during presentation. You do not have to resort to running in windowed mode.

There is a note in the SDK docs that states that when you create a second FSE device off of the same D3D object, the first device will become lost, but you can reset this device and then both devices will be running fullscreen. This is because fullscreen exclusive mode is actually a property of the D3D object and not the device.


Done and done. It works now but I had a problem when the first created device got lost. Since it seem thaat my execute loop never got the result D3DERR_DEVICELOST, it got D3DERR_DEVICENOTRESET. And what i never did was releasing my volatile resources because i was relying on that i would get an device lost before. I fixed that with an extra member to contain the state of the volatile resource.

Big thanks for all help. I will now attempt to make a copy of the backbuffer of one device to display on the other.

Share this post


Link to post
Share on other sites

This topic is 3724 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this