Fix game window resolution when resizing during fullscreen on Windows
#3699
This commit is contained in:
@@ -162,11 +162,8 @@ void GPUSwapChainDX11::Present(bool vsync)
|
||||
|
||||
bool GPUSwapChainDX11::Resize(int32 width, int32 height)
|
||||
{
|
||||
// Check if size won't change
|
||||
if (width == _width && height == _height)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
_device->WaitForGPU();
|
||||
GPUDeviceLock lock(_device);
|
||||
@@ -174,6 +171,10 @@ bool GPUSwapChainDX11::Resize(int32 width, int32 height)
|
||||
_allowTearing = _device->_allowTearing;
|
||||
#endif
|
||||
_format = GPU_BACK_BUFFER_PIXEL_FORMAT;
|
||||
if (_memoryUsage != 0)
|
||||
{
|
||||
PROFILE_MEM_DEC(Graphics, _memoryUsage);
|
||||
}
|
||||
|
||||
#if PLATFORM_WINDOWS
|
||||
DXGI_SWAP_CHAIN_DESC swapChainDesc;
|
||||
|
||||
@@ -409,6 +409,17 @@ void WindowsWindow::SetClientBounds(const Rectangle& clientArea)
|
||||
int32 width = (int32)clientArea.GetWidth();
|
||||
int32 height = (int32)clientArea.GetHeight();
|
||||
|
||||
// Resize during fullscreen
|
||||
if (changeSize && _swapChain && _swapChain->IsFullscreen())
|
||||
{
|
||||
// Go out fullscreen, resize, and then go back in
|
||||
_swapChain->SetFullscreen(false);
|
||||
_clientSize = clientArea.Size;
|
||||
OnResize(width, height);
|
||||
_swapChain->SetFullscreen(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (changeSize)
|
||||
{
|
||||
_clientSize = clientArea.Size;
|
||||
|
||||
Reference in New Issue
Block a user