本文整理汇总了C++中IDXGIAdapter::QueryInterface方法的典型用法代码示例。如果您正苦于以下问题:C++ IDXGIAdapter::QueryInterface方法的具体用法?C++ IDXGIAdapter::QueryInterface怎么用?C++ IDXGIAdapter::QueryInterface使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDXGIAdapter
的用法示例。
在下文中一共展示了IDXGIAdapter::QueryInterface方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: eventGenerator
//--------------------------------------------------------------------------------------
// Enumerate for each adapter all of the supported display modes,
// device types, adapter formats, back buffer formats, window/full screen support,
// depth stencil formats, multisampling types/qualities, and presentations intervals.
//
// For each combination of device type (HAL/REF), adapter format, back buffer format, and
// IsWindowed it will call the app's ConfirmDevice callback. This allows the app
// to reject or allow that combination based on its caps/etc. It also allows the
// app to change the BehaviorFlags. The BehaviorFlags defaults non-pure HWVP
// if supported otherwise it will default to SWVP, however the app can change this
// through the ConfirmDevice callback.
//--------------------------------------------------------------------------------------
_Use_decl_annotations_
HRESULT CD3D11Enumeration::Enumerate( LPDXUTCALLBACKISD3D11DEVICEACCEPTABLE IsD3D11DeviceAcceptableFunc,
void* pIsD3D11DeviceAcceptableFuncUserContext )
{
CDXUTPerfEventGenerator eventGenerator( DXUT_PERFEVENTCOLOR, L"DXUT D3D11 Enumeration" );
HRESULT hr;
IDXGIFactory1* pFactory = DXUTGetDXGIFactory();
if( !pFactory )
return E_FAIL;
m_bHasEnumerated = true;
m_IsD3D11DeviceAcceptableFunc = IsD3D11DeviceAcceptableFunc;
m_pIsD3D11DeviceAcceptableFuncUserContext = pIsD3D11DeviceAcceptableFuncUserContext;
ClearAdapterInfoList();
for( int index = 0; ; ++index )
{
IDXGIAdapter* pAdapter = nullptr;
hr = pFactory->EnumAdapters( index, &pAdapter );
if( FAILED( hr ) ) // DXGIERR_NOT_FOUND is expected when the end of the list is hit
break;
IDXGIAdapter2* pAdapter2 = nullptr;
if ( SUCCEEDED( pAdapter->QueryInterface( __uuidof(IDXGIAdapter2), ( LPVOID* )&pAdapter2 ) ) )
{
// Succeeds on DirectX 11.1 Runtime systems
DXGI_ADAPTER_DESC2 desc;
hr = pAdapter2->GetDesc2( &desc );
pAdapter2->Release();
if ( SUCCEEDED(hr) && ( desc.Flags & DXGI_ADAPTER_FLAG_SOFTWARE ) )
{
// Skip "always there" Microsoft Basics Display Driver
pAdapter->Release();
continue;
}
}
CD3D11EnumAdapterInfo* pAdapterInfo = new (std::nothrow) CD3D11EnumAdapterInfo;
if( !pAdapterInfo )
{
SAFE_RELEASE( pAdapter );
return E_OUTOFMEMORY;
}
pAdapterInfo->AdapterOrdinal = index;
pAdapter->GetDesc( &pAdapterInfo->AdapterDesc );
pAdapterInfo->m_pAdapter = pAdapter;
// Enumerate the device driver types on the adapter.
hr = EnumerateDevices( pAdapterInfo );
if( FAILED( hr ) )
{
delete pAdapterInfo;
continue;
}
hr = EnumerateOutputs( pAdapterInfo );
if( FAILED( hr ) || pAdapterInfo->outputInfoList.empty() )
{
delete pAdapterInfo;
continue;
}
// Get info for each devicecombo on this device
if( FAILED( hr = EnumerateDeviceCombos( pAdapterInfo ) ) )
{
delete pAdapterInfo;
continue;
}
m_AdapterInfoList.push_back( pAdapterInfo );
}
// If we did not get an adapter then we should still enumerate WARP and Ref.
if (m_AdapterInfoList.size() == 0)
{
CD3D11EnumAdapterInfo* pAdapterInfo = new (std::nothrow) CD3D11EnumAdapterInfo;
if( !pAdapterInfo )
{
return E_OUTOFMEMORY;
}
pAdapterInfo->bAdapterUnavailable = true;
hr = EnumerateDevices( pAdapterInfo );
// Get info for each devicecombo on this device
if( FAILED( hr = EnumerateDeviceCombosNoAdapter( pAdapterInfo ) ) )
//.........这里部分代码省略.........