-
Автор темы
- #1
краш происходит после вызова 79 строки
вот фонты
вызов фонтов фонтво проиходит вовремя ината имгуя который происходить перед включением хука пресент в котором проиходить вызов
C++:
void dependencie::c_render_system::render_draw_data(ImDrawData* draw_data) {
if (TryAcquireSRWLockExclusive(&draw_lock)) {
*m_draw_list_render = *m_draw_list;
ReleaseSRWLockExclusive(&draw_lock);
}
if (m_draw_list_render->CmdBuffer.empty())
return;
if (const auto& last_cmd = m_draw_list_render->CmdBuffer.back(); last_cmd.ElemCount == 0 && !last_cmd.UserCallback) {
m_draw_list_render->CmdBuffer.pop_back();
if (m_draw_list_render->CmdBuffer.empty())
return;
}
const auto imgui_ctx = ImGui::GetCurrentContext();
if (!imgui_ctx)
return;
for (ImGuiViewportP* port_ctx : imgui_ctx->Viewports) {
auto& view_port = port_ctx->DrawDataBuilder;
auto& draw_lists = view_port.Layers[0];
draw_lists->push_front(m_draw_list_render);
{
draw_data->CmdLists.Data = draw_lists->Data;
draw_data->CmdListsCount = draw_lists->Size;
}
}
draw_data->TotalVtxCount += m_draw_list_render->VtxBuffer.Size;
draw_data->TotalIdxCount += m_draw_list_render->IdxBuffer.Size;
imgui_ctx->IO.MetricsRenderVertices = draw_data->TotalVtxCount;
imgui_ctx->IO.MetricsRenderIndices = draw_data->TotalIdxCount;
}
после вызова хука вызывается
C++:
void dependencie::c_render_system::init() {
m_draw_list = IM_NEW(ImDrawList)(ImGui::GetDrawListSharedData());
m_draw_list_active = IM_NEW(ImDrawList)(ImGui::GetDrawListSharedData());
m_draw_list_render = IM_NEW(ImDrawList)(ImGui::GetDrawListSharedData());
}
C++:
void render::c_render::process() {
if (!input_system->inited_imgui())
return;
m_screen_size = *reinterpret_cast<dependencie::vec2_t*>(&ImGui::GetIO().DisplaySize);
render_system->reset_draw_data();
{
// draw everything here.
const dependencie::argb_t clr = {
(255.f),
(255.f),
(255.f),
(255.f)
};
render_system->circle_filled((m_screen_size.x() / 2.f, m_screen_size.y() / 2.f), 30, clr, 360);
}
render_system->swap_draw_data();
}