MCPcopy Create free account
hub / github.com/KebsCS/KBotExt / DeIndexAllBuffers

Method DeIndexAllBuffers

KBotExt/imgui/imgui_draw.cpp:1871–1887  ·  view source on GitHub ↗

For backward compatibility: convert all buffers from indexed to de-indexed, in case you cannot render indexed. Note: this is slow and most likely a waste of resources. Always prefer indexed rendering!

Source from the content-addressed store, hash-verified

1869
1870// For backward compatibility: convert all buffers from indexed to de-indexed, in case you cannot render indexed. Note: this is slow and most likely a waste of resources. Always prefer indexed rendering!
1871void ImDrawData::DeIndexAllBuffers()
1872{
1873 ImVector<ImDrawVert> new_vtx_buffer;
1874 TotalVtxCount = TotalIdxCount = 0;
1875 for (int i = 0; i < CmdListsCount; i++)
1876 {
1877 ImDrawList* cmd_list = CmdLists[i];
1878 if (cmd_list->IdxBuffer.empty())
1879 continue;
1880 new_vtx_buffer.resize(cmd_list->IdxBuffer.Size);
1881 for (int j = 0; j < cmd_list->IdxBuffer.Size; j++)
1882 new_vtx_buffer[j] = cmd_list->VtxBuffer[cmd_list->IdxBuffer[j]];
1883 cmd_list->VtxBuffer.swap(new_vtx_buffer);
1884 cmd_list->IdxBuffer.resize(0);
1885 TotalVtxCount += cmd_list->VtxBuffer.Size;
1886 }
1887}
1888
1889// Helper to scale the ClipRect field of each ImDrawCmd.
1890// Use if your final output buffer is at a different scale than draw_data->DisplaySize,

Callers

nothing calls this directly

Calls 2

swapMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected