Description

Summary

When a game switches between Windowed and Windowed Fullscreen (borderless), or is minimized and restored, a deferred WM_SIZE message can be processed after the window state has already changed. FWindowsApplication::ProcessDeferredMessage uses the client size stored in that message's lParam, which is no longer current. That stale size goes through FSlateApplication::OnSizeChanged, then FSlateRHIRenderer::RequestResize and FSlateViewportInfo::ResizeViewport, and finally RHIResizeViewport. IDXGISwapChain::ResizeBuffers then fails with DXGI_ERROR_INVALID_CALL and the game hits a fatal error.

The problem is reportedly more frequent with frame generation enabled (FSR 3 FG or XeSS FG), because their swapchain proxies may not tolerate unexpected resizes well.

Root cause

  • ProcessMessage defers WM_SIZE with DeferMessage(). While messages are pumped outside the main loop (GPumpingMessagesOutsideOfMainLoop), the message is queued until ProcessDeferredEvents() runs.
  • FSlateViewportInfo::ResizeViewport calls FlushRenderingCommands(), which pumps messages. As a result, WM_SIZE messages produced during a window mode or size transition are often deferred.
  • When the deferred message is processed, the WM_SIZE case in ProcessDeferredMessage uses LOWORD(lParam) / HIWORD(lParam) and wParam == SIZE_MINIMIZED. Those describe the window when the message was generated, not its current state.
  • The !bIsFullscreen guard only skips exclusive Fullscreen. It does not skip WindowedFullscreen, so in borderless mode the stale size resizes the back buffer.

Suggested fix

In Engine/Source/Runtime/ApplicationCore/Private/Windows/WindowsApplication.cpp, FWindowsApplication::ProcessDeferredMessage, case WM_SIZE: use the window's current client size and minimized state instead of the values in the deferred message.

case WM_SIZE:
	{
		if( CurrentNativeEventWindowPtr.IsValid() )
		{
			// @todo Fullscreen - Perform deferred resize
			// Note WM_SIZE provides the client dimension which is not equal to the window dimension if there is a windows border
			int32 NewWidth = (int)(short)(LOWORD(lParam));
			int32 NewHeight = (int)(short)(HIWORD(lParam));
			bool bWasMinimized = (wParam == SIZE_MINIMIZED);

			// WM_SIZE is deferred while messages are pumped outside the main loop (e.g. in FlushRenderingCommands), so it can be
			// processed after the window was resized, minimized or restored again, e.g. by a switch to borderless fullscreen.
			// Use the window's current state so a stale size doesn't resize the back buffer away from the window's actual size.
			RECT ClientRect;
			if (::GetClientRect(hwnd, &ClientRect))
			{
				NewWidth = ClientRect.right - ClientRect.left;
				NewHeight = ClientRect.bottom - ClientRect.top;
				bWasMinimized = ::IsIconic(hwnd) != FALSE;
			}

			const FGenericWindowDefinition& Definition = CurrentNativeEventWindowPtr->GetDefinition();
			if ( Definition.IsRegularWindow && !Definition.HasOSWindowBorder )
			{
				CurrentNativeEventWindowPtr->AdjustWindowRegion(NewWidth, NewHeight);
			}

			const bool bIsFullscreen = (CurrentNativeEventWindowPtr->GetWindowMode() == EWindowMode::Type::Fullscreen);

			// When in fullscreen Windows rendering size should be determined by the application. Do not adjust based on WM_SIZE messages.
			if ( !bIsFullscreen )
			{
				const bool Result = MessageHandler->OnSizeChanged(CurrentNativeEventWindowPtr.ToSharedRef(), NewWidth, NewHeight, bWasMinimized);
			}
		}
	}
	break;

If GetClientRect fails (for example, the window was already destroyed), the code falls back to the message values.

Open questions and risks

  • FSlateApplication::OnSizeChanged calls Renderer->RequestResize() even when bWasMinimized is true. Confirm what GetClientRect returns for an iconic window. If it is a small non-zero size such as 160x28, the minimized case may need to skip the resize.
  • FSlateViewportInfo::ResizeViewport returns early when the size has not changed, so redundant deferred WM_SIZE messages that now resolve to the same current size will not resize the swapchain again.
  • If the frame generation crash is actually a present/resize race inside the FG swapchain proxy, this change reduces how often it happens but does not fix it. Confirm with an FG-on callstack.
  • Alternative: coalesce queued WM_SIZE messages per window in ProcessDeferredEvents so only the latest one is processed.
Steps to Reproduce

1. Launch a D3D12 Windows game build (Shipping or Test) in Windowed mode.

2. Enable frame generation (FSR 3 Frame Generation or XeSS Frame Generation). This makes the issue much more frequent, but it also reproduces without FG.

3. Repeatedly toggle the window mode between Windowed and Windowed Fullscreen (borderless), e.g. with Alt+Enter or the video settings menu. Do this quickly and several times in a row.

4. Optionally, also minimize and restore the window during or just after a toggle (Win+D or the minimize button), with the game window losing focus.

5. Expected: the window mode changes and rendering continues at the new size.

6. Actual: the game crashes with a fatal error: "SwapChain1->ResizeBuffers(...) failed ... with error DXGI_ERROR_INVALID_CALL", with a callstack through FWindowsApplication::ProcessDeferredEvents -> ProcessDeferredMessage -> FSlateApplication::OnSizeChanged -> FSlateViewportInfo::ResizeViewport -> RHIResizeViewport. The Size in the error often does not match the window's actual size (e.g. 160x28, approximately a minimized window).

Repro rate: intermittent. It depends on timing, because the WM_SIZE message has to be deferred while messages are pumped outside the main loop (e.g. during FlushRenderingCommands).

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-411145 in the post.

0
Login to Vote

Duplicate
ComponentUE - Rendering - RHI
Affects Versions5.8, 6.0
CreatedNov 5, 2026
ResolvedNov 6, 2026
UpdatedDec 4, 2026
View Jira Issue