Branimir Karadžić пре 10 година
родитељ
комит
06cd83ce20
2 измењених фајлова са 29 додато и 21 уклоњено
  1. 1 0
      3rdparty/ocornut-imgui/imgui.cpp
  2. 28 21
      src/bgfx.cpp

+ 1 - 0
3rdparty/ocornut-imgui/imgui.cpp

@@ -2259,6 +2259,7 @@ static void AddDrawListToRenderList(ImVector<ImDrawList*>& 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.
         // 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);
         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);
         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.MetricsRenderVertices += draw_list->VtxBuffer.Size;
         GImGui->IO.MetricsRenderIndices += draw_list->IdxBuffer.Size;
         GImGui->IO.MetricsRenderIndices += draw_list->IdxBuffer.Size;

+ 28 - 21
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)
 	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++;
-
-		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();
+		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;
+
+			BlitKey key;
+			key.m_view = _id;
+			key.m_item = item;
+			m_blitKeys[item] = key.encode();
+		}
 	}
 	}
 
 
 	void Frame::sort()
 	void Frame::sort()