Added warning when passing zero as framebuffer/rendertarget resolution.

This commit is contained in:
bkaradzic 2013-01-29 19:23:56 -08:00
parent f78a18c9b7
commit 68af253169
2 changed files with 5 additions and 3 deletions

View file

@ -1197,7 +1197,8 @@ namespace bgfx
RenderTargetHandle createRenderTarget(uint16_t _width, uint16_t _height, uint32_t _flags, uint32_t _textureFlags)
{
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)

View file

@ -1477,8 +1477,9 @@ namespace bgfx
void reset(uint32_t _width, uint32_t _height, uint32_t _flags)
{
m_resolution.m_width = _width;
m_resolution.m_height = _height;
BX_WARN(0 != _width && 0 != _height, "Frame buffer resolution width or height cannot be 0 (width %d, height %d).", _width, _height);
m_resolution.m_width = uint32_max(1, _width);
m_resolution.m_height = uint32_max(1, _height);
m_resolution.m_flags = _flags;
memset(m_rt, 0xff, sizeof(m_rt) );