• 10
• 10
• 12
• 12
• 14

# Mixing Devices

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

## Recommended Posts

Can you use Effects,buffers etc in your device, that were made in other devices? For example, i have an app, that runs with 2 directx10 windows, so I have 2 devices. I also have a static TextureManager class, that will return a pointer to a ID3D10ShaderResourceView after creating the texture, or if the texture path has been loaded previously it returns a ref to that already existing texture. and so if i do the following tex = TextureManager::LoadTex2D(path, device1); //path used 1st time, so loads tex = TextureManager::LoadTex2D(path, device2); //path recognised so returns a ref Is it ok? Ie, can you create textures/effects/buffers/meshes etc in one device, and then use them in another device?

##### Share on other sites
I'm almost entirely sure that it will not work. Honestly, I've never tried it but it looks like a big no-no.

Curiously, why are you using two devices in the first place? You don't need more than one to render content to more than one window. All you need to do is setup an additional swap chain. I'm not entirely sure how to do that in D3D10, but it shouldn't be very difficult. I'm sure one of the vets can fill you in on that.

##### Share on other sites
In D3D9: No
In D3D9Ex: Only if you use the shared handle parameter to share resources.
In D3D10: Not sure, but probably the same as D3D9Ex.

##### Share on other sites
Well, im using Dx10, and have gone for the Mutli Swap chain approach, but ive noticed that this is going to require to add the following in my render scene function.

RenderScene(){   SetRenderTarget(&renderTarget, &DepthTarget());   //do rendering   PresentSwapChain()   SetRenderTarget(&OtherRenderTarget, &OtherDepthTarget());   //do rendering   PresentOtherSwapChain()}

Where as previously, as i only had one swapchain, i could just call "SetRenderTarget(&renderTarget, &Depth Target())" once. So i have 3 windows, such as having 4 views of a scene in different win32 windows, iming going to need to call setRenderTarget 4 times each frame. Does this have a bad impact? (changing rendertargets freqently)? asside from the fact that im rendering 4 times as much data.

Also, which approach is better?

   SetRenderTarget(&OtherRenderTarget1, &OtherDepthTarget1());   //render   PresentOtherSwapChain1()    SetRenderTarget(&OtherRenderTarget2, &OtherDepthTarget2());   //render   PresentOtherSwapChain2()    SetRenderTarget(&OtherRenderTarget3, &OtherDepthTarget3());   //render   PresentOtherSwapChain3()

   SetRenderTarget(&OtherRenderTarget1, &OtherDepthTarget1());   //render       SetRenderTarget(&OtherRenderTarget2, &OtherDepthTarget2());   //render       SetRenderTarget(&OtherRenderTarget3, &OtherDepthTarget3());   //render   PresentOtherSwapChain1()   PresentOtherSwapChain2()   PresentOtherSwapChain3()

Or will they behave equally as well?, in terms of speed