[wpigui] Handle Direct3D framebuffer resize

This commit is contained in:
Peter Johnson
2020-08-29 22:32:32 -07:00
parent 4cf6947af7
commit 183b7c85a1
5 changed files with 19 additions and 0 deletions

View File

@@ -152,6 +152,15 @@ void gui::PlatformShutdown() {
ImGui_ImplDX11_Shutdown();
}
void gui::PlatformFramebufferSizeChanged(int width, int height) {
if (gPlatformContext && gPlatformContext->pd3dDevice) {
CleanupRenderTarget();
gPlatformContext->pSwapChain->ResizeBuffers(0, width, height,
DXGI_FORMAT_UNKNOWN, 0);
CreateRenderTarget();
}
}
static inline DXGI_FORMAT DXPixelFormat(PixelFormat format) {
switch (format) {
case kPixelRGBA: