diff --git a/src/bgfx.cpp b/src/bgfx.cpp index 5081a346a..8be7d84d1 100644 --- a/src/bgfx.cpp +++ b/src/bgfx.cpp @@ -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) diff --git a/src/bgfx_p.h b/src/bgfx_p.h index 67524d0c1..2c91b0b52 100644 --- a/src/bgfx_p.h +++ b/src/bgfx_p.h @@ -2875,10 +2875,12 @@ namespace bgfx FrameBufferRef& ref = m_frameBufferRef[handle.idx]; ref.m_window = false; memset(ref.un.m_th, 0xff, sizeof(ref.un.m_th) ); + BackbufferRatio::Enum bbRatio = BackbufferRatio::Enum(m_textureRef[_handles[0].idx].m_bbRatio); for (uint32_t ii = 0; ii < _num; ++ii) { TextureHandle texHandle = _handles[ii]; BGFX_CHECK_HANDLE("createFrameBuffer texture handle", m_textureHandle, texHandle); + BX_CHECK(bbRatio == m_textureRef[texHandle.idx].m_bbRatio, "Mismatch in texture back-buffer ratio."); cmdbuf.write(texHandle);