Fix game window resolution when resizing during fullscreen on Windows

#3699
This commit is contained in:
2026-08-06 06:56:41 +02:00
parent abb5de31df
commit e0346f506e
2 changed files with 15 additions and 3 deletions
@@ -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;