I haven't seen any similar problems with other DX11 games (though I haven't actually run any of them in windowed mode, so I'm wondering if I may be doing something wrong. Here is the code that sets up my device and swap chain:
// setup swap chain description
DXGI_SWAP_CHAIN_DESC mSwapChainDesc = { 0 };
mSwapChainDesc.OutputWindow = hwnd;
mSwapChainDesc.Windowed = !fullscreen;
mSwapChainDesc.BufferDesc.Width = windowWidth;
mSwapChainDesc.BufferDesc.Height = windowHeight;
mSwapChainDesc.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
mSwapChainDesc.BufferDesc.RefreshRate.Numerator = 60;
mSwapChainDesc.BufferDesc.RefreshRate.Denominator = 1;
mSwapChainDesc.BufferCount = 1;
mSwapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
mSwapChainDesc.SampleDesc.Count = 1;
mSwapChainDesc.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH;
// create the mDevice
HRESULT result = S_OK;
if (FAILED(result = D3D11CreateDeviceAndSwapChain(nullptr,
D3D_DRIVER_TYPE_HARDWARE,
nullptr,
0,
nullptr,
0,
D3D11_SDK_VERSION,
&mSwapChainDesc,
mSwapChain.ReleaseAndGetAddressOf(),
mDevice.ReleaseAndGetAddressOf(),
nullptr,
mDeviceContext.ReleaseAndGetAddressOf())))
{
ErrorMsg("Failed to create D3D11 mDevice and swap chain");
return false;
}
There doesn't appear to be any error messages - all D3D calls, including the above, appear to succeed.edit: Updated thread title to better reflect the symptoms of the problem.