From 06cd83ce20d384c2e48f2e6b3aaf5cf0c4e16f88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Wed, 4 Nov 2015 16:19:25 -0800 Subject: [PATCH] Cleanup. --- 3rdparty/ocornut-imgui/imgui.cpp | 1 + src/bgfx.cpp | 45 ++++++++++++++++++-------------- 2 files changed, 27 insertions(+), 19 deletions(-) diff --git a/3rdparty/ocornut-imgui/imgui.cpp b/3rdparty/ocornut-imgui/imgui.cpp index 81a6d0795..92963304a 100644 --- a/3rdparty/ocornut-imgui/imgui.cpp +++ b/3rdparty/ocornut-imgui/imgui.cpp @@ -2259,6 +2259,7 @@ static void AddDrawListToRenderList(ImVector& out_render_list, ImDr // If this assert triggers because you are drawing lots of stuff manually, A) workaround by calling BeginChild()/EndChild() to put your draw commands in multiple draw lists, B) #define ImDrawIdx to a 'unsigned int' in imconfig.h and render accordingly. const unsigned long long int max_vtx_idx = (unsigned long long int)1L << (sizeof(ImDrawIdx)*8); IM_ASSERT((unsigned long long int)draw_list->_VtxCurrentIdx <= max_vtx_idx); + (void)max_vtx_idx; GImGui->IO.MetricsRenderVertices += draw_list->VtxBuffer.Size; GImGui->IO.MetricsRenderIndices += draw_list->IdxBuffer.Size; diff --git a/src/bgfx.cpp b/src/bgfx.cpp index 8fef39bf4..a706e1ccb 100644 --- a/src/bgfx.cpp +++ b/src/bgfx.cpp @@ -868,27 +868,34 @@ namespace bgfx void Frame::blit(uint8_t _id, TextureHandle _dst, uint8_t _dstMip, uint16_t _dstX, uint16_t _dstY, uint16_t _dstZ, TextureHandle _src, uint8_t _srcMip, uint16_t _srcX, uint16_t _srcY, uint16_t _srcZ, uint16_t _width, uint16_t _height, uint16_t _depth) { - uint16_t item = m_numBlitItems++; + BX_WARN(m_numBlitItems < BGFX_CONFIG_MAX_BLIT_ITEMS + , "Exceed number of available blit items per frame. BGFX_CONFIG_MAX_BLIT_ITEMS is %d. Skipping blit." + , BGFX_CONFIG_MAX_BLIT_ITEMS + ); + if (m_numBlitItems < BGFX_CONFIG_MAX_BLIT_ITEMS) + { + uint16_t item = m_numBlitItems++; - BlitItem& bi = m_blitItem[item]; - bi.m_srcX = _srcX; - bi.m_srcY = _srcY; - bi.m_srcZ = _srcZ; - bi.m_dstX = _dstX; - bi.m_dstY = _dstY; - bi.m_dstZ = _dstZ; - bi.m_width = _width; - bi.m_height = _height; - bi.m_depth = _depth; - bi.m_srcMip = _srcMip; - bi.m_dstMip = _dstMip; - bi.m_src = _src; - bi.m_dst = _dst; + BlitItem& bi = m_blitItem[item]; + bi.m_srcX = _srcX; + bi.m_srcY = _srcY; + bi.m_srcZ = _srcZ; + bi.m_dstX = _dstX; + bi.m_dstY = _dstY; + bi.m_dstZ = _dstZ; + bi.m_width = _width; + bi.m_height = _height; + bi.m_depth = _depth; + bi.m_srcMip = _srcMip; + bi.m_dstMip = _dstMip; + bi.m_src = _src; + bi.m_dst = _dst; - BlitKey key; - key.m_view = _id; - key.m_item = item; - m_blitKeys[item] = key.encode(); + BlitKey key; + key.m_view = _id; + key.m_item = item; + m_blitKeys[item] = key.encode(); + } } void Frame::sort()