Skip to content

Win32: Handle arbitrary DPI awareness context types - #335

Merged
prokopyl merged 20 commits into
masterfrom
win32-extra-dpi-awarness
Sep 12, 2026
Merged

prokopyl merged 20 commits into
masterfrom
win32-extra-dpi-awarness

Conversation

@prokopyl

@prokopyl prokopyl commented Sep 8, 2026

Copy link
Copy Markdown
Member

Fixes #307, and possibly even #321

@prokopyl prokopyl added this to the v0.3.X milestone Sep 8, 2026
@prokopyl
prokopyl merged commit 97e350c into master Sep 12, 2026
14 checks passed
@prokopyl
prokopyl deleted the win32-extra-dpi-awarness branch September 12, 2026 15:54
shakey-ltd added a commit to shakey-ltd/baseview that referenced this pull request Sep 14, 2026
RustAudio#107's fix (this fork's whole reason for existing)
replaced a process-wide SetProcessDpiAwarenessContext call with a
thread-scoped one entered right before CreateWindowExW. That's correct
for the host-corruption bug it targets, but some AMD/NVIDIA Windows GPU
drivers misbehave specifically when SetThreadDpiAwarenessContext is
called immediately before creating a window that will get an OpenGL
context -- the rendered output comes out corrupted/mis-scaled. This is
RustAudio#321 upstream, fixed there via RustAudio#335 (merged into
baseview 0.3.4) by having OpenGL windows skip explicit thread/process
DPI-awareness calls entirely and just inherit whatever the host process
already declared for itself.

Upstream's fix lives in a much larger DpiScalingStrategy abstraction
introduced by a full platform-code refactor that doesn't exist on this
pre-refactor 0.1.0 line, so it's not directly portable. This ports the
same conceptual fix onto our simpler ThreadDpiAwarenessScope: skip
entering the scope when the window being created wants an OpenGL
context (options.gl_config.is_some()), leaving non-GL windows unaffected.

Verified: cargo check --target x86_64-pc-windows-gnu, both with
--features opengl and --no-default-features. Not yet verified against
real Windows GPU hardware (the actual bug only reproduces on real AMD/
NVIDIA drivers, not CI/virtual GPUs, per upstream's own findings).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LZNfuUKgDJnCV5wXU1xoAx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Win32: support arbitrary DPI awareness contexts

1 participant