Added warning when passing zero as framebuffer/rendertarget resolution.
This commit is contained in:
parent
f78a18c9b7
commit
68af253169
2 changed files with 5 additions and 3 deletions
|
@ -1197,7 +1197,8 @@ namespace bgfx
|
||||||
RenderTargetHandle createRenderTarget(uint16_t _width, uint16_t _height, uint32_t _flags, uint32_t _textureFlags)
|
RenderTargetHandle createRenderTarget(uint16_t _width, uint16_t _height, uint32_t _flags, uint32_t _textureFlags)
|
||||||
{
|
{
|
||||||
BGFX_CHECK_MAIN_THREAD();
|
BGFX_CHECK_MAIN_THREAD();
|
||||||
return s_ctx.createRenderTarget(_width, _height, _flags, _textureFlags);
|
BX_WARN(0 != _width && 0 != _height, "Render target resolution width or height cannot be 0 (width %d, height %d).", _width, _height);
|
||||||
|
return s_ctx.createRenderTarget(uint16_max(1, _width), uint16_max(1, _height), _flags, _textureFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
void destroyRenderTarget(RenderTargetHandle _handle)
|
void destroyRenderTarget(RenderTargetHandle _handle)
|
||||||
|
|
|
@ -1477,8 +1477,9 @@ namespace bgfx
|
||||||
|
|
||||||
void reset(uint32_t _width, uint32_t _height, uint32_t _flags)
|
void reset(uint32_t _width, uint32_t _height, uint32_t _flags)
|
||||||
{
|
{
|
||||||
m_resolution.m_width = _width;
|
BX_WARN(0 != _width && 0 != _height, "Frame buffer resolution width or height cannot be 0 (width %d, height %d).", _width, _height);
|
||||||
m_resolution.m_height = _height;
|
m_resolution.m_width = uint32_max(1, _width);
|
||||||
|
m_resolution.m_height = uint32_max(1, _height);
|
||||||
m_resolution.m_flags = _flags;
|
m_resolution.m_flags = _flags;
|
||||||
|
|
||||||
memset(m_rt, 0xff, sizeof(m_rt) );
|
memset(m_rt, 0xff, sizeof(m_rt) );
|
||||||
|
|
Reference in a new issue