Added extra error checking when creating frame buffer.

This commit is contained in:
Branimir Karadžić
2015-04-14 17:03:07 -07:00
parent 63cc071a6e
commit 87a5652b46
2 changed files with 7 additions and 0 deletions

View File

@@ -2656,6 +2656,11 @@ again:
FrameBufferHandle createFrameBuffer(uint8_t _num, TextureHandle* _handles, bool _destroyTextures)
{
BGFX_CHECK_MAIN_THREAD();
BX_CHECK(_num != 0, "Number of frame buffer attachments can't be 0.");
BX_CHECK(_num <= BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS, "Number of frame buffer attachments is larger than allowed %d (max: %d)."
, _num
, BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS
);
BX_CHECK(NULL != _handles, "_handles can't be NULL");
FrameBufferHandle handle = s_ctx->createFrameBuffer(_num, _handles);
if (_destroyTextures)