diff --git a/CHANGELOG.md b/CHANGELOG.md index a458f3a2..3cb4bbc4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,10 @@ Possible sections in each release: Downstream code should capture that error and skip the frame, optionally invoking some sort of sleep to save energy. See https://github.com/pygfx/wgpu-py/pull/820 for context. +### Fixed: +* The imgui backend no longer uses ``ImDrawData.cmd_lists_count``, which was removed in imgui-bundle 1.92.900. + See https://github.com/pygfx/wgpu-py/issues/829. + ## [v0.31.1] - 23-06-2026 diff --git a/examples/tests/test_examples.py b/examples/tests/test_examples.py index 2cffb502..4fdc0f79 100644 --- a/examples/tests/test_examples.py +++ b/examples/tests/test_examples.py @@ -4,6 +4,7 @@ import os import importlib +import logging import runpy import sys from unittest.mock import patch @@ -177,11 +178,24 @@ def update_diffs(module, is_similar, img, stored_img, *, atol): @pytest.mark.parametrize("module", examples_to_run) -def test_examples_run(module, force_offscreen): +def test_examples_run(module, force_offscreen, caplog): """Run every example marked to see if they can run without error.""" - # use runpy so the module is not actually imported (and can be gc'd) - # but also to be able to run the code in the __main__ block - runpy.run_module(f"examples.{module}", run_name="__main__") + with caplog.at_level(logging.ERROR, logger="rendercanvas"): + # use runpy so the module is not actually imported (and can be gc'd) + # but also to be able to run the code in the __main__ block + module_globals = runpy.run_module(f"examples.{module}", run_name="__main__") + + # The main block only sets up the canvas and hands it a draw function; + # the offscreen canvas does not draw until asked. So ask, otherwise the + # draw function (the bulk of most examples) is never executed. + canvas = module_globals.get("canvas") + if canvas is not None: + canvas.draw() + + # rendercanvas calls the draw function inside a log_exception() context, so + # errors in it do not propagate; they only show up in the log. + errors = [r for r in caplog.records if r.name == "rendercanvas"] + assert not errors, caplog.text if __name__ == "__main__": diff --git a/wgpu/utils/imgui/imgui_backend.py b/wgpu/utils/imgui/imgui_backend.py index 2b87ded1..73a8bd5a 100644 --- a/wgpu/utils/imgui/imgui_backend.py +++ b/wgpu/utils/imgui/imgui_backend.py @@ -445,7 +445,7 @@ def render( fb_width = int(display_width * draw_data.framebuffer_scale.x) fb_height = int(display_height * draw_data.framebuffer_scale.y) - if fb_width <= 0 or fb_height <= 0 or draw_data.cmd_lists_count == 0: + if fb_width <= 0 or fb_height <= 0 or len(draw_data.cmd_lists) == 0: return if draw_data.textures is not None: