Add an ability to update font atlas texture#3761
Add an ability to update font atlas texture#3761thedmd wants to merge 10 commits intoocornut:masterfrom
Conversation
a3415c9 to
05ef674
Compare
|
Thank you for the amazing work reviving this @thedmd. Given the simplified specs for "full reload" this looks good, but I would like us to make sure we have a sensible path for when we'll want to transition this to the fuller version (https://github.com/ocornut/imgui_private/issues/3) 1. Textures may have to be uploaded in _Render (to support dynamic glyphes).I think it may be simpler/favorable to only try to upload at the end of the frame rather than also support the optimal timing for the initialization scenario or rare best-case scenario where we can do a full upload around So presumably, the first (Advanced: to reduce latency on high-performing application, we want to permit custom backend to start uploading the texture after EndFrame() - without waiting for Render() or even Timeline for Frame N:
2. We'll want (in future) to notify the back-end of partial update.This was partially (and bit awkwardly) covered in the original version. I don't think we need to have it 100% ready now but we should explore the proof of concept API at leaast, to ensure a smooth transition from this PR version. Maybe we can even come to the realization that we can implement the API completely today, and have the back-end not fully honor the partial update, or something (not sure that's a good idea). Unrelated (minor): why does |
05ef674 to
0aa4874
Compare
Incremental atlas baking branch i am working on updates font atlas texture outside of imgui frame. Which means that for very first time an unknown glyph is encountered, a fallback character is rendered. It is invisible to naked eye at 60fps so probably is good enough. |
Sorry but this is not good enough. We're working out a scheme with @thedmd to push this forward, it's going to work out :) |
|
Turns out rasterizing glyphs immediately wasnt that big of a deal. I am not quite sure if locking font atlas during frame is warranted. It rebuilds just fine, granted it happens on main thread. The only issue i noticed is that build step intends to clear texture id, which is undesirable as |
Probably not anymore.
Yes this is why we changed all the render loop to use |
7d6e243 to
ff825b0
Compare
| } | ||
|
|
||
| ImGui_ImplDX11_CreateFontsTexture(); | ||
| ImGui_ImplDX11_UpdateFontsTexture(); |
There was a problem hiding this comment.
we doing same in NewFrame, shouldn't we delete this here?
There was a problem hiding this comment.
Work is being done on DX9 backend. Rest of them will be brought to sync after dust settle.
| if (done) | ||
| break; | ||
|
|
||
| ImGui::UpdateFontDemo(); |
There was a problem hiding this comment.
seems like u forgotten to remove this, because it getting exposed only in imgui_demo.cpp, even as static
There was a problem hiding this comment.
got it working after some changes on UpdateFontDemo, seems it still under construction for now
There was a problem hiding this comment.
Please test with DX9. As it is the only one that was changed to match latest changes.
|
Well, status table went out of date after introducing ability to update texture mid-frame. |
|
Technically we also moved this to a private branch for now (but thedmd: you could push that branch back into your public copy) |
cfa79ac to
ff19d38
Compare
|
I pushed private branch here. I expect most backends will not pass build test. DX9 however should build fine. This is still work in progress. |
0c1e5bd to
bb6a60b
Compare
9082d0a to
154ee7e
Compare
154ee7e to
b2b064b
Compare
b2b064b to
6e52f46
Compare
6e52f46 to
03e0c16
Compare
Abstracting ImTextureID/FontAtlas remove complexity in preparation to move code around. Later can be reduced to back to explicit ImTextureID/FontAtlas pair if needed.
ImTextureData is intended to represent atlas pages. It make easy to move texture data around.
…ons. Comments. Demo tweaks.
…er to not call backend's _UpdateTextures()
…ImGui_ImplDX9_UpdateTextures()
03e0c16 to
d1e7efc
Compare
- DPI scaling: - Added DPI scaling manifest - implement DPI change event handler - use imgui fork for proper font atlas reloading: ocornut/imgui#3761 - implement UI element and font scaling on DPI change - reset UI widths on DPI change - Prevent crash when VDFs/level can not be found - Properly clean up D3D objects on exit
|
Work on long-standing PR has been finished and is part of the current WIP branch This is a mixture of early backend work from @ShironekoBen, and ongoing improvements/rework/redesign from @thedmd and me. New protocol is fairly different from the things we drafted back then, but solves the same problem. |
PR add an ability to update font atlas texture. Based on
feature/shadows.There is an information about overall progress:
Backend
Progress: 15/15ImGui_ImplVulkan_UpdateFontsTextureuser can need to use in own code.ImGui_ImplDX12_UpdateFontsTextureuser need to call in own code.Examples
Progress: 20/20ImGui_ImplVulkan_UpdateFontsTextureand explicitly setImGuiBackendFlags_RendererHasTexReloadflag.ImGui_ImplVulkan_UpdateFontsTextureand explicitly setImGuiBackendFlags_RendererHasTexReloadflag.ImGui_ImplDX12_UpdateFontsTextureand explicitly setImGuiBackendFlags_RendererHasTexReloadflag.