/*
On input, this structure contains information that the driver can use.
作为输入,包含驱动可以使用的信息
On output, the driver specifies information that the Microsoft Direct3D runtime can use.
作为输出,驱动填充D3D runtime能使用的数据
*/
HRESULT APIENTRY OpenAdapter (__inout D3DDDIARG_OPENADAPTER* pOpenData)
{
vboxVDbgPrint(("==> "__FUNCTION__"\n"));
AssertBreakpoint();
PVBOXWDDMDISP_ADAPTER pAdapter = (PVBOXWDDMDISP_ADAPTER)RTMemAllocZ(sizeof (VBOXWDDMDISP_ADAPTER));
Assert(pAdapter);
if (!pAdapter)
{
vboxVDbgPrintR((__FUNCTION__": RTMemAllocZ returned NULL\n"));
return E_OUTOFMEMORY;
}
pAdapter->hAdapter = pOpenData->hAdapter;
pAdapter->uIfVersion = pOpenData->Interface;
pAdapter->uRtVersion= pOpenData->Version;
pAdapter->RtCallbacks = *pOpenData->pAdapterCallbacks;
pOpenData->hAdapter = pAdapter;
pOpenData->pAdapterFuncs->pfnGetCaps = vboxWddmDispGetCaps;
pOpenData->pAdapterFuncs->pfnCreateDevice = vboxWddmDispCreateDevice;
pOpenData->pAdapterFuncs->pfnCloseAdapter = vboxWddmDispCloseAdapter;
pOpenData->DriverVersion = D3D_UMD_INTERFACE_VERSION;
vboxVDbgPrint(("<== "__FUNCTION__", pAdapter(0x%p)\n", pAdapter));
return S_OK;
}