Added extra error checking when creating frame buffer.
This commit is contained in:
parent
63cc071a6e
commit
87a5652b46
@ -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)
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user