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

Use direct composition for d3d12 backend #99387

Merged
merged 1 commit into from
Nov 26, 2024

Conversation

0x0ACB
Copy link
Contributor

@0x0ACB 0x0ACB commented Nov 18, 2024

This PR fixes #95630 and can be seen as a partial fix for #76167.

Update D3D12 Renderer to Use Direct Composition

This commit updates the D3D12 renderer to use CreateSwapChainForComposition instead of CreateSwapChainForHwnd, addressing the lack of alpha support in the latter (see #95630).

Switching to direct composition is supposed to have additional benefits according to the Microsoft documentation and other online resources. Specifically, it eliminates the need to transfer the final image to the CPU for DWM composition, which is suggested to improve performance. While I have not empirically verified these performance claims, the explanation aligns with my own research into transparency issues and DWM behavior.

Compatibility Notes

This change requires Windows 8 or later. However, since D3D12 is unsupported on Windows 7 (now EOL for nearly five years), this should not pose a compatibility issue.

@0x0ACB 0x0ACB requested review from a team as code owners November 18, 2024 10:56
@0x0ACB 0x0ACB force-pushed the direct_composition branch from 47eb9ac to c9cf855 Compare November 18, 2024 10:58
Copy link
Member

@bruvzg bruvzg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems good to me, transparency is working as expected.

@0x0ACB 0x0ACB force-pushed the direct_composition branch from 8f968e3 to 09c56e6 Compare November 24, 2024 07:51
Copy link
Contributor

@Repiteo Repiteo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be good to merge after @AThousandShips' suggestion is rebased

@Repiteo Repiteo modified the milestones: 4.x, 4.4 Nov 25, 2024
@0x0ACB 0x0ACB force-pushed the direct_composition branch from 09c56e6 to 67ce8ea Compare November 26, 2024 05:49
@0x0ACB 0x0ACB force-pushed the direct_composition branch from 67ce8ea to a8cd0e9 Compare November 26, 2024 09:28
@Repiteo Repiteo merged commit 127738c into godotengine:master Nov 26, 2024
20 checks passed
@Repiteo
Copy link
Contributor

Repiteo commented Nov 26, 2024

Thanks!

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

Successfully merging this pull request may close these issues.

DX12 renderer does not support window transparency
4 participants