Browse Source

Added resolution/reset debug info.

Бранимир Караџић 5 years ago
parent
commit
f5179b385f
2 changed files with 31 additions and 1 deletions
  1. 26 0
      src/bgfx.cpp
  2. 5 1
      src/bgfx_p.h

+ 26 - 0
src/bgfx.cpp

@@ -1680,6 +1680,31 @@ namespace bgfx
 		BX_TRACE("");
 		BX_TRACE("");
 	}
 	}
 
 
+	void dump(const Resolution& _resolution)
+	{
+		const uint32_t reset = _resolution.reset;
+
+		BX_TRACE("Resolution: %d x %d, format: %s, MSAAx%d"
+			, _resolution.width
+			, _resolution.height
+			, TextureFormat::Count == _resolution.format
+				? "*default*"
+				: bimg::getName(bimg::TextureFormat::Enum(_resolution.format) )
+			, 1 << ( (reset & BGFX_RESET_MSAA_MASK) >> BGFX_RESET_MSAA_SHIFT)
+			);
+		BX_TRACE("\t[%c] Fullscreen",         0 != (reset & BGFX_RESET_FULLSCREEN)         ? 'x' : ' ');
+		BX_TRACE("\t[%c] V-sync",             0 != (reset & BGFX_RESET_VSYNC)              ? 'x' : ' ');
+		BX_TRACE("\t[%c] Max Anisotropy",     0 != (reset & BGFX_RESET_MAXANISOTROPY)      ? 'x' : ' ');
+		BX_TRACE("\t[%c] Capture",            0 != (reset & BGFX_RESET_CAPTURE)            ? 'x' : ' ');
+		BX_TRACE("\t[%c] Flush After Render", 0 != (reset & BGFX_RESET_FLUSH_AFTER_RENDER) ? 'x' : ' ');
+		BX_TRACE("\t[%c] Flip After Render",  0 != (reset & BGFX_RESET_FLIP_AFTER_RENDER)  ? 'x' : ' ');
+		BX_TRACE("\t[%c] sRGB Back Buffer",   0 != (reset & BGFX_RESET_SRGB_BACKBUFFER)    ? 'x' : ' ');
+		BX_TRACE("\t[%c] HDR10",              0 != (reset & BGFX_RESET_HDR10)              ? 'x' : ' ');
+		BX_TRACE("\t[%c] Hi-DPI",             0 != (reset & BGFX_RESET_HIDPI)              ? 'x' : ' ');
+		BX_TRACE("\t[%c] Depth Clamp",        0 != (reset & BGFX_RESET_DEPTH_CLAMP)        ? 'x' : ' ');
+		BX_TRACE("\t[%c] Suspend",            0 != (reset & BGFX_RESET_SUSPEND)            ? 'x' : ' ');
+	}
+
 	TextureFormat::Enum getViableTextureFormat(const bimg::ImageContainer& _imageContainer)
 	TextureFormat::Enum getViableTextureFormat(const bimg::ImageContainer& _imageContainer)
 	{
 	{
 		const uint32_t formatCaps = g_caps.formats[_imageContainer.m_format];
 		const uint32_t formatCaps = g_caps.formats[_imageContainer.m_format];
@@ -1798,6 +1823,7 @@ namespace bgfx
 
 
 		m_init = _init;
 		m_init = _init;
 		m_init.resolution.reset &= ~BGFX_RESET_INTERNAL_FORCE;
 		m_init.resolution.reset &= ~BGFX_RESET_INTERNAL_FORCE;
+		dump(m_init.resolution);
 
 
 		if (g_platformData.ndt          == NULL
 		if (g_platformData.ndt          == NULL
 		&&  g_platformData.nwh          == NULL
 		&&  g_platformData.nwh          == NULL

+ 5 - 1
src/bgfx_p.h

@@ -545,9 +545,12 @@ namespace bgfx
 		return 1;
 		return 1;
 	}
 	}
 
 
-	/// Dump vertex layout into debug output.
+	/// Dump vertex layout info into debug output.
 	void dump(const VertexLayout& _layout);
 	void dump(const VertexLayout& _layout);
 
 
+	/// Dump resolution and reset info into debug output.
+	void dump(const Resolution& _resolution);
+
 	struct TextVideoMem
 	struct TextVideoMem
 	{
 	{
 		TextVideoMem()
 		TextVideoMem()
@@ -2996,6 +2999,7 @@ namespace bgfx
 				| _flags
 				| _flags
 				| (g_platformDataChangedSinceReset ? BGFX_RESET_INTERNAL_FORCE : 0)
 				| (g_platformDataChangedSinceReset ? BGFX_RESET_INTERNAL_FORCE : 0)
 				;
 				;
+			dump(m_init.resolution);
 			g_platformDataChangedSinceReset = false;
 			g_platformDataChangedSinceReset = false;
 
 
 			m_flipAfterRender = !!(_flags & BGFX_RESET_FLIP_AFTER_RENDER);
 			m_flipAfterRender = !!(_flags & BGFX_RESET_FLIP_AFTER_RENDER);