From f5179b385fa0a17f9aceb9fc4b7e5744892425f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D1=80=D0=B0=D0=BD=D0=B8=D0=BC=D0=B8=D1=80=20=D0=9A?= =?UTF-8?q?=D0=B0=D1=80=D0=B0=D1=9F=D0=B8=D1=9B?= Date: Sun, 29 Nov 2020 10:14:37 -0800 Subject: [PATCH] Added resolution/reset debug info. --- src/bgfx.cpp | 26 ++++++++++++++++++++++++++ src/bgfx_p.h | 6 +++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/bgfx.cpp b/src/bgfx.cpp index 10a821fcf..05b8b5081 100644 --- a/src/bgfx.cpp +++ b/src/bgfx.cpp @@ -1680,6 +1680,31 @@ namespace bgfx 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) { const uint32_t formatCaps = g_caps.formats[_imageContainer.m_format]; @@ -1798,6 +1823,7 @@ namespace bgfx m_init = _init; m_init.resolution.reset &= ~BGFX_RESET_INTERNAL_FORCE; + dump(m_init.resolution); if (g_platformData.ndt == NULL && g_platformData.nwh == NULL diff --git a/src/bgfx_p.h b/src/bgfx_p.h index 7b7665ca1..d49209a5a 100644 --- a/src/bgfx_p.h +++ b/src/bgfx_p.h @@ -545,9 +545,12 @@ namespace bgfx return 1; } - /// Dump vertex layout into debug output. + /// Dump vertex layout info into debug output. void dump(const VertexLayout& _layout); + /// Dump resolution and reset info into debug output. + void dump(const Resolution& _resolution); + struct TextVideoMem { TextVideoMem() @@ -2996,6 +2999,7 @@ namespace bgfx | _flags | (g_platformDataChangedSinceReset ? BGFX_RESET_INTERNAL_FORCE : 0) ; + dump(m_init.resolution); g_platformDataChangedSinceReset = false; m_flipAfterRender = !!(_flags & BGFX_RESET_FLIP_AFTER_RENDER);