本文整理汇总了C++中IDXGIAdapter1::GetParent方法的典型用法代码示例。如果您正苦于以下问题:C++ IDXGIAdapter1::GetParent方法的具体用法?C++ IDXGIAdapter1::GetParent怎么用?C++ IDXGIAdapter1::GetParent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDXGIAdapter1
的用法示例。
在下文中一共展示了IDXGIAdapter1::GetParent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Resize
//.........这里部分代码省略.........
6, // number of feature levels
D3D11_SDK_VERSION, // sdk version
&m_device, // pointer to device
&featureLevelsSupported, // number of feature levels supported
&m_context)); // pointer to context
/*
#if defined(DEBUG) || defined(_DEBUG)
HR(hr, m_device->QueryInterface(__uuidof(ID3D11Debug), (void **)&m_debug));
#endif
*/
DXGI_FORMAT formats[] =
{
g_settings.format,
DXGI_FORMAT_R16G16B16A16_FLOAT,
DXGI_FORMAT_R8G8B8A8_UNORM
};
UINT formatSupport = 0;
UINT supportedFormatIndex = 0;
for (supportedFormatIndex; supportedFormatIndex < 3; supportedFormatIndex++)
{
m_device->CheckFormatSupport(formats[supportedFormatIndex], &formatSupport);
if (formatSupport & D3D11_FORMAT_SUPPORT_RENDER_TARGET && formatSupport & D3D11_FORMAT_SUPPORT_DISPLAY)
{
g_settings.format = formats[supportedFormatIndex];
break;
}
}
ATOM_ASSERT(g_settings.xmsaa > 0, "XMSAA < 0, min value = 1");
UINT sampleCount = g_settings.xmsaa;
UINT numQualityLevels = 0;
this->m_device->CheckMultisampleQualityLevels(
g_settings.format,
sampleCount,
&numQualityLevels);
//this->m_appSettings->qmsaa = numQualityLevels - 1;
if (sampleCount < g_settings.xmsaa)
g_settings.xmsaa = sampleCount;
if (numQualityLevels - 1 < g_settings.qmsaa)
g_settings.qmsaa = numQualityLevels - 1;
DXGI_SWAP_CHAIN_DESC sd;
ZeroMemory(&sd, sizeof(sd));
sd.BufferCount = SWAP_CHAIN_BUFFER_COUNT;
sd.BufferDesc.Format = g_settings.format;
sd.BufferDesc.Width = g_settings.width;
sd.BufferDesc.Height = g_settings.height;
sd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
sd.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
sd.OutputWindow = appWindow;
sd.SampleDesc.Count = g_settings.xmsaa;
sd.SampleDesc.Quality = g_settings.qmsaa;
sd.Windowed = true;
GetDefaultRefreshRate();
if (g_settings.frameRate <= 0)
{
DXGI_RATIONAL fr = GetDefaultRefreshRate();
sd.BufferDesc.RefreshRate.Numerator = fr.Numerator;
sd.BufferDesc.RefreshRate.Denominator = fr.Denominator;
g_settings.frameRate = fr.Numerator / fr.Denominator;
}
else
{
sd.BufferDesc.RefreshRate.Numerator = g_settings.frameRate;
sd.BufferDesc.RefreshRate.Denominator = 1;
}
IDXGIDevice1 *dxgiDevice = 0;
IDXGIAdapter1 *dxgiAdapter = 0;
IDXGIFactory1 *dxgiFactory = 0;
HR(hr, m_device->QueryInterface(__uuidof(IDXGIDevice1), (void **)&dxgiDevice));
HR(hr, dxgiDevice->GetParent(__uuidof(IDXGIAdapter1), (void **)&dxgiAdapter));
HR(hr, dxgiAdapter->GetParent(__uuidof(IDXGIFactory1), (void **)&dxgiFactory));
HR(hr, dxgiFactory->CreateSwapChain((IUnknown *)m_device, &sd, &m_swapChain));
memory::SafeRelease(&dxgiDevice);
memory::SafeRelease(&dxgiAdapter);
memory::SafeRelease(&dxgiFactory);
//LOG("num: %d, den: %d\n", sd.BufferDesc.RefreshRate.Numerator, sd.BufferDesc.RefreshRate.Denominator);
//LOG("scaling: %d, scanline ordering: %d\n", sd.BufferDesc.Scaling, sd.BufferDesc.ScanlineOrdering);
#if defined(DEBUG) || defined(_DEBUG)
//EnumerateDisplayModes();
char *featureLevelNames[] = { "D3D11", "D3D10.1", "D3D10", "D3D9.3", "D3D9.2", "D3D9.1" };
for (int i = 0; i < 6; i++)
{
if (featureLevelsSupported == featureLevelsRequested[i])
ATOM_LOG("[info]: D3D_FEATURE_LEVEL: %s\n", featureLevelNames[i]);
}
ATOM_LOG("[info]: using format: %d, index: %d\n", formats[supportedFormatIndex], supportedFormatIndex);
#endif
InitRendererResources();
return Resize(g_settings.width, g_settings.height);
}