Fixed swapchain with zero size (auto detect resolution)

This commit is contained in:
Simon Lübeß
2024-09-15 21:39:46 +02:00
parent 90b416f7fa
commit 4315c6c5ec
@@ -112,6 +112,14 @@ namespace GlitchyEngine.Renderer
factory.Release(); factory.Release();
} }
if (_width == 0 || _height == 0)
{
nativeSwapChain.GetDescription1(let desc);
_width = desc.Width;
_height = desc.Height;
}
RenderTarget2DDescription desc = .(backBufferFormat, _width, _height); RenderTarget2DDescription desc = .(backBufferFormat, _width, _height);
desc.DepthStencilFormat = _depthStencilFormat; desc.DepthStencilFormat = _depthStencilFormat;
desc.SwapChain = this; desc.SwapChain = this;