Sign in to follow this  
Super Llama

[d3d9/win7] can't seem to create a shared texture resource?

Recommended Posts

Super Llama    152

I'm trying to create a shared texture from a Direct3D 9 device using the pSharedHandle parameter that supposedly works starting with windows vista-- but no matter what I put in the parameters it always just returns an invalid call. I'm intending to share it with another device in another thread, but I can't even get the initial creation of the shared resource to work.

ddev->CreateTexture(width, height, 1, 0, D3DFMT_X8R8G8B8, D3DPOOL_DEFAULT, &tex, &handle);
I've tried changing pretty much all the parameters but if I pass it a &handle it always fails. The handle is pointing to a NULL value. I've been unable to find a lot of information about the texture sharing API, but everything I find says this should work. I'm compiling with the headers/libraries both from the Windows 7 SDK and the June 2010 DX SDK, and I'm able to see and instantiate D3D9Ex classes, so it's definitely a new enough version. The device is perfectly able to create the texture if I don't specify a handle, so I'm guessing I must not be fulfilling one of the restrictions for shared textures that microsoft barely told anyone about. MSDN is not helping very much, all it says is that I have to use D3DPOOL_DEFAULT, which I am.
Any ideas? I'll keep messing with the parameters while I wait for an answer.
EDIT: Well, I got it to create the handle by changing all the DirectX9 objects to DirectX9Ex objects, but this is not ideal and if there's still a way to do it with ordinary D3D9 interfaces, that would be preferable.
Edited by Super Llama

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