Commit 2c6ce9a
authored
Use len(draw_data.cmd_lists) in imgui backend (#830)
* Draw a frame in test_examples_run
<details><summary>Claude's draft</summary>
test_examples_run() ran an example's __main__ block and stopped there. Under
the offscreen canvas that only constructs the canvas and registers a draw
function, so nothing is drawn and the draw function -- the bulk of most
examples -- was never executed. Draw one frame for every example that exposes
a canvas.
Drawing is not enough on its own: rendercanvas calls the draw function inside
its log_exception() context, so an exception there is logged to the
"rendercanvas" logger and swallowed, and a frame still comes out. Assert that
nothing was logged there.
This makes the imgui examples fail against imgui_bundle 1.92.900, which is the
bug reported in #829 and is fixed in
the next commit.
Resume this Claude session:
```
cd /home/mark/git/wgpu-py
claude --resume 590dd7bc-312c-419e-ad3d-2c69d00943cd
```
</details>
* Use len(draw_data.cmd_lists) in imgui backend
<details><summary>Claude's draft</summary>
`ImDrawData.cmd_lists_count` was a legacy alias, documented in the imgui_bundle
stubs as `== CmdLists.Size`, and imgui_bundle removed it in 1.92.900. Every
`ImguiWgpuBackend.render()` call raises AttributeError against that release.
Fixes #829.
`len(draw_data.cmd_lists)` is exactly what the removed attribute equalled, and
works across the whole supported `imgui-bundle>=1.92.0,<2` range: verified
against 1.92.0, 1.92.3, 1.92.4, 1.92.5, 1.92.600, 1.92.601, 1.92.700, 1.92.801
and 1.92.900. No shim or version check is needed, and the pin does not need
narrowing.
The test from the previous commit fails without this change and passes with it.
Resume this Claude session:
```
cd /home/mark/git/wgpu-py
claude --resume 590dd7bc-312c-419e-ad3d-2c69d00943cd
```
</details>1 parent 9d59b27 commit 2c6ce9a
3 files changed
Lines changed: 23 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
36 | 40 | | |
37 | 41 | | |
38 | 42 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
177 | 178 | | |
178 | 179 | | |
179 | 180 | | |
180 | | - | |
| 181 | + | |
181 | 182 | | |
182 | | - | |
183 | | - | |
184 | | - | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
185 | 199 | | |
186 | 200 | | |
187 | 201 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
445 | 445 | | |
446 | 446 | | |
447 | 447 | | |
448 | | - | |
| 448 | + | |
449 | 449 | | |
450 | 450 | | |
451 | 451 | | |
| |||
0 commit comments