views:

406

answers:

3

It is possible, with the Direct3D9ex, to share resources between devices. Is it also possible to use those shared resources with Direct3D10 devices?

A: 

Someone correct me if I'm wrong but, No and No.

What is you intend? Have a static texture on two devices? If so, it's easily achieved by loading the same texture twice into the two different default pools. Just be aware that modifying one won't necessarily modify the other.

If you are trying to share a managed texture on two devices, I don't think this is achievable with any sort of control. SLI might do it behind the scene but you won't have any control over it.

If you want to use a texture generated from one device on the other device explicitly, you will have to download it from the source device and upload it to the target device every frame. This will be slow but if absolutely necessary it can be done that way.

Coincoin
A: 

You can share Direct3D9 resources between devices or processes.

Feature Summary (Direct3D 9 for Windows Vista) - Sharing Resources

Similar technique works for Direct3D10 resources (you also specify the sharing handle).

This GameDev.net topic discusses sharing between D3D9Ex and D3D10 in detail. The conclusions in that topic seems to be that while based on documentation it should be possible (with some limitations), in practice it does not work at all (perhaps the restrictions are that severe they prevent any practical usage scenario?)

Suma
+2  A: 

Yes, you can share resources between D3D9Ex and D3D10 devices using the technique described here:

Feature Summary (Direct3D 9 for Windows Vista) - Sharing Resources

Note that GPU access to shared surfaces is not synchronized - for example, if you render to the same render surface on two devices simultaneously, expect all sorts of corruptions and races.

To work around it, make sure one device is completed rendering to the shared surface before the other one uses it. One option is event query (IDirect3DQuery9) , the other is doing a StretchRect to a small surface and Lock it (if Lock succeeds, GPU completed all previous work)

Simon Kozlov