-
-
Notifications
You must be signed in to change notification settings - Fork 10.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add an ability to update font atlas texture #3761
base: master
Are you sure you want to change the base?
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
@@ -484,7 +516,7 @@ bool ImGui_ImplDX11_CreateDeviceObjects() | |||
g_pd3dDevice->CreateDepthStencilState(&desc, &g_pDepthStencilState); | |||
} | |||
|
|||
ImGui_ImplDX11_CreateFontsTexture(); | |||
ImGui_ImplDX11_UpdateFontsTexture(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we doing same in NewFrame, shouldn't we delete this here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Work is being done on DX9 backend. Rest of them will be brought to sync after dust settle.
@@ -97,11 +97,15 @@ int main(int, char**) | |||
if (done) | |||
break; | |||
|
|||
ImGui::UpdateFontDemo(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
got it working after some changes on UpdateFontDemo, seems it still under construction for now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
@maximegmd Based on the commit history of https://github.com/ocornut/imgui/commits/features/range_select, I guess when range select is ready, v1.90 will be shipped and this PR would also be included. |
Unfortunately the 1.90 milestone goal was probably too optimistic for this so it’ll probably be a bit later. Right now indeed focusing on range-select and after 1.90 is shipped we can look at this. |
5d50f76
to
9082d0a
Compare
Rebased this on v1.89.8 WIP (18974), done only basic testing. (was a bit tedious because of the NULL->nullptr change in backend but should be all done now). |
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
PR add an ability to update font atlas texture. Based on
feature/shadows
.There is an information about overall progress:
Backend
Progress: 15/15
ImGui_ImplVulkan_UpdateFontsTexture
user can need to use in own code.ImGui_ImplDX12_UpdateFontsTexture
user need to call in own code.Examples
Progress: 20/20
ImGui_ImplVulkan_UpdateFontsTexture
and explicitly setImGuiBackendFlags_RendererHasTexReload
flag.ImGui_ImplVulkan_UpdateFontsTexture
and explicitly setImGuiBackendFlags_RendererHasTexReload
flag.ImGui_ImplDX12_UpdateFontsTexture
and explicitly setImGuiBackendFlags_RendererHasTexReload
flag.