Closed LastSunlight closed 4 months ago
I believe that flag is only intended for use with Direct2D.
That said, what are all the options you are providing to DXGI when creating the swapchain? Perhaps more details would help.
Also, have you tried enabling DXGI debugging?
ok,I use this flag with D3D11 to create swapchain in unrealengine5, it works。
this is create details: `DXGI_SWAP_CHAIN_DESC1 SwapChainDesc = {};
BackBufferCount = 2; SwapChainDesc.BufferCount = BackBufferCount; SwapChainDesc.Width = SizeX; SwapChainDesc.Height = SizeY; SwapChainDesc.SampleDesc.Count = 1; SwapChainDesc.SampleDesc.Quality = 0; SwapChainDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM; SwapChainDesc.Flags = DXGI_SWAP_CHAIN_FLAG_GDI_COMPATIBLE; SwapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT | DXGI_USAGE_SHADER_INPUT; DXGI_SWAP_CHAIN_FULLSCREEN_DESC FSSwapChainDesc = {}; FSSwapChainDesc.Windowed = !bIsFullscreen;`
but it look like not support with D3D12. This is details:
https://learn.microsoft.com/en-us/windows/win32/api/dxgi/ne-dxgi-dxgi_swap_chain_flag
ok,I use this flag with D3D11 to create swapchain in unrealengine5, it works。
this is create details: `// Create the swapchain. DXGI_SWAP_CHAIN_DESC1 SwapChainDesc = {}; BackBufferCount = 2; SwapChainDesc.BufferCount = BackBufferCount; SwapChainDesc.Width = SizeX; SwapChainDesc.Height = SizeY; SwapChainDesc.SampleDesc.Count = 1; SwapChainDesc.SampleDesc.Quality = 0; SwapChainDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM; SwapChainDesc.Flags = DXGI_SWAP_CHAIN_FLAG_GDI_COMPATIBLE; SwapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT | DXGI_USAGE_SHADER_INPUT; DXGI_SWAP_CHAIN_FULLSCREEN_DESC FSSwapChainDesc = {}; FSSwapChainDesc.Windowed = !bIsFullscreen;
IDXGISwapChain1* SwapChain1 = nullptr;
HRESULT CreateSwapChainForHwndResult = DXGISwapchainProvider ?
DXGISwapchainProvider->CreateSwapChainForHwnd(Factory2, D3DRHI->GetDevice(), WindowHandle, &SwapChainDesc, &FSSwapChainDesc, nullptr, &SwapChain1) :
Factory2->CreateSwapChainForHwnd(D3DRHI->GetDevice(), WindowHandle, &SwapChainDesc, &FSSwapChainDesc, nullptr, &SwapChain1);`
but it look like not support with D3D12. This is details: https://learn.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgisurface1-getdc
Correct, D3D12 does not provide any native GDI interop support.