Original Post
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.
The DX9 Debug runtime gives the following output:
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
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