mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-25 09:08:22 -05:00
Merge branch 'master' of cane:bkaradzic/bgfx
This commit is contained in:
commit
0184074392
6 changed files with 857 additions and 740 deletions
1
3rdparty/ocornut-imgui/imgui.cpp
vendored
1
3rdparty/ocornut-imgui/imgui.cpp
vendored
|
@ -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;
|
||||||
|
|
|
@ -508,6 +508,8 @@ struct OcornutImguiContext
|
||||||
m_wm->DockWith(w3, w0, ImGuiWM::E_DOCK_ORIENTATION_BOTTOM);
|
m_wm->DockWith(w3, w0, ImGuiWM::E_DOCK_ORIENTATION_BOTTOM);
|
||||||
}
|
}
|
||||||
#endif // 0
|
#endif // 0
|
||||||
|
|
||||||
|
ImGui::NewFrame();
|
||||||
}
|
}
|
||||||
|
|
||||||
void destroy()
|
void destroy()
|
||||||
|
|
45
src/bgfx.cpp
45
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++;
|
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];
|
BlitItem& bi = m_blitItem[item];
|
||||||
bi.m_srcX = _srcX;
|
bi.m_srcX = _srcX;
|
||||||
bi.m_srcY = _srcY;
|
bi.m_srcY = _srcY;
|
||||||
bi.m_srcZ = _srcZ;
|
bi.m_srcZ = _srcZ;
|
||||||
bi.m_dstX = _dstX;
|
bi.m_dstX = _dstX;
|
||||||
bi.m_dstY = _dstY;
|
bi.m_dstY = _dstY;
|
||||||
bi.m_dstZ = _dstZ;
|
bi.m_dstZ = _dstZ;
|
||||||
bi.m_width = _width;
|
bi.m_width = _width;
|
||||||
bi.m_height = _height;
|
bi.m_height = _height;
|
||||||
bi.m_depth = _depth;
|
bi.m_depth = _depth;
|
||||||
bi.m_srcMip = _srcMip;
|
bi.m_srcMip = _srcMip;
|
||||||
bi.m_dstMip = _dstMip;
|
bi.m_dstMip = _dstMip;
|
||||||
bi.m_src = _src;
|
bi.m_src = _src;
|
||||||
bi.m_dst = _dst;
|
bi.m_dst = _dst;
|
||||||
|
|
||||||
BlitKey key;
|
BlitKey key;
|
||||||
key.m_view = _id;
|
key.m_view = _id;
|
||||||
key.m_item = item;
|
key.m_item = item;
|
||||||
m_blitKeys[item] = key.encode();
|
m_blitKeys[item] = key.encode();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Frame::sort()
|
void Frame::sort()
|
||||||
|
|
|
@ -43,8 +43,8 @@
|
||||||
|
|
||||||
# ifndef BGFX_CONFIG_RENDERER_METAL
|
# ifndef BGFX_CONFIG_RENDERER_METAL
|
||||||
# define BGFX_CONFIG_RENDERER_METAL (0 \
|
# define BGFX_CONFIG_RENDERER_METAL (0 \
|
||||||
|| BX_PLATFORM_IOS \
|
|| BX_PLATFORM_IOS \
|
||||||
|| BX_PLATFORM_OSX \
|
|| (BX_PLATFORM_OSX >= 101100) \
|
||||||
? 1 : 0)
|
? 1 : 0)
|
||||||
# endif // BGFX_CONFIG_RENDERER_METAL
|
# endif // BGFX_CONFIG_RENDERER_METAL
|
||||||
|
|
||||||
|
|
|
@ -712,6 +712,29 @@ namespace bgfx { namespace mtl
|
||||||
uint8_t m_num; // number of color handles
|
uint8_t m_num; // number of color handles
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct OcclusionQueryMTL
|
||||||
|
{
|
||||||
|
OcclusionQueryMTL()
|
||||||
|
: m_control(BX_COUNTOF(m_query) )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void postReset();
|
||||||
|
void preReset();
|
||||||
|
void begin(RenderCommandEncoder& _rce, Frame* _render, OcclusionQueryHandle _handle);
|
||||||
|
void end(RenderCommandEncoder& _rce);
|
||||||
|
void resolve(Frame* _render, bool _wait = false);
|
||||||
|
|
||||||
|
struct Query
|
||||||
|
{
|
||||||
|
OcclusionQueryHandle m_handle;
|
||||||
|
};
|
||||||
|
|
||||||
|
Buffer m_buffer;
|
||||||
|
Query m_query[BGFX_CONFIG_MAX_OCCUSION_QUERIES];
|
||||||
|
bx::RingBufferControl m_control;
|
||||||
|
};
|
||||||
|
|
||||||
} /* namespace metal */ } // namespace bgfx
|
} /* namespace metal */ } // namespace bgfx
|
||||||
|
|
||||||
#endif // BGFX_CONFIG_RENDERER_METAL
|
#endif // BGFX_CONFIG_RENDERER_METAL
|
||||||
|
|
1522
src/renderer_mtl.mm
1522
src/renderer_mtl.mm
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue