2016-01-22 18:18:55 -05:00
|
|
|
#include "paldevice.hpp"
|
|
|
|
|
|
|
|
|
|
#if defined(ATI_OS_LINUX)
|
|
|
|
|
namespace pal {
|
2017-04-13 13:56:38 -04:00
|
|
|
bool Device::associateD3D9Device(void* d3dDevice) { return false; }
|
2016-01-22 18:18:55 -05:00
|
|
|
}
|
2017-04-13 13:56:38 -04:00
|
|
|
#else // !ATI_OS_LINUX
|
2016-01-22 18:18:55 -05:00
|
|
|
|
|
|
|
|
#include <d3d9.h>
|
|
|
|
|
#include <dxgi.h>
|
|
|
|
|
|
|
|
|
|
/**************************************************************************************************************
|
2017-04-13 13:56:38 -04:00
|
|
|
* Note: ideally the DXX extension interfaces should be mapped from the DXX perforce branch.
|
|
|
|
|
* This means OCL client spec will need to change to include headers directly from the DXX perforce
|
|
|
|
|
*tree.
|
2016-01-22 18:18:55 -05:00
|
|
|
* However, OCL only cares about the DXX OpenCL extension interface class. The spec cannot change
|
2017-04-13 13:56:38 -04:00
|
|
|
* without notification. So it is safe to use a local copy of the relevant DXX extension interface
|
|
|
|
|
*classes.
|
2016-01-22 18:18:55 -05:00
|
|
|
**************************************************************************************************************/
|
|
|
|
|
#include "DxxOpenCLInteropExt.h"
|
|
|
|
|
|
|
|
|
|
namespace pal {
|
|
|
|
|
|
2017-04-13 13:56:38 -04:00
|
|
|
bool Device::associateD3D9Device(void* d3d9Device) {
|
|
|
|
|
D3DCAPS9 pCaps;
|
|
|
|
|
IDirect3D9* p3d9dev;
|
|
|
|
|
LUID d3d9deviceLuid = {0, 0};
|
2016-01-22 18:18:55 -05:00
|
|
|
|
2017-04-13 13:56:38 -04:00
|
|
|
IDirect3DDevice9* pd3d9Device = static_cast<IDirect3DDevice9*>(d3d9Device);
|
2016-01-22 18:18:55 -05:00
|
|
|
|
2017-04-13 13:56:38 -04:00
|
|
|
// Get D3D9 Device caps
|
|
|
|
|
pd3d9Device->GetDeviceCaps(&pCaps);
|
|
|
|
|
// Get 3D9 Device
|
|
|
|
|
pd3d9Device->GetDirect3D(&p3d9dev);
|
2016-01-22 18:18:55 -05:00
|
|
|
|
2017-04-13 13:56:38 -04:00
|
|
|
IDirect3D9Ex* p3d9devEx = static_cast<IDirect3D9Ex*>(p3d9dev);
|
|
|
|
|
p3d9devEx->GetAdapterLUID(pCaps.AdapterOrdinal, &d3d9deviceLuid);
|
|
|
|
|
p3d9dev->Release();
|
2016-01-22 18:18:55 -05:00
|
|
|
|
2017-04-13 13:56:38 -04:00
|
|
|
// match the adapter
|
|
|
|
|
bool canInteroperate = (properties().osProperties.luidHighPart == d3d9deviceLuid.HighPart) &&
|
|
|
|
|
(properties().osProperties.luidLowPart == d3d9deviceLuid.LowPart);
|
2016-01-22 18:18:55 -05:00
|
|
|
|
2017-04-13 13:56:38 -04:00
|
|
|
return canInteroperate;
|
2016-01-22 18:18:55 -05:00
|
|
|
}
|
|
|
|
|
|
2017-04-13 13:56:38 -04:00
|
|
|
} // pal
|
|
|
|
|
#endif // !ATI_OS_WIN
|