Multiple IDirect3DDevice8's

Started by
8 comments, last by PSioNiC 22 years, 9 months ago
Say you have this:
  

D3DXCreateTextureFromFile(
    D3DDeviceA,
    "Textures\\UhhSomeTexture.bmp",
    &MyTexture);

  
With that in the program, could you later do this?
  

D3DDeviceB->SetTexture(0, MyTexture);

  
What im doing is creating a texture with one device, and setting it with another. what im asking is, can you set a texture with a different device than the one used to load it?
"This is stupid. I can't believe this! Ok, this time, there really IS a bug in the compiler."... 20 mins pass ..."I'M AN IDIOT!!!"
Advertisement
I tried this - the program didn't crash, but there was no texture on the model, so I think that doesn't work.

Where do you need multiple devices?

Edited by - skallio on July 24, 2001 1:56:13 PM
Im adding support for multiple monitors in my engine.
You are going to be able to look at your other monitors and get other views in your game. In the monitor to the left will be the same scene in the center monitor except rotated to the left 90 degrees. In the monitor to the right will be the same scene in the center monitor except rotated to the right 90 degrees.

In order to do this im going to need 3 separate windows. If i just have one big window stretching across 3 monitors the game won''t be hardware accelerated. Plus if i do it that way, all the monitors would have to be in the same vertical screen resolution. I have to have 3 windows.

If I have 3 windows, with 3 separate screen reses, and 3 separate HWND''s, I''m also going to need 3 separate devices. I don''t believe its too good of an idea to use one device on 3 separate monitors with different resolutions, adapters, and color depths.

I can''t load all the textures, meshes, and everything else 3 times for each monitor, or I would need more RAM than a chassis rackmount server can handle

If I only load it once, Im going to have to render meshes containing textures that were loaded with a different device.
"This is stupid. I can't believe this! Ok, this time, there really IS a bug in the compiler."... 20 mins pass ..."I'M AN IDIOT!!!"
BTW: If I render left and right views of the scene to their own separate surfaces, and then copy those surfaces to the back buffers of the other two monitors, I wouldn''t have to load everything 3 times. Just once, but then drawn 3 times.

I would still have to copy data from one surface created with D3DDeviceA to another surface controlled by D3DDeviceB

Do you think I could at least do that?
"This is stupid. I can't believe this! Ok, this time, there really IS a bug in the compiler."... 20 mins pass ..."I'M AN IDIOT!!!"
I think you cannot render to 3 separate monitors with different resolutions and/or color depths, because the texture sharing doesn't work and copyrects operates only surfaces with compatible color formats (it does not convert the color format,and with different resolutions you would have to resize which, of course, is not supported by copyrects). But here's how you can render to 3 separate windows..
You can override the window whose client area is the target of render with present(). You should do it like:

[Render 1. screen/monitor]
Present(NULL, NULL, hWnd1, NULL);

[Render 2. screen/monitor]
Present(NULL, NULL, hWnd2, NULL);

[Render 3. screen/monitor]
Present(NULL, NULL, hWnd3, NULL);

So you can render to 3 separate windows with one device.

If you use fullscreen and want to divide the screen to 3 parts with separate viewports, use the IDirect3DDevice::SetViewport and render the scene for every viewport separately.

So, for multimon applications, I think you have to allocate all resources 3 times which indeed is mad...

Hope this helps

Edited by - skallio on July 24, 2001 5:24:12 PM
I just realized something.. If you have 3 monitors, you have 3 display adapters.. and they of course don't share memory, and that's exactly the reason why they don't let you share resources between devices.

The bad side about multimon is that you have to manage resources for each adapter independently..

Oh well, I guess that's the reason why we don't see any games supporting multiple monitors

Edited by - skallio on July 24, 2001 5:29:25 PM
An IDirect3DDevice8 interface is just what the name says it is, an interface to the 3D adapter. So you''re right, you can''t use the same adapter across three different monitors, since each monitor will likely have a separate adapter. Now, having a device for each will work, but you will need to reload all the textures/geometry three times. This is because on any recent video card that''s all being stored in video memory on the adapter, which isn''t accesible from the other adapters. Direct3D also abstracts textures/geometry stored in system memory so that they can be used the same way as those stored in video memory, and thus the other devices still won''t be able to access them. So, since you already said you''re not going to load everything three times, then you''re right, your only option is to render all three scenes on the best of the adapters and then just blit them over to the others.
If I cannot create one surface with one device, and blit it with another, then how am I supposed to "blit them over to the others"?

(P.S. Serious Sam has a multi-monitor mode, so I know its possible)
"This is stupid. I can't believe this! Ok, this time, there really IS a bug in the compiler."... 20 mins pass ..."I'M AN IDIOT!!!"
If the monitors share the same adapter(ie video card) you can use mulitple viewports which are all generated on one device...how that would work out on displaying to the seperate monitors i am not sure

However if the monitors had a seperate video card i think you would in effect have to run do display output individually for each monitor...as the previous poster said create textures/meshes etc for each device seperately and display seperately however the values for updating mesh coords etc could all be generated once and then passed to functions for each seperate device
ie: move mesha 5 units in the x direction
pass the value for 5 into D3DXMatrixTranslation function for each of the 3 devices seperately
quote:Original post by PSioNiC
If I have 3 windows, with 3 separate screen reses, and 3 separate HWND''s, I''m also going to need 3 separate devices. I don''t believe its too good of an idea to use one device on 3 separate monitors with different resolutions, adapters, and color depths.

I can''t load all the textures, meshes, and everything else 3 times for each monitor, or I would need more RAM than a chassis rackmount server can handle

If I only load it once, Im going to have to render meshes containing textures that were loaded with a different device.

G''day!

You will need 3 devices, internal storage formats are different and they won''t share memory.

Loading multiple copies of your textures shouldn''t be too bad. They''ll be loaded into video memory on each card so it shouldn''t be a problem. You''ll want to make sure that''s where they get loaded, you don''t want MANAGED you''ll want to force it into video mem.

I think any methods of sharing the textures would not be reliable, you may find something that works with your set up, but likely wouldn''t elsewhere.


Stay Casual,

Ken
Drunken Hyena
Stay Casual,KenDrunken Hyena

This topic is closed to new replies.

Advertisement