In the following code, where device is an instance of ComPtr<ID3D12Device>
that was successfully initialized with D3D12CreateDevice
, I am getting an failing HRESULT
. I get the value 0x887a0001. I would appreciate any ideas as to what I am doing wrong.
DXGI_SWAP_CHAIN_DESC1 swapChainDesc = {};
swapChainDesc.Width = 0;
swapChainDesc.Height = 0;
swapChainDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
swapChainDesc.Stereo = FALSE;
swapChainDesc.SampleDesc.Count = 1;
swapChainDesc.SampleDesc.Quality = 0;
swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
swapChainDesc.BufferCount = 2;
swapChainDesc.Scaling = DXGI_SCALING_NONE;
swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD;
swapChainDesc.AlphaMode = DXGI_ALPHA_MODE_STRAIGHT;
swapChainDesc.Flags = 0;
ComPtr<IDXGISwapChain1> swapChain;
ThrowIfFailed(factory->CreateSwapChainForHwnd(device.Get(), wnd.handle(),
&swapChainDesc, nullptr,
nullptr, &swapChain));
The first parameter to CreateSwapChain functions is now supposed to be an ID3D12CommandQueue* rather than the graphics device.
Also, set your AlphaMode to DXGI_ALPHA_MODE_UNSPECIFIED.
User contributions licensed under CC BY-SA 3.0