Library: @native on hot interpreted paths (Begin/End, NewFrame key loops, table rows, sliders, buttons, wrapped text, GetFontBaked)
Fewer native<->interpreter transitions on the per-item call chains. Stress+demo headless (--roblox) 0.98 -> 0.93 ms/frame, draw data unchanged.
This commit is contained in:
1 parent
c1c59bde47
commit
d9d8ee4e6b
4 files changed
+21
No files matched your search
@@ -8985,6 +8985,7 @@ end
|
||||
-- Index A:1 B:2 C:5 D:0 --> A:0 B:2 C:5 D:6
|
||||
-- See 'Metrics->Key Owners & Shortcut Routing' to visualize the result of that operation.
|
||||
--- @param rt ImGuiKeyRoutingTable
|
||||
@native
|
||||
function ImGui.UpdateKeyRoutingTable(rt)
|
||||
local g = GImGui --[[@as ImGuiContext]]
|
||||
rt.EntriesNext:resize(0)
|
||||
@@ -10369,6 +10370,7 @@ end
|
||||
--- @param pos ImVec2
|
||||
--- @param wrap_pos_x float
|
||||
--- @return float
|
||||
@native
|
||||
function ImGui.CalcWrapWidthForPos(pos, wrap_pos_x)
|
||||
if wrap_pos_x < 0.0 then
|
||||
return 0.0
|
||||
@@ -10452,6 +10454,7 @@ end
|
||||
--- @param text string
|
||||
--- @param text_end int?
|
||||
--- @param wrap_width float
|
||||
@native
|
||||
function ImGui.RenderTextWrapped(pos, text, text_end, wrap_width)
|
||||
local g = GImGui
|
||||
local window = g.CurrentWindow
|
||||
@@ -10530,6 +10533,7 @@ end
|
||||
--- @param text_size_if_known? ImVec2
|
||||
--- @param align? ImVec2
|
||||
--- @param clip_rect? ImRect
|
||||
@native
|
||||
function ImGui.RenderTextClipped(pos_min, pos_max, text, text_end, text_size_if_known, align, clip_rect)
|
||||
if not align then align = RenderTextClipped_align0 end
|
||||
|
||||
@@ -12078,6 +12082,7 @@ end
|
||||
--- @param flags? ImGuiWindowFlags
|
||||
--- @return bool is_open # The updated `open` passed in
|
||||
--- @return bool no_skip_items # You always need to call `ImGui.End()` even if false is returned
|
||||
@native
|
||||
function ImGui.Begin(name, open, flags)
|
||||
if flags == nil then flags = 0 end
|
||||
|
||||
@@ -13160,6 +13165,7 @@ end
|
||||
return open, not window.SkipItems
|
||||
end
|
||||
|
||||
@native
|
||||
function ImGui.End()
|
||||
local g = GImGui
|
||||
local window = g.CurrentWindow
|
||||
@@ -13540,6 +13546,7 @@ function ImGui.GetMergedModsFromKeys()
|
||||
return mods
|
||||
end
|
||||
|
||||
@native
|
||||
function ImGui.UpdateKeyboardInputs()
|
||||
local g = GImGui
|
||||
local io = g.IO
|
||||
@@ -13618,6 +13625,7 @@ function ImGui.UpdateKeyboardInputs()
|
||||
ImGui.UpdateKeyRoutingTable(g.KeysRoutingTable)
|
||||
end
|
||||
|
||||
@native
|
||||
function ImGui.UpdateMouseInputs()
|
||||
local g = GImGui
|
||||
local io = g.IO
|
||||
@@ -14157,6 +14165,7 @@ local function FlattenDrawDataIntoSingleLayer(builder)
|
||||
end
|
||||
end
|
||||
|
||||
@native
|
||||
function ImGui.NewFrame()
|
||||
IM_ASSERT(GImGui ~= nil, "No current context. Did you call ImGui::CreateContext() and ImGui::SetCurrentContext() ?")
|
||||
local g = GImGui
|
||||
@@ -15248,6 +15257,7 @@ end
|
||||
|
||||
-- ATTENTION THIS IS IN LEGACY LOCAL SPACE.
|
||||
--- @param wrap_local_pos_x float
|
||||
@native
|
||||
function ImGui.PushTextWrapPos(wrap_local_pos_x)
|
||||
local g = GImGui
|
||||
local window = g.CurrentWindow
|
||||
@@ -15259,6 +15269,7 @@ function ImGui.PushTextWrapPos(wrap_local_pos_x)
|
||||
dc.TextWrapPos = wrap_local_pos_x
|
||||
end
|
||||
|
||||
@native
|
||||
function ImGui.PopTextWrapPos()
|
||||
local g = GImGui
|
||||
local window = g.CurrentWindow
|
||||
|
||||
@@ -3038,6 +3038,7 @@ end
|
||||
--- @param size float
|
||||
--- @param density float?
|
||||
--- @return ImFontBaked?
|
||||
@native
|
||||
function MT.ImFont:GetFontBaked(size, density)
|
||||
if not density then density = -1.0 end
|
||||
|
||||
|
||||
@@ -2259,6 +2259,7 @@ end
|
||||
-- [Public] Starts into the first cell of a new row
|
||||
--- @param row_flags? ImGuiTableRowFlags
|
||||
--- @param row_min_height? float
|
||||
@native
|
||||
function ImGui.TableNextRow(row_flags, row_min_height)
|
||||
if row_flags == nil then row_flags = 0 end
|
||||
if row_min_height == nil then row_min_height = 0.0 end
|
||||
@@ -2288,6 +2289,7 @@ function ImGui.TableNextRow(row_flags, row_min_height)
|
||||
end
|
||||
|
||||
-- [Internal] Only called by TableNextRow()
|
||||
@native
|
||||
function ImGui.TableBeginRow(table_)
|
||||
local window = table_.InnerWindow
|
||||
IM_ASSERT(not table_.IsInsideRow)
|
||||
@@ -2332,6 +2334,7 @@ end
|
||||
local TableEndRow_RowMin, TableEndRow_RowMax = ImVec2(), ImVec2()
|
||||
|
||||
-- [Internal] Called by TableNextRow()
|
||||
@native
|
||||
function ImGui.TableEndRow(table_)
|
||||
local g = GImGui
|
||||
local window = g.CurrentWindow
|
||||
|
||||
@@ -252,6 +252,7 @@ end
|
||||
|
||||
--- @param fmt string
|
||||
--- @param ... any
|
||||
@native
|
||||
function ImGui.TextWrapped(fmt, ...)
|
||||
local g = GImGui
|
||||
local need_backup = (g.CurrentWindow.DC.TextWrapPos < 0.0) -- Keep existing wrap position if one is already set
|
||||
@@ -822,6 +823,7 @@ end
|
||||
--- @param label string
|
||||
--- @param size_arg? ImVec2
|
||||
--- @return bool
|
||||
@native
|
||||
function ImGui.Button(label, size_arg)
|
||||
return ImGui.ButtonEx(label, size_arg, ImGuiButtonFlags.None)
|
||||
end
|
||||
@@ -3991,6 +3993,7 @@ end
|
||||
--- @param out_grab_bb ImRect
|
||||
--- @return T v # updated `v` passed in
|
||||
--- @return bool value_changed
|
||||
@native
|
||||
function ImGui.SliderBehaviorT(TYPE, SIGNEDTYPE, bb, id, data_type, v, v_min, v_max, format, flags, out_grab_bb)
|
||||
local g = GImGui
|
||||
local style = g.Style
|
||||
@@ -4161,6 +4164,7 @@ end
|
||||
--- @param out_grab_bb ImRect
|
||||
--- @return T v
|
||||
--- @return bool value_changed
|
||||
@native
|
||||
function ImGui.SliderBehavior(bb, id, data_type, v, min, max, format, flags, out_grab_bb)
|
||||
-- Read imgui.cpp "API BREAKING CHANGES" section for 1.78 if you hit this assert.
|
||||
IM_ASSERT((flags == 1 or bit32.band(flags, ImGuiSliderFlags.InvalidMask_) == 0), "Invalid ImGuiSliderFlags flags! Has the legacy 'float power' argument been mistakenly cast to flags? Call function with ImGuiSliderFlags_Logarithmic flags instead.")
|
||||
@@ -4244,6 +4248,7 @@ end
|
||||
--- @param max T
|
||||
--- @param format? string
|
||||
--- @param flags? ImGuiSliderFlags
|
||||
@native
|
||||
function ImGui.SliderScalar(label, data_type, data, min, max, format, flags)
|
||||
if flags == nil then flags = 0 end
|
||||
|
||||
@@ -4444,6 +4449,7 @@ end
|
||||
--- @param v_max float
|
||||
--- @param format? string
|
||||
--- @param flags? ImGuiSliderFlags
|
||||
@native
|
||||
function ImGui.SliderFloat(label, v, v_min, v_max, format, flags)
|
||||
if format == nil then format = "%.3f" end
|
||||
if flags == nil then flags = 0 end
|
||||
|
||||
Reference in new issue
Block a user