From 64c29f2ab75d2bdb6ab855179251f1ff31b4812c Mon Sep 17 00:00:00 2001 From: NeoBrainX Date: Fri, 18 Jun 2010 14:55:18 +0000 Subject: [PATCH] DX11: Fix flickering when resizing the emulator window. git-svn-id: http://dolphin-emu.googlecode.com/svn/trunk@5736 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Plugins/Plugin_VideoDX11/Src/Render.cpp | 43 +++++++++++++------------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/Source/Plugins/Plugin_VideoDX11/Src/Render.cpp b/Source/Plugins/Plugin_VideoDX11/Src/Render.cpp index 75bdcb1c9..6b65824c8 100644 --- a/Source/Plugins/Plugin_VideoDX11/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoDX11/Src/Render.cpp @@ -490,13 +490,9 @@ void CheckForResize() int client_height = rcWindow.bottom - rcWindow.top; // sanity check - if ((client_width != s_backbuffer_width || - client_height != s_backbuffer_height) && + if ((client_width != s_backbuffer_width || client_height != s_backbuffer_height) && client_width >= 4 && client_height >= 4) { - D3D::Reset(); - s_backbuffer_width = D3D::GetBackBufferWidth(); - s_backbuffer_height = D3D::GetBackBufferHeight(); WindowResized = true; } } @@ -957,8 +953,28 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight) if (s_XFB_height > MAX_XFB_HEIGHT) s_XFB_height = MAX_XFB_HEIGHT; } + // update FPS counter + static int fpscount = 1; + static unsigned long lasttime; + if (XFBWrited) ++fpscount; + if (Common::Timer::GetTimeMs() - lasttime > 1000) + { + lasttime = Common::Timer::GetTimeMs(); + s_fps = fpscount - 1; + fpscount = 1; + } + + // set default viewport and scissor, for the clear to work correctly + stats.ResetFrame(); + + // present backbuffer and begin next frame + D3D::Present(); if (xfbchanged || WindowResized) { + D3D::Reset(); + s_backbuffer_width = D3D::GetBackBufferWidth(); + s_backbuffer_height = D3D::GetBackBufferHeight(); + ComputeDrawRectangle(s_backbuffer_width, s_backbuffer_height, false, &dst_rect); xScale = (float)(dst_rect.right - dst_rect.left) / (float)s_XFB_width; @@ -974,23 +990,6 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight) D3D::context->OMSetRenderTargets(1, &FBManager.GetEFBColorTexture()->GetRTV(), FBManager.GetEFBDepthTexture()->GetDSV()); } - - // update FPS counter - static int fpscount = 1; - static unsigned long lasttime; - if (XFBWrited) ++fpscount; - if (Common::Timer::GetTimeMs() - lasttime > 1000) - { - lasttime = Common::Timer::GetTimeMs(); - s_fps = fpscount - 1; - fpscount = 1; - } - - // set default viewport and scissor, for the clear to work correctly - stats.ResetFrame(); - - // present backbuffer and begin next frame - D3D::Present(); D3D::BeginFrame(); Renderer::RestoreAPIState(); D3D::context->OMSetRenderTargets(1, &FBManager.GetEFBColorTexture()->GetRTV(), FBManager.GetEFBDepthTexture()->GetDSV()); -- 2.11.4.GIT