Skip reset when nothing changes.

This commit is contained in:
Бранимир Караџић 2020-11-29 17:55:06 -08:00
parent 02ed265d2d
commit 475fea23bc

View File

@ -2985,6 +2985,17 @@ namespace bgfx
BGFX_API_FUNC(void reset(uint32_t _width, uint32_t _height, uint32_t _flags, TextureFormat::Enum _format) )
{
const TextureFormat::Enum format = TextureFormat::Count != _format ? _format : m_init.resolution.format;
if (m_init.resolution.format == format
&& m_init.resolution.width == _width
&& m_init.resolution.height == _height
&& m_init.resolution.reset == _flags)
{
// Nothing changed, ignore request.
return;
}
BX_WARN(g_caps.limits.maxTextureSize >= _width
&& g_caps.limits.maxTextureSize >= _height
, "Frame buffer resolution width or height can't be larger than limits.maxTextureSize %d (width %d, height %d)."
@ -2992,7 +3003,7 @@ namespace bgfx
, _width
, _height
);
m_init.resolution.format = TextureFormat::Count != _format ? _format : m_init.resolution.format;
m_init.resolution.format = format;
m_init.resolution.width = bx::clamp(_width, 1u, g_caps.limits.maxTextureSize);
m_init.resolution.height = bx::clamp(_height, 1u, g_caps.limits.maxTextureSize);
m_init.resolution.reset = 0