Roblox backend: patches.lua, Luau-tuned replacements of hot library internals (text rendering, text size cache hit)
New backend module installed when the backend loads (the library sources stay the 1:1 port): MT.ImFont.RenderText and MT.ImDrawList.AddText share one native core (clip rect as numbers, PrimReserve inlined, no CPU fine clip branches, AddText without the clip rect copy and extra call); ImFontCalcTextSizeXY checks its cache hit first. Uncommon cases (byte-table text, CPU fine clip, > 10k bytes unwrapped, texture change mid-text) go to the originals. One switch per patch (Enabled), M.Set() for in-process A/B. Draw hashes, composite pixels identical; imgui time -3..-4% (Studio in-process A/B and headless).
This commit is contained in:
1 parent
9fae61208b
commit
61bf899aa6
3 files changed
+290
No files matched your search
@@ -18,6 +18,10 @@ there, but keep this port's existing data structures and conventions. Read the s
|
||||
`return M`; `bundle.py` inlines them into the `imgui_impl_roblox.lua` function (one `do ... end` each, in dependency
|
||||
order, `X` a local of that function). Use one name per module everywhere; no circular includes (late-bind a field on
|
||||
a shared table instead, e.g. `EditableImages.FreeTile`).
|
||||
- Roblox/Luau-specific replacements of hot library internals go in `backends/roblox/patches.lua` (installed when the
|
||||
backend loads, one switch per patch in `Enabled`), never in the library sources. They must stay exactly equivalent
|
||||
(draw hashes, pixels) and hand uncommon cases back to the original; patch `MT.*` methods or globals looked up at
|
||||
call time. When changing a patched library function, update or disable its patch.
|
||||
- No `goto`, no `::labels::`, no `setfenv/getfenv`, no LuaJIT `bit`/`ffi`. Use `bit32`. For `continue` use
|
||||
`repeat ... until true` with `break`, and an explicit flag when the loop itself must break out of the wrapper.
|
||||
- Luau has a limit of 200 locals per function and 255 upvalues; split huge functions (like demo sections) into
|
||||
|
||||
Reference in new issue
Block a user