On Tue Feb 28 03:08:39 2023 +0000, **** wrote:
Paul Gofman replied on the mailing list:
On 2/27/23 20:48, Zhiyi Zhang (@zhiyi) wrote: > On Tue Feb 28 00:42:37 2023 +0000, Zebediah Figura wrote: >>>> I'm not very knowledgeable in general about the subtleties of DXGI, >> but this looks potentially reasonable. I assume that we'll end up >> grabbing the window using some internal interface in >> IDCompositionVisual::SetContent() and then performing a GDI blit? >>> Please see commit_target() in >> https://gitlab.winehq.org/zhiyi/wine/-/commit/8d72aa74da59ccb1192fb5cb3d7986f30fb9ed2b. >> The whole DirectComposition branch is at >> https://gitlab.winehq.org/zhiyi/wine/-/tree/directcomposition. >> Basically, it GDI bitblts from the last backbuffer to the window DC. On >> Windows, it is composited by DWM. We don't have a DWM in Wine and I >> don't want to write platform specific code for doing composition so >> blitting to the window DC seems to be good enough. >> Wait, so it blits from the backbuffer, not the frontbuffer? Can we rely >> on Commit() being called every frame *before* Present(), or something? >> I can believe that this is how it's supposed to work, but it's more than >> a little surprising, and doesn't match what the documentation (or the >> example [1]) seems to suggest. I.e. I'd expect in general that Commit() >> doesn't need to be called every frame, and Present() should always >> update the screen with the contents of the current backbuffer. >> [1] https://learn.microsoft.com/en-us/windows/uwp/gaming/directx-and-xaml-interop > It does blit from the frontbuffer. The composition swapchain must be created with DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL. So the last backbuffer is the frontbuffer, I think. That's why I use the last backbuffer the dcomp Commit() implementation. Otherwise, I will need a private interface to access the frontbuffer. The game Corgi Warlock calls Present() and then Commit() every frame. Commit() should be called every frame in DirectComposition to make it work. Please see https://learn.microsoft.com/en-us/windows/win32/directcomp/basic-concepts#transactional-composition > Are you sure about Commit? As I understood some time ago when looking at that Commit should only be called once anything has changed WRT direct composition setup (e. g., transforms, surface configuration). Once direct composition is set up, I think one can only call Present on linked swapchains and that is supposed to be composited according to current configuration. IIRC that is how Webview2 worked.
That's what I am seeing in the Corgi Warlock log. Every Present() is followed by a Commit().