Added resolution/reset debug info.

This commit is contained in:
Бранимир Караџић
2020-11-29 10:14:37 -08:00
parent bd8204495f
commit f5179b385f
2 changed files with 31 additions and 1 deletions

View File

@@ -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

View File

@@ -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);