Fix editor startup gray flash
This commit is contained in:
@@ -96,15 +96,24 @@ inline int RunEditor(HINSTANCE hInstance, int nCmdShow) {
|
||||
SendMessageW(hwnd, WM_SETICON, ICON_SMALL, reinterpret_cast<LPARAM>(wc.hIconSm));
|
||||
}
|
||||
|
||||
ShowWindow(hwnd, nCmdShow);
|
||||
UpdateWindow(hwnd);
|
||||
|
||||
if (!Application::Get().Initialize(hwnd)) {
|
||||
DestroyWindow(hwnd);
|
||||
UnregisterClassW(wc.lpszClassName, wc.hInstance);
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Warm up a few hidden frames first. On D3D12 flip-model swap chains the first visible
|
||||
// presents can otherwise show only the host clear color while the UI/render backend settles.
|
||||
constexpr int kBootstrapFrameCount = 3;
|
||||
for (int frameIndex = 0; frameIndex < kBootstrapFrameCount; ++frameIndex) {
|
||||
Application::Get().Render();
|
||||
}
|
||||
|
||||
// Show the window only after the swap chain already contains composed editor frames.
|
||||
ShowWindow(hwnd, nCmdShow);
|
||||
Application::Get().Render();
|
||||
UpdateWindow(hwnd);
|
||||
|
||||
MSG msg = {};
|
||||
while (msg.message != WM_QUIT) {
|
||||
if (PeekMessageW(&msg, nullptr, 0U, 0U, PM_REMOVE)) {
|
||||
|
||||
Reference in New Issue
Block a user