From bd163db74fb84272b89004a2a24cad4a7ec4cd99 Mon Sep 17 00:00:00 2001 From: NeoBrainX Date: Mon, 14 Jun 2010 23:41:17 +0000 Subject: [PATCH] DX11: Fix window resizing. Still some aspect ratio problems though... git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5703 8ced0084-cf51-0410-be5f-012b33b47a6e --- .../Plugins/Plugin_VideoDX11/Src/D3DBase.cpp | 5 +++++ .../Plugins/Plugin_VideoDX11/Src/Render.cpp | 19 ++++++------------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/Source/Plugins/Plugin_VideoDX11/Src/D3DBase.cpp b/Source/Plugins/Plugin_VideoDX11/Src/D3DBase.cpp index e3a6ffaca0..9e84c5814d 100644 --- a/Source/Plugins/Plugin_VideoDX11/Src/D3DBase.cpp +++ b/Source/Plugins/Plugin_VideoDX11/Src/D3DBase.cpp @@ -403,6 +403,11 @@ unsigned int GetBackBufferHeight() { return yres; } void Reset() { + DXGI_SWAP_CHAIN_DESC desc; + D3D::swapchain->ResizeBuffers(1, 0, 0, DXGI_FORMAT_R8G8B8A8_UNORM, 0); + swapchain->GetDesc(&desc); + xres = desc.BufferDesc.Width; + yres = desc.BufferDesc.Height; // TODO: Check whether we need to do anything here } diff --git a/Source/Plugins/Plugin_VideoDX11/Src/Render.cpp b/Source/Plugins/Plugin_VideoDX11/Src/Render.cpp index 50966436f8..7cea3db8c4 100644 --- a/Source/Plugins/Plugin_VideoDX11/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoDX11/Src/Render.cpp @@ -252,7 +252,7 @@ void SetupDeviceObjects() D3D::SetDebugObjectName((ID3D11DeviceChild*)cleardepthstates[1], "depth state for Renderer::ClearScreen (depth buffer enabled)"); // TODO: once multisampling gets implemented, this might need to be changed - D3D11_RASTERIZER_DESC rdesc= CD3D11_RASTERIZER_DESC(D3D11_FILL_SOLID, D3D11_CULL_NONE, false, 0, 0.f, 0.f, false, false, false, false); + D3D11_RASTERIZER_DESC rdesc = CD3D11_RASTERIZER_DESC(D3D11_FILL_SOLID, D3D11_CULL_NONE, false, 0, 0.f, 0.f, false, false, false, false); D3D::device->CreateRasterizerState(&rdesc, &clearraststate); D3D::SetDebugObjectName((ID3D11DeviceChild*)clearraststate, "rasterizer state for Renderer::ClearScreen"); @@ -489,9 +489,7 @@ void CheckForResize() client_height != s_backbuffer_height) && client_width >= 4 && client_height >= 4) { - TeardownDeviceObjects(); - - D3D::Reset(); + D3D::Reset(); s_backbuffer_width = D3D::GetBackBufferWidth(); s_backbuffer_height = D3D::GetBackBufferHeight(); WindowResized = true; @@ -936,15 +934,10 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight) s_target_height = EFB_HEIGHT * yScale; D3D::context->OMSetRenderTargets(1, &D3D::GetBackBuffer()->GetRTV(), NULL); - if (WindowResized) - { - SetupDeviceObjects(); - } - else - { - FBManager.Destroy(); - FBManager.Create(); - } + + FBManager.Destroy(); + FBManager.Create(); + D3D::context->OMSetRenderTargets(1, &FBManager.GetEFBColorTexture()->GetRTV(), FBManager.GetEFBDepthTexture()->GetDSV()); }