Conversation
There was a problem hiding this comment.
Pull Request Overview
This pull request fixes DPI scaling issues in the glfw_wgpu backend while also working around a Dawn/Vulkan viewport bug. Key changes include updating the viewport clamping in the wgpu backend, removing redundant mouse position hacks, and adjusting DPI scaling handling in the GLFW implementation.
Reviewed Changes
Copilot reviewed 4 out of 6 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| libs/imgui/backends/imgui_impl_wgpu.h | Removed superfluous macros and wrapped declarations in extern "C". |
| libs/imgui/backends/imgui_impl_wgpu.cpp | Updated viewport calculation with integer clamping as a workaround for Dawn/Vulkan bug. |
| libs/imgui/backends/imgui_impl_glfw.h | Added extern "C" block and updated comments regarding known issues. |
| libs/imgui/backends/imgui_impl_glfw.cpp | Removed DPI scaling multiplications from mouse event callbacks and mouse data updates. |
Files not reviewed (2)
- build.zig: Language not supported
- src/backend_glfw_wgpu.zig: Language not supported
f2ea04e to
7111932
Compare
7111932 to
daafcea
Compare
OndraVoves
left a comment
There was a problem hiding this comment.
Sorry, I didn't notice that request at all. It looks good. The fewer hacks, the easier it will be to maintain and upgrade. PS: Feel free to ping me here or on Discord so I don't miss anything again =D
|
No problem, thanks! |
Let the upstream Dear imgui backends do the DPI scaling and delete our mouse position hacks.
This fixes DPI scaling for glfw_wgpu backend (#3) but exposes a bug in Dawn's vulkan backend. We work around this by ensuring the viewport size is clamped. However, there remains a validation error that results in a crash if the window size is increased; this appears to be a bug in the imgui wgpu backend, where the render target is not resized before the viewport is set.
This ought to be fixed or worked-around before this is merged.
Note: We're going to have to bring Dawn up to a newer version at some point but it's no small feat.
To test these changes, check out zig-gamedev/zig-gamedev#755 and run
zig build triangle_wgpu-run.