Jump to content
  • Advertisement
Sign in to follow this  
Litheon

[DX9Ex] Shared Resources

This topic is 2553 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 guys,

Is it possible to share a surface/texture between different GPU's on DX9 Ex?
I'm working on a Windows 7 system with 2 graphic cards, 1 ATI and 1 NVIDIA.
I'm creating an exclusive fullscreen device on the ATI and one on the NVIDIA.
Now I want to share a texture between those devices, I know i need to go through system memory, but it would be very nice if Direct3D could handle that :/

But the creation of the shared texture always fails, it is like the handle is invalid. This code works perfectly if I create the devices on the same GPU.


HANDLE sh_sharedHandle_=NULL;


IDirect3DTexture9 *sh_master_Texture_=NULL; // Belongs to primary device
IDirect3DTexture9 *sh_slave_Texture_=NULL; // Create a shared texture on the main device!

// SUCCEEDS!
if (FAILED(deviceObject_->deviceD3D_->CreateTexture(
800, //d3ddisplaymodesex[o].Width,
600, //d3ddisplaymodesex[o].Height,
1,
D3DUSAGE_RENDERTARGET,
D3DFMT_X8R8G8B8, //d3ddisplaymodesex[o].Format // D3DFMT_X8R8G8B8,
D3DPOOL_DEFAULT,
&sh_master_Texture_,
&sh_sharedHandle_ )))
{
log(TRACE_ERROR, L"Failed to create DX9Ex Shared Texture");
assert(0);
goto create_dev_error;
return;
}

// Create a shared texture on the slave device!

// FAILS!!
if (FAILED(device.deviceD3D_->CreateTexture(
800,
600,
1,
D3DUSAGE_RENDERTARGET,
D3DFMT_X8R8G8B8,
D3DPOOL_DEFAULT,
&sh_slave_Texture_,
&sh_sharedHandle_)))
{
log(TRACE_ERROR, L"Failed to create DX9Ex Shared Texture");
assert(0);
goto create_dev_error;
return;
}


The DX9 Debug runtime gives the following output:

Direct3D9: (INFO) :======================= Hal HWVP device selected

Direct3D9: (INFO) :HalDevice Driver Style b

Direct3D9: :Subclassing window 000c0a06
Direct3D9: :StartExclusiveMode
Direct3D9: (INFO) :Using FF to VS converter

Direct3D9: (INFO) :Using FF to PS converter

Direct3D9: (INFO) :======================= Hal HWVP device selected

Direct3D9: (INFO) :HalDevice Driver Style b

Direct3D9: :StartExclusiveMode
Direct3D9: (INFO) :Using FF to VS converter

Direct3D9: (INFO) :Using FF to PS converter

Direct3D9: (INFO) :Enabling multi-processor optimizations
Direct3D9: (INFO) :DDI threading started

Direct3D9: (ERROR) :Error during initialization of texture. CreateTexture failed.
Direct3D9: (ERROR) :Failure trying to create a texture


So, should this work? Or do I need to manually need to detect if 2 devices are on a different gpu and then copy via memory

Share this post


Link to post
Share on other sites
Advertisement
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!