Sign in to follow this  
ori-on

Shared resources (eg textures) between devices/threads

Recommended Posts

ori-on    113

In this Microsoft article it states that sharing of resources between different d3d devices is possible on Windows Vista. The description sounds straight forward, so I gave it a try on Windows 7, but only get an D3DERR_INVALIDCALL back, when I call CreateTexture()

 

pSharedHandle points to a HANDLE that is 0.

 

D3D debug dumps the following:

 

Direct3D9: (ERROR) :Device is not capable of sharing resource. CreateTexture fails.
Direct3D9: (ERROR) :Failure trying to create a texture

 

I am using an ordinary Direct3D 9 device, not Direct3D 9Ex. But according to the docs it should work with both. I am using a Radeon 57xx, and the drivers are pretty recent. According to the docs, WDDM drivers are a requirement. Since mine are a couple of months old, I believe they should be (this is the year 2013...).

 

Obviously one question comes to mind: is this a Vista only feature?? Maybe they kicked it out with Win7 again?

 

So my question is, does anyone successfully use the pSharedHandle parameter?

Share this post


Link to post
Share on other sites
Tispe    1468

Hi

 

I think it Works on Vista because of DirectX10. You can't do this With D3D9. You need to create the texture and Lock it With Your main Device/thread. After you Lock it on the main thread you can give the lock pointer to another thread and have that copy data to the texture, send the Lock pointer back to the main thread and unlock it there. 

Edited by Tispe

Share this post


Link to post
Share on other sites
ori-on    113

Sharing textures (and other resources) between devices/threads works just fine as advertised, when using D3D9Ex (and not D3D9). I wish Microsofts' documentation would state that more clearly.

 

The reason is that only D3D9Ex utilizes the features provided through WDDM display drivers, like eg sharing resources. So D3D9Ex was specifically introduced for people like me that want to stick with D3D9, but want to use some of the features that were introduced with Vista (and later). So thanks for that to Microsoft :)

 

So the actual fix was to use Direct3DCreate9Ex() and CreateDeviceEx() instead of their D3D9 predecessors. Everything else remains the same.

Share this post


Link to post
Share on other sites

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