补充1.关于DX11.3,11.4的补充。这两个DX11改进的小版本步进,可以充当DX11到DX12的过度,可以为游戏厂商熟悉DX12争取过渡时间,而不像DX9过度到DX10那么步子跨的很大。不过对于有实力的游戏开发商直接用DX12开发也不是问题。
拿DX11.3举例,
struct D3D11_3AppWindowData {
ID3D11Device *device;
ID3D11Device3*device1;
ID3D11DeviceContext *context;
ID3D11DeviceContext3 *context1;
IDXGISwapChain *swap_chain;
IDXGISwapChain1* swap_chain1;
//IDXGISwapChain2 *swap_chain;
ID3D11Texture2D *render_target;
ID3D11Texture2D *depth_stencil;
ID3D11RenderTargetView *render_target_view;
ID3D11DepthStencilView *depth_stencil_view;
int multisample;
};
DX11.3的先关设备和设备上下文是通过DX11的来映射创建的
IDXGIFactory2* dxgiFactory2 = nullptr;
hr = dxgiFactory->QueryInterface(__uuidof(IDXGIFactory2), reinterpret_cast<void**>(&dxgiFactory2));
if (FAILED(hr))
{
Log::message("D3D11_3AppWindow::IDXGIFactory2 失败\n");
return hr;
}
Log::message("D3D11_3AppWindow::create_context 4\n");
if (dxgiFactory2)
{
//DirectX 11.1 or later
hr = app->device->QueryInterface(__uuidof(ID3D11Device3), reinterpret_cast<void**>(&app->device1));
if (SUCCEEDED(hr))
{
Log::message("D3D11_3AppWindow::create_context 5\n");
(void)app->device->QueryInterface(__uuidof(ID3D11DeviceContext3), reinterpret_cast<void**>(&app->context1));
}
else
{
Log::error("ID3D11Device3: failed\n");
}
}
如果保证各个Windows系统性能最优,还有在DX11.3的创建失败后,逐一降低等级映射。
|