@@ -2609,7 +2609,16 @@ Error RenderingDeviceDriverD3D12::swap_chain_resize(CommandQueueID p_cmd_queue,
26092609 swap_chain_desc.Height = surface->height ;
26102610
26112611 ComPtr<IDXGISwapChain1> swap_chain_1;
2612+ #ifdef DCOMP_ENABLED
26122613 res = context_driver->dxgi_factory_get ()->CreateSwapChainForComposition (command_queue->d3d_queue .Get (), &swap_chain_desc, nullptr , swap_chain_1.GetAddressOf ());
2614+ #else
2615+ res = context_driver->dxgi_factory_get ()->CreateSwapChainForHwnd (command_queue->d3d_queue .Get (), surface->hwnd , &swap_chain_desc, nullptr , nullptr , swap_chain_1.GetAddressOf ());
2616+ if (!SUCCEEDED (res) && swap_chain_desc.AlphaMode != DXGI_ALPHA_MODE_IGNORE) {
2617+ swap_chain_desc.AlphaMode = DXGI_ALPHA_MODE_IGNORE;
2618+ has_comp_alpha[(uint64_t )p_cmd_queue.id ] = false ;
2619+ res = context_driver->dxgi_factory_get ()->CreateSwapChainForHwnd (command_queue->d3d_queue .Get (), surface->hwnd , &swap_chain_desc, nullptr , nullptr , swap_chain_1.GetAddressOf ());
2620+ }
2621+ #endif
26132622 ERR_FAIL_COND_V (!SUCCEEDED (res), ERR_CANT_CREATE);
26142623
26152624 swap_chain_1.As (&swap_chain->d3d_swap_chain );
@@ -2619,6 +2628,7 @@ Error RenderingDeviceDriverD3D12::swap_chain_resize(CommandQueueID p_cmd_queue,
26192628 ERR_FAIL_COND_V (!SUCCEEDED (res), ERR_CANT_CREATE);
26202629 }
26212630
2631+ #ifdef DCOMP_ENABLED
26222632 if (surface->composition_device .Get () == nullptr ) {
26232633 using PFN_DCompositionCreateDevice = HRESULT (WINAPI *)(IDXGIDevice *, REFIID, void **);
26242634 PFN_DCompositionCreateDevice pfn_DCompositionCreateDevice = (PFN_DCompositionCreateDevice)(void *)GetProcAddress (context_driver->lib_dcomp , " DCompositionCreateDevice" );
@@ -2648,6 +2658,7 @@ Error RenderingDeviceDriverD3D12::swap_chain_resize(CommandQueueID p_cmd_queue,
26482658 res = surface->composition_device ->Commit ();
26492659 ERR_FAIL_COND_V (!SUCCEEDED (res), ERR_CANT_CREATE);
26502660 }
2661+ #endif
26512662
26522663 res = swap_chain->d3d_swap_chain ->GetDesc1 (&swap_chain_desc);
26532664 ERR_FAIL_COND_V (!SUCCEEDED (res), ERR_CANT_CREATE);
0 commit comments