Sign in to follow this  
Litheon

[DX9Ex] Shared Resources

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.


[code] 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;
}[/code]

The DX9 Debug runtime gives the following output:

[code]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
[/code]

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

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