AvaloniaUI / Avalonia

Develop Desktop, Embedded, Mobile and WebAssembly apps with C# and XAML. The most popular .NET UI client technology
https://avaloniaui.net
MIT License
25.8k stars 2.23k forks source link

Direct2D1 + Immediate Renderer shows a fully transparent window #5239

Closed shartte closed 11 months ago

shartte commented 3 years ago

Describe the bug When using Win32+Direct2D+Immediate Mode, the Window will not show it's actual content, rather it just shows as transparent.

To Reproduce Steps to reproduce the behavior:

  1. Run the Direct3DInterop sample (After fixing #5238)
  2. See transparent window

Expected behavior The actual window content is rendered and shown.

Screenshots grafik

(Note that moving the Window will correctly show the content underneath the Window, without the usual "tearing" one would see from not implementing WM_PAINT).

Desktop (please complete the following information):

shartte commented 3 years ago

When running through Visual Studio graphics debugger (after first fixing #3496 by removing VideoSupport from the device creation flags), one can see that actual drawing does occur (when resizing the window for example):

grafik

The window is still shown as fully transparent however.

shartte commented 3 years ago

After some experimentation, setting UseWindowsUIComposition = false will fix this problem. When D2D is used, one should likely also disable the use of EGL/WGL since it's redundant. In that case, Windows Composition is also disabled automatically, but the D2D platform should probably check for this.