Jump to content
  • Advertisement
Sign in to follow this  

Share cpu writable texture resource between two devices

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi folks, I have a question concerning DirectX10's ability to share resources across devices. I managed to share a normal texture resource between my two graphic cards. However, I need to share a texture with the D3D10_CPU_ACCESS_WRITE flag set so I can fill the texture myself. My original code doesn't seem to work here, I get an E_INVALIDARG error when calling OpenSharedResource(). Is it possible to share a cpu writable texture? Or is my code correct and it's not possible with DX10?
// create empty texture on device1
desc.ArraySize   = 1;
desc.BindFlags   = D3D10_BIND_SHADER_RESOURCE;
desc.CPUAccessFlags  = D3D10_CPU_ACCESS_WRITE;
desc.Format    = DXGI_FORMAT_R8G8B8A8_UNORM;
desc.Height    = 256;
desc.MipLevels   = 1;
desc.SampleDesc.Count = 1;
desc.SampleDesc.Quality = 0;
desc.Usage    = D3D10_USAGE_DYNAMIC;
desc.Width    = 256;
desc.MiscFlags = D3D10_RESOURCE_MISC_SHARED;
g_pDevice1->CreateTexture2D(&desc, NULL, &g_pTexture);

.............. // draw to texture and create resource view

// load the shared texture resource on device2
IDXGIResource* pGIResource;
V(g_pTexture->QueryInterface(IID_IDXGIResource, (void**)&pGIResource) );
HANDLE sharedHandle;
V(pGIResource->GetSharedHandle(&sharedHandle) );
ID3D10Resource* pResource;
// !!! this line returns E_INVALIDARG
V(g_pDevice2->OpenSharedResource(sharedHandle, __uuidof(ID3D10Resource), (void**)&pResource));
ID3D10Texture2D* pTexture;
V(pResource->QueryInterface(IID_ID3D10Texture2D, (void**)&pTexture));

Share this post

Link to post
Share on other sites
I feared as much... damn. Hopefully the the docs will be updated soon so the next person trying this can save the trouble.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!