Skip to content

Conversation

@footballhead
Copy link
Collaborator

@footballhead footballhead commented Dec 13, 2025

With PR #581, samples on Windows hit the following assert:

Backend does not support ImGuiBackendFlags_RendererHasTextures, and font atlas is not built! Update backend OR make sure you called ImGui_ImplXXXX_NewFrame() function for renderer backend, which should call io.Fonts->GetTexDataAsRGBA32() / GetTexDataAsAlpha8().

When PR #581 updated imgui from 1.90.3 to 1.92.4, it pulled in an API change from 1.91.6: the DX12 backend should now be initialized with the ImGui_ImplDX12_InitInfo struct. The legacy function sets
ImGuiBackendFlags_RendererHasTextures to false, whereas the new function sets it to true.

The new API is largely the same as the old one, except it now wants:

  • A CommandQueue
  • Depth/Stencil format
  • SRV Descriptor Alloc/Free functions

Based on example_win32_directx12/main.cpp, the last requirement seems complicated. However, we can continue to use the single SRV Descriptor by populating the LegacySingleSrv* fields. This lines up well with the legacy API parameters. Despite being "legacy" parameters, this still uses the new API and avoids the assert. I've created #587 to shift away from the legacy API entirely since it's unknown how using the legacy API could break things in the future.

Fixes #586

With PR google#581, samples on Windows hit the following assert:

```
Backend does not support ImGuiBackendFlags_RendererHasTextures, and font atlas is not built! Update backend OR make sure you called ImGui_ImplXXXX_NewFrame() function for renderer backend, which should call io.Fonts->GetTexDataAsRGBA32() / GetTexDataAsAlpha8().
```

When PR google#581 updated imgui from 1.90.3 to 1.92.4, it pulled in an API
change from 1.91.6: the DX12 backend should now be initialized with the
ImGui_ImplDX12_InitInfo. The legacy function sets
ImGuiBackendFlags_RendererHasTextures to false, whereas the new function
sets it to true.

The new API is largely the same as the old one, except it now wants:

- A CommandQueue
- Depth/Stencil format
- SRV Descriptor Alloc/Free functions

Based on example_win32_directx12, the last requirement seems
complicated. However, we can continue to use the single SRV Descriptor
by populating the LegacySingleSrv* fields. This lines up well with the
legacy API parameters. Despite being "legacy" parameters, this still
uses the new API and avoids the assert. I've created google#587 to shift away
from the legacy API entirely since it's unknown how using the legacy API
could break things in the future.

Fixes google#586
@footballhead footballhead requested a review from Keenuts December 13, 2025 00:09
init_info.Device = grfx::dx12::ToApi(pApp->GetDevice())->GetDxDevice();
// While the deprecated ImGui_ImplDX12_Init function created a command queue, I think (for
// simplicity) that we can just reuse the app's graphics queue.
init_info.CommandQueue = grfx::dx12::ToApi(pApp->GetGraphicsQueue())->GetDxQueue();
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a DirectX expert (DirectXpert? ;) so would love some feedback on this approach

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not an expert either, main question would be: does this work?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Windows DX12: imgui assert: Backend does not support ImGuiBackendFlags_RendererHasTextures

2 participants