本文整理汇总了C++中IDXGIAdapter1::CheckInterfaceSupport方法的典型用法代码示例。如果您正苦于以下问题:C++ IDXGIAdapter1::CheckInterfaceSupport方法的具体用法?C++ IDXGIAdapter1::CheckInterfaceSupport怎么用?C++ IDXGIAdapter1::CheckInterfaceSupport使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDXGIAdapter1
的用法示例。
在下文中一共展示了IDXGIAdapter1::CheckInterfaceSupport方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init
bool RenderSystem::init(void* windowHandle, const InitParams& params)
{
IDXGIFactory1* factory = 0;
IDXGIOutput* output = 0;
DXGI_MODE_DESC modeDesc;
::ZeroMemory(&modeDesc, sizeof(DXGI_MODE_DESC));
modeDesc.Format = params.srgbTarget ? DXGI_FORMAT_R8G8B8A8_UNORM_SRGB : DXGI_FORMAT_R8G8B8A8_UNORM;
modeDesc.Width = params.width;
modeDesc.Height = params.height;
if (SUCCEEDED(CreateDXGIFactory1(__uuidof(IDXGIFactory1), (void**)&factory)))
{
IDXGIAdapter1* adapter = 0;
for (UINT i = 0; factory->EnumAdapters1(i, &adapter) != DXGI_ERROR_NOT_FOUND; ++i)
{
if (adapter->CheckInterfaceSupport(__uuidof(ID3D11Device), NULL))
break;
adapter->Release();
}
D3D_FEATURE_LEVEL supportedFeatureLevels[] =
{
D3D_FEATURE_LEVEL_11_0,
};
UINT flags = 0;
#if defined (_DEBUG)
flags |= D3D11_CREATE_DEVICE_DEBUG;
#endif // _DEBUG
if (adapter)
{
if (SUCCEEDED(D3D11CreateDevice(adapter, D3D_DRIVER_TYPE_UNKNOWN, NULL, flags, supportedFeatureLevels, _countof(supportedFeatureLevels),
D3D11_SDK_VERSION, &m_device, NULL, &m_renderContext)))
{
for (UINT i = 0; adapter->EnumOutputs(i, &output) != DXGI_ERROR_NOT_FOUND; ++i)
{
if (SUCCEEDED(output->FindClosestMatchingMode(&modeDesc, &modeDesc, m_device)))
{
// additional checks??
break;
}
output->Release();
output = 0;
}
/*if (output)
output->Release();*/
}
adapter->Release();
}
if (m_device)
{
DXGI_SWAP_CHAIN_DESC sd;
::ZeroMemory(&sd, sizeof(DXGI_SWAP_CHAIN_DESC));
sd.BufferCount = 1;
sd.BufferDesc = modeDesc;
sd.BufferUsage = D3D11_BIND_RENDER_TARGET;
sd.Flags = 0;
sd.OutputWindow = (HWND)windowHandle;
sd.SampleDesc.Quality = 0;
sd.SampleDesc.Count = 1;
sd.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
sd.Windowed = TRUE;
if (params.msaaSamples > 0)
{
UINT numLevels = 0;
if (SUCCEEDED(m_device->CheckMultisampleQualityLevels(modeDesc.Format, params.msaaSamples, &numLevels)) && numLevels > 0)
{
sd.SampleDesc.Quality = numLevels-1;
sd.SampleDesc.Count = params.msaaSamples;
}
else
{
printf("multisample quality not supported");
}
}
VALIDATE(factory->CreateSwapChain(m_device, &sd, &m_swapChain));
}
if (params.fullscreen)
{
m_isFullScreen = SUCCEEDED(m_swapChain->SetFullscreenState(TRUE, output));
}
// setup debug queue
factory->MakeWindowAssociation((HWND)windowHandle, DXGI_MWA_NO_ALT_ENTER | DXGI_MWA_NO_WINDOW_CHANGES);
if (output)
output->Release();
//.........这里部分代码省略.........