Branimir Karadžić 10 years ago
parent
commit
f7130318c0
4 changed files with 23 additions and 17 deletions
  1. 6 6
      src/renderer_d3d11.cpp
  2. 10 5
      src/renderer_d3d12.cpp
  3. 4 3
      src/renderer_d3d9.cpp
  4. 3 3
      src/renderer_gl.cpp

+ 6 - 6
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();

+ 10 - 5
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;
 

+ 4 - 3
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);

+ 3 - 3
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() )
 				{