本文整理汇总了C++中IDirect3DDevice9::GetDirect3D方法的典型用法代码示例。如果您正苦于以下问题:C++ IDirect3DDevice9::GetDirect3D方法的具体用法?C++ IDirect3DDevice9::GetDirect3D怎么用?C++ IDirect3DDevice9::GetDirect3D使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDirect3DDevice9
的用法示例。
在下文中一共展示了IDirect3DDevice9::GetDirect3D方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fprintf
//Function to get the renderer information from Direct 3D
void GameDebugger::GetD3DInfo(ALLEGRO_DISPLAY* mydisplay)
{
fprintf(OutputFile, "\n\n -- Display Information -- \n\n");
#ifdef _DEBUG
printf("\n\n -- Display Information -- \n\n");
#endif
IDirect3DDevice9 * whatisthis = al_get_d3d_device(mydisplay);
IDirect3D9* MyDirect3D;
whatisthis->GetDirect3D(&MyDirect3D);
D3DADAPTER_IDENTIFIER9 GraphicAdapter;
MyDirect3D->GetAdapterIdentifier(D3DADAPTER_DEFAULT, 0, &GraphicAdapter);
//printf("%s %s %s", GraphicAdapter.Driver, GraphicAdapter.DeviceName, GraphicAdapter.Description);
fprintf(OutputFile, "Display Device: %s\n", GraphicAdapter.DeviceName);
fprintf(OutputFile, "GPU Name: %s\n", GraphicAdapter.Description);
fprintf(OutputFile, "Driver: %s\n", GraphicAdapter.Driver);
fprintf(OutputFile, "Renderer: Direct3D\n\n");
#ifdef _DEBUG
printf("Display Device: %s\n", GraphicAdapter.DeviceName);
printf("GPU Name: %s\n", GraphicAdapter.Description);
printf("Driver: %s\n", GraphicAdapter.Driver);
printf("Renderer: Direct3D\n\n");
#endif
return;
}
示例2: DbgLog
HRESULT CDecDXVA2::RetrieveVendorId(IDirect3DDeviceManager9 *pDevManager)
{
HANDLE hDevice = 0;
IDirect3D9 *pD3D = NULL;
IDirect3DDevice9 *pDevice = NULL;
HRESULT hr = pDevManager->OpenDeviceHandle(&hDevice);
if (FAILED(hr)) {
DbgLog((LOG_TRACE, 10, L"-> Failed to open device handle with hr: %X", hr));
goto done;
}
hr = pDevManager->LockDevice(hDevice, &pDevice, TRUE);
if (FAILED(hr)) {
DbgLog((LOG_TRACE, 10, L"-> Failed to lock device with hr: %X", hr));
goto done;
}
hr = pDevice->GetDirect3D(&pD3D);
if (FAILED(hr)) {
DbgLog((LOG_TRACE, 10, L"-> Failed to get D3D object hr: %X", hr));
goto done;
}
D3DDEVICE_CREATION_PARAMETERS devParams;
hr = pDevice->GetCreationParameters(&devParams);
if (FAILED(hr)) {
DbgLog((LOG_TRACE, 10, L"-> Failed to get device creation params hr: %X", hr));
goto done;
}
D3DADAPTER_IDENTIFIER9 adIdentifier;
hr = pD3D->GetAdapterIdentifier(devParams.AdapterOrdinal, 0, &adIdentifier);
if (FAILED(hr)) {
DbgLog((LOG_TRACE, 10, L"-> Failed to get adapter identified hr: %X", hr));
goto done;
}
m_dwVendorId = adIdentifier.VendorId;
m_dwDeviceId = adIdentifier.DeviceId;
done:
SafeRelease(&pD3D);
SafeRelease(&pDevice);
if (hDevice && hDevice != INVALID_HANDLE_VALUE) {
pDevManager->UnlockDevice(hDevice, FALSE);
pDevManager->CloseDeviceHandle(hDevice);
}
return hr;
}
示例3: HIWORD
HRESULT CMpeg2DecoderDXVA2::CreateDecoderService(CTVTestVideoDecoder *pFilter)
{
DBG_TRACE(TEXT("CMpeg2DecoderDXVA2::CreateDecoderService()"));
if (!pFilter)
return E_POINTER;
if (!pFilter->m_pD3DDeviceManager || !pFilter->m_hDXVADevice)
return E_UNEXPECTED;
CloseDecoderService();
m_pFilter = pFilter;
m_pDeviceManager = pFilter->m_pD3DDeviceManager;
m_pDeviceManager->AddRef();
HRESULT hr;
IDirect3DDevice9 *pDevice;
hr = m_pDeviceManager->LockDevice(m_pFilter->m_hDXVADevice, &pDevice, TRUE);
if (SUCCEEDED(hr)) {
D3DDEVICE_CREATION_PARAMETERS CreationParams;
hr = pDevice->GetCreationParameters(&CreationParams);
if (SUCCEEDED(hr)) {
IDirect3D9 *pD3D;
hr = pDevice->GetDirect3D(&pD3D);
if (SUCCEEDED(hr)) {
D3DADAPTER_IDENTIFIER9 AdapterID;
hr = pD3D->GetAdapterIdentifier(CreationParams.AdapterOrdinal, 0, &AdapterID);
if (SUCCEEDED(hr)) {
WCHAR szDriver[MAX_DEVICE_IDENTIFIER_STRING];
WCHAR szDescription[MAX_DEVICE_IDENTIFIER_STRING];
WCHAR szDeviceName[32];
::MultiByteToWideChar(CP_ACP, 0, AdapterID.Driver, -1, szDriver, _countof(szDriver));
::MultiByteToWideChar(CP_ACP, 0, AdapterID.Description, -1, szDescription, _countof(szDescription));
::MultiByteToWideChar(CP_ACP, 0, AdapterID.DeviceName, -1, szDeviceName, _countof(szDeviceName));
DBG_TRACE(TEXT("--- Adapter information ---"));
DBG_TRACE(TEXT(" Driver : %s"), szDriver);
DBG_TRACE(TEXT("Description : %s"), szDescription);
DBG_TRACE(TEXT("Device name : %s"), szDeviceName);
DBG_TRACE(TEXT(" Product : %08x"), HIWORD(AdapterID.DriverVersion.HighPart));
DBG_TRACE(TEXT(" Version : %d.%d.%d"),
LOWORD(AdapterID.DriverVersion.HighPart),
HIWORD(AdapterID.DriverVersion.LowPart),
LOWORD(AdapterID.DriverVersion.LowPart));
DBG_TRACE(TEXT(" Vendor : %08x"), AdapterID.VendorId);
DBG_TRACE(TEXT(" Device ID : %08x"), AdapterID.DeviceId);
DBG_TRACE(TEXT(" Subsystem : %08x"), AdapterID.SubSysId);
DBG_TRACE(TEXT(" Revision : %08x"), AdapterID.Revision);
m_AdapterIdentifier = AdapterID;
}
pD3D->Release();
}
}
pDevice->Release();
m_pDeviceManager->UnlockDevice(m_pFilter->m_hDXVADevice, FALSE);
}
if (FAILED(hr)) {
::ZeroMemory(&m_AdapterIdentifier, sizeof(m_AdapterIdentifier));
}
IDirectXVideoDecoderService *pDecoderService;
hr = m_pDeviceManager->GetVideoService(m_pFilter->m_hDXVADevice, IID_PPV_ARGS(&pDecoderService));
if (FAILED(hr)) {
DBG_ERROR(TEXT("GetVideoService() failed (%x)"), hr);
CloseDecoderService();
return hr;
}
m_pDecoderService = pDecoderService;
if (!FindDecoder(nullptr, &m_SurfaceFormat, SurfaceFormatList, _countof(SurfaceFormatList))) {
CloseDecoderService();
return E_FAIL;
}
return S_OK;
}