taichi-dev / taichi

Productive, portable, and performant GPU programming in Python.
https://taichi-lang.org
Apache License 2.0
25.47k stars 2.28k forks source link

Unexpect exit of ggui window after clicking Alt, Shift or Ctrl #6513

Open Rabmelon opened 1 year ago

Rabmelon commented 1 year ago

Describe the bug Unexpect exit of ggui after pressing Alt, Shift and Ctrl after using window.get_events in code to press ESC to exit.

To Reproduce I want my ggui can be closed after I press ESC (or other keys such as r). However when I want to change to another window using Alt+Tab I find that the ggui exits wrongly.

It will fatally exit after pressing the button Alt, Shift or Ctrl (maybe not after the first press, but the second or the third press), and refer to the running information the key Super may also cause this error. Also, the problem happens both in my laptop and PC.

import taichi as ti
ti.init()
window = ti.ui.Window('TEST', (768, 512))
while window.running:
    for e in window.get_events(ti.ui.PRESS):
        if e.key == ti.ui.ESCAPE:
            window.running = False
    window.show()

By the way, code as below runs well without the function of pressing a button:

import taichi as ti
ti.init()
window = ti.ui.Window('TEST', (768, 512))
while window.running:
    window.show()

Log All running information:

$ti .\test_ggui.py
[Taichi] version 1.2.1, llvm 10.0.0, commit 12ab828a, win, python 3.9.13
[Taichi] Starting on arch=x64
[I 11/03/22 16:48:17.613 3644] [C:/Users/buildbot/actions-runner/_work/taichi/taichi/taichi/rhi/vulkan/vulkan_device_creator.cpp:pick_physical_device@394] Found Vulkan Device 0 (NVIDIA GeForce RTX 3060 Laptop GPU)
[I 11/03/22 16:48:17.613 3644] [C:/Users/buildbot/actions-runner/_work/taichi/taichi/taichi/rhi/vulkan/vulkan_device_creator.cpp:find_queue_families@148] Async compute queue 2, graphics queue 0
[I 11/03/22 16:48:17.613 3644] [C:/Users/buildbot/actions-runner/_work/taichi/taichi/taichi/rhi/vulkan/vulkan_device_creator.cpp:find_queue_families@148] Async compute queue 2, graphics queue 0
[I 11/03/22 16:48:17.613 3644] [C:/Users/buildbot/actions-runner/_work/taichi/taichi/taichi/rhi/vulkan/vulkan_device_creator.cpp:create_logical_device@462] Vulkan Device "NVIDIA GeForce RTX 3060 Laptop GPU" supports Vulkan 0 version 1.3.194
[I 11/03/22 16:48:17.766 3644] [C:/Users/buildbot/actions-runner/_work/taichi/taichi/taichi/rhi/vulkan/vulkan_device.cpp:create_swap_chain@2416] Creating suface of 768x512
Assertion failed: (key_mod_flags == 0 || g.IO.KeyMods == key_mod_flags) && "Mismatching io.KeyCtrl/io.KeyShift/io.KeyAlt/io.KeySuper vs io.KeyMods", file C:/Users/buildbot/actions-runner/_work/taichi/taichi/external/imgui/imgui.cpp, line 7234
maxstronge commented 1 year ago

Having this exact same issue, any update on this?

Rabmelon commented 1 year ago

Having this exact same issue, any update on this?

Not yet I think. Still having this issue in version 1.3.0.