Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DX12 renderer does not support window transparency #95630

Closed
0x0ACB opened this issue Aug 16, 2024 · 2 comments · Fixed by #99387
Closed

DX12 renderer does not support window transparency #95630

0x0ACB opened this issue Aug 16, 2024 · 2 comments · Fixed by #99387

Comments

@0x0ACB
Copy link
Contributor

0x0ACB commented Aug 16, 2024

Tested versions

4.3

System information

Windows 11

Issue description

Looking at the code Godot currently creates the swapchain via:

res = context_driver->dxgi_factory_get()->CreateSwapChainForHwnd(command_queue->d3d_queue.Get(), surface->hwnd, &swap_chain_desc, nullptr, nullptr, swap_chain_1.GetAddressOf());

which returns DXGI_ERROR_INVALID_CALL and Godot then falls back to DXGI_ALPHA_MODE_IGNORE. Switching to DXGI_ALPHA_MODE_UNSPECIFIED successfully creates the swapchain but the background is still black.

It seems that godot is incorrectly creating the swapchain for transparency when using DX12. Accodring to DX12 validation layer output:

DXGI ERROR: IDXGIFactory::CreateSwapChain: Alpha blended swapchains must be created with CreateSwapChainForComposition, or CreateSwapChainForCoreWindow with the DXGI_SWAP_CHAIN_FLAG_FOREGROUND_LAYER flag. DXGI_SWAP_CHAIN_DESC{ SwapChainType = ..._HWND, BufferDesc = DXGI_MODE_DESC1{Width = 0, Height = 0, RefreshRate = DXGI_RATIONAL{ Numerator = 0, Denominator = 1 }, Format = R8G8B8A8_UNORM, ScanlineOrdering = ..._UNSPECIFIED, Scaling = ..._UNSPECIFIED, Stereo = FALSE }, SampleDesc = DXGI_SAMPLE_DESC{ Count = 1, Quality = 0 }, BufferUsage = 0x20, BufferCount = 3, OutputWindow = 0x00000000009F129A, Scaling = ..._NONE, Windowed = TRUE, SwapEffect = ..._FLIP_DISCARD, AlphaMode = ..._PREMULTIPLIED, Flags = 0x0 } [ MISCELLANEOUS ERROR #183: ]

Steps to reproduce

Minimal reproduction project (MRP)

@0x0ACB 0x0ACB changed the title DX12 renderer does not support transparency DX12 renderer does not support window transparency Aug 16, 2024
@bruvzg
Copy link
Member

bruvzg commented Aug 16, 2024

CreateSwapChainForComposition and CreateSwapChainForCoreWindow seems to be for UWP windows only.

@alvinhochun
Copy link
Contributor

CreateSwapChainForComposition can be used with DirectComposition.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants