Skip reset when nothing changes.
This commit is contained in:
parent
02ed265d2d
commit
475fea23bc
13
src/bgfx_p.h
13
src/bgfx_p.h
@ -2985,6 +2985,17 @@ namespace bgfx
|
|||||||
|
|
||||||
BGFX_API_FUNC(void reset(uint32_t _width, uint32_t _height, uint32_t _flags, TextureFormat::Enum _format) )
|
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
|
BX_WARN(g_caps.limits.maxTextureSize >= _width
|
||||||
&& g_caps.limits.maxTextureSize >= _height
|
&& g_caps.limits.maxTextureSize >= _height
|
||||||
, "Frame buffer resolution width or height can't be larger than limits.maxTextureSize %d (width %d, height %d)."
|
, "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
|
, _width
|
||||||
, _height
|
, _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.width = bx::clamp(_width, 1u, g_caps.limits.maxTextureSize);
|
||||||
m_init.resolution.height = bx::clamp(_height, 1u, g_caps.limits.maxTextureSize);
|
m_init.resolution.height = bx::clamp(_height, 1u, g_caps.limits.maxTextureSize);
|
||||||
m_init.resolution.reset = 0
|
m_init.resolution.reset = 0
|
||||||
|
Loading…
Reference in New Issue
Block a user