From f7130318c0cf62f42ae4b8a76633c9e09409f32b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Wed, 21 Oct 2015 22:04:28 -0700 Subject: [PATCH] Cleanup. --- src/renderer_d3d11.cpp | 12 ++++++------ src/renderer_d3d12.cpp | 15 ++++++++++----- src/renderer_d3d9.cpp | 7 ++++--- src/renderer_gl.cpp | 6 +++--- 4 files changed, 23 insertions(+), 17 deletions(-) diff --git a/src/renderer_d3d11.cpp b/src/renderer_d3d11.cpp index 44a75590..f749e2d2 100644 --- a/src/renderer_d3d11.cpp +++ b/src/renderer_d3d11.cpp @@ -2129,9 +2129,9 @@ BX_PRAGMA_DIAGNOSTIC_POP(); uint32_t flags = _resolution.m_flags & ~(BGFX_RESET_HMD_RECENTER | BGFX_RESET_MAXANISOTROPY); - if ( getBufferWidth() != _resolution.m_width - || getBufferHeight() != _resolution.m_height - || m_resolution.m_flags != flags) + if (m_resolution.m_width != _resolution.m_width + || m_resolution.m_height != _resolution.m_height + || m_resolution.m_flags != flags) { flags &= ~BGFX_RESET_FORCE; @@ -2140,12 +2140,12 @@ BX_PRAGMA_DIAGNOSTIC_POP(); && (m_resolution.m_flags&BGFX_RESET_MSAA_MASK) == (flags&BGFX_RESET_MSAA_MASK) ; - m_textVideoMem.resize(false, _resolution.m_width, _resolution.m_height); - m_textVideoMem.clear(); - m_resolution = _resolution; m_resolution.m_flags = flags; + m_textVideoMem.resize(false, _resolution.m_width, _resolution.m_height); + m_textVideoMem.clear(); + setBufferSize(_resolution.m_width, _resolution.m_height); preReset(); diff --git a/src/renderer_d3d12.cpp b/src/renderer_d3d12.cpp index a8def426..07bafc5d 100644 --- a/src/renderer_d3d12.cpp +++ b/src/renderer_d3d12.cpp @@ -1642,17 +1642,22 @@ data.NumQualityLevels = 0; m_maxAnisotropy = 1; } - if ( (uint32_t)m_scd.BufferDesc.Width != _resolution.m_width - || (uint32_t)m_scd.BufferDesc.Height != _resolution.m_height - || m_resolution.m_flags != _resolution.m_flags) + uint32_t flags = _resolution.m_flags & ~(BGFX_RESET_HMD_RECENTER | BGFX_RESET_MAXANISOTROPY); + + if (m_resolution.m_width != _resolution.m_width + || m_resolution.m_height != _resolution.m_height + || m_resolution.m_flags != flags) { + flags &= ~BGFX_RESET_FORCE; + bool resize = (m_resolution.m_flags&BGFX_RESET_MSAA_MASK) == (_resolution.m_flags&BGFX_RESET_MSAA_MASK); + m_resolution = _resolution; + m_resolution.m_flags = flags; + m_textVideoMem.resize(false, _resolution.m_width, _resolution.m_height); m_textVideoMem.clear(); - m_resolution = _resolution; - m_resolution.m_flags &= ~BGFX_RESET_FORCE; m_scd.BufferDesc.Width = _resolution.m_width; m_scd.BufferDesc.Height = _resolution.m_height; diff --git a/src/renderer_d3d9.cpp b/src/renderer_d3d9.cpp index 41b4e7d1..8ac61167 100644 --- a/src/renderer_d3d9.cpp +++ b/src/renderer_d3d9.cpp @@ -1173,12 +1173,13 @@ namespace bgfx { namespace d3d9 ; uint32_t flags = _resolution.m_flags & ~(BGFX_RESET_HMD_RECENTER | BGFX_RESET_MAXANISOTROPY); - if (m_params.BackBufferWidth != _resolution.m_width - || m_params.BackBufferHeight != _resolution.m_height - || m_resolution.m_flags != flags) + if (m_resolution.m_width != _resolution.m_width + || m_resolution.m_height != _resolution.m_height + || m_resolution.m_flags != flags) { flags &= ~BGFX_RESET_FORCE; + m_resolution = _resolution; m_resolution.m_flags = flags; m_textVideoMem.resize(false, _resolution.m_width, _resolution.m_height); diff --git a/src/renderer_gl.cpp b/src/renderer_gl.cpp index 7d8201ad..d331cb24 100644 --- a/src/renderer_gl.cpp +++ b/src/renderer_gl.cpp @@ -2348,12 +2348,12 @@ namespace bgfx { namespace gl { flags &= ~BGFX_RESET_FORCE; - m_textVideoMem.resize(false, _resolution.m_width, _resolution.m_height); - m_textVideoMem.clear(); - m_resolution = _resolution; m_resolution.m_flags = flags; + m_textVideoMem.resize(false, _resolution.m_width, _resolution.m_height); + m_textVideoMem.clear(); + if ( (flags & BGFX_RESET_HMD) && m_ovr.isInitialized() ) {