Skip to content

Fixes the scaling issue in example_sdl2_wgpu#9300

Closed
ypujante wants to merge 1 commit intoocornut:masterfrom
ypujante:sdl2_wgpu_scaling_fix
Closed

Fixes the scaling issue in example_sdl2_wgpu#9300
ypujante wants to merge 1 commit intoocornut:masterfrom
ypujante:sdl2_wgpu_scaling_fix

Conversation

@ypujante
Copy link
Contributor

@ocornut This is a PR for the issues you expressed in this comment (SDL2+WGPU looks extremely bad (screenshot).)

I checked the code and was able to find a fix that is pretty small. I tested it on Windows with scaling as well as on macOS with retina display.

  • enable HIGHDPI support (window flag)
  • use SDL_GetWindowSizeInPixels which returns the size to give to the WebGPU buffer (account for scaling factor)

- enable HIGHDPI support (window flag)
- use SDL_GetWindowSizeInPixels which returns the size to give to the WebGPU buffer (account for scaling factor)
@ocornut
Copy link
Owner

ocornut commented Mar 13, 2026

Thank you! merged with fixes as 4a2e3cc

@ocornut ocornut closed this Mar 13, 2026
@ypujante
Copy link
Contributor Author

Note that I am seeing the same kind of behavior as the GLFW issue you mentioned with this fix (you can see pixel changing when moving windows). So I am not sure what this is about, but most likely it is this Windows scaling...

That being said now it looks identical to the GLFW version so at least it is far more usable!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backends web emscripten, wgpu etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants