Description

We noticed crashes in our application when we attempted to resize a window or switch to full-screen mode. Hence, resizing windows and switching to full screen will result in a crash on Unreal Engine 4.22 (and the latest 4.23).

Versions affects: 4.22, 4.23

OS: Windows 10

Description

Our approach to stereo rendering uses the HMD/Stereo Rendering Interface-implementation of Unreal Engine. When running in true stereoscopic mode, the resize buffers and Fullscreen functionality of the Unreal Engine pipeline is incorrectly implemented (Note we are using an AMD FirePro 5100, in the Passive (Dual Head) mode and duplicating the displays on two monitors).

 

The problematic line for DX11 can be found in D3D11Viewport.cpp, in void FD3D11Viewport::Resize(uint32,uint32,bool,EPixelFormat)at line 257:

VERIFYD3D11RESIZEVIEWPORTRESULT(SwapChain->ResizeBuffers(1…

This should be modified to use QuadStereoBufferEnabled, as in that mode we are using 2 buffers. We needed to ensure that we resized both L and R buffer chains.

Fix: The fix for this issue is as follows:

// Resize the swap chain.

DXGI_FORMAT RenderTargetFormat = GetRenderTargetFormat(PixelFormat);

if (D3DRHI->IsQuadBufferStereoEnabled())

{

VERIFYD3D11RESIZEVIEWPORTRESULT(SwapChain->ResizeBuffers(2, SizeX, SizeY, RenderTargetFormat, DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH), SizeX, SizeY, RenderTargetFormat, D3DRHI->GetDevice());

}

else

{

VERIFYD3D11RESIZEVIEWPORTRESULT(SwapChain->ResizeBuffers(1, SizeX, SizeY, RenderTargetFormat, DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH), SizeX, SizeY, RenderTargetFormat, D3DRHI->GetDevice());

}

Steps to Reproduce

Not sure how to reproduce, but can verify the code is changed in the way described below.

Have Comments or More Details?

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

7
Login to Vote

Cannot Reproduce
ComponentUE - Virtual Production - nDisplay
Affects Versions4.224.23
Target Fix4.24
CreatedOct 2, 2019
ResolvedOct 29, 2019
UpdatedDec 3, 2019