Skip to content

example_win32_directx12 Uses More GPU When Minimized #8603

@dooann

Description

@dooann

Version/Branch of Dear ImGui:

Version imgui-1.91.9b.zip

Back-ends:

example_win32_directx12

Compiler, OS:

Windows 11 + MSVC 2022

Full config/build information:

No response

Details:

I'm new to Dear ImGui and tried running the example program from the release version imgui-1.91.9b.zip.

As shown in the screenshot below, GPU usage is around 8% when the window is focused.
Image

However, GPU usage increases to around 16% when the window is minimized.
Image

I also tried running the example_win32_opengl3 sample, which doesn't have this issue.
Then I modified the DirectX12 version based on the OpenGL version, as shown below.

        // Handle window screen locked
        if (g_SwapChainOccluded && g_pSwapChain->Present(0, DXGI_PRESENT_TEST) == DXGI_STATUS_OCCLUDED
            || ::IsIconic(hwnd))
        {
            ::Sleep(10);
            continue;
        }
        g_SwapChainOccluded = false;

I'm not sure if using ::IsIconic(hwnd) is appropriate for DirectX, but it seems to resolve the GPU usage issue.
Image

Screenshots/Video:

No response

Minimal, Complete and Verifiable Example code:

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions