MethanePowered / MethaneKit

🎲 Modern 3D graphics made simple with C++17 cross-platform framework and rendering abstraction API on top of DirectX 12, Metal & Vulkan
Apache License 2.0
846 stars 51 forks source link

WM_PAINT and some else is triggered for all other windows outside of the main application seemingly every frame #88

Closed microdee closed 3 years ago

microdee commented 3 years ago

Describe the bug WM_PAINT, WM_NCPAINT, WM_ERASEBKGND, WM_CTLCOLORDLG is triggered for all other application open while an App using MethaneKit is running seemingly every frame. This occurs when the mouse cursor is over the main App window. This also causes the Triangle example to drop framerate from let's say ~2500 FPS to ~65 FPS.

Steps To Reproduce Steps to reproduce the behavior:

  1. Build via Build\Windows\Build.bat
  2. Run Build\Output\VisualStudio\Win64-Release\Install\Apps\MethaneHelloTriangle.exe
  3. Hover the cursor over the main window then move it outside the window to see the effect
  4. Optionally open a program which flickers or freezes when WM_PAINT is called (like Task Manager, RegEdit, Spy++ etc.)

Expected behavior MethaneKit app should not affect other apps, and performance should stay consistent when moving the cursor over it.

Screenshots wm_paint_flicker

Desktop:

I'm investigating more a little bit but I figured I'd post this and update with my findings.

egorodet commented 3 years ago

Hello @microdee, thank you for the detailed description of the problem. Unfortunately, I was not able to reproduce the described behavior on several Windows systems at hand. Methane applications do not affect other applications and do not send any of the listed messages to the outer space. You can double check it in Windows platform code Modules/Platform/App/Sources/Methane/Platform/Windows/AppWin.cpp (there's no other Windows message processing code anywhere else). The only messages that are properly posted with window handle are WM_ALERT and WM_CLOSE. Application does not rely on WM_PAINT message, instead it is doing frame rendering in UpdateAndRenderWithErrorHandling() function after every message processing in the main message loop while (m_is_message_processing) { ... }. I could guess that observed glitch could be related to the bugged graphics drivers. Could you please try updating your graphics driver to the latest version and check if the problem has gone?

egorodet commented 3 years ago

@microdee I'm waiting for a few days more and closing this defect as not reproducible in case of no reply.

microdee commented 3 years ago

oh yeah sorry atm I'm busy with something completely different I can have a look again on next Thursday. I'm also pretty sure that I have some weird service settings or driver present. I've made an issue because so far only MethaneKit examples behaved like this on my computer.

microdee commented 3 years ago

I've tried it on an other machine and I couldn't reproduce as well. I don't have time unfortunately to go down the rabbit hole, which shoddy service/driver/config/virus is freaking out by MethaneKit on the previous computer I used, so I consider that my own fault.

egorodet commented 3 years ago

Thanks for double check! So I’m closing the issue as not reproducible.