Skip to content

Restore SDL context before VSync updates - #135

Merged
themuffinator merged 1 commit into
mainfrom
codex/fix-sdl3-swapinterval-context
Aug 26, 2026
Merged

Restore SDL context before VSync updates#135
themuffinator merged 1 commit into
mainfrom
codex/fix-sdl3-swapinterval-context

Conversation

@themuffinator

Copy link
Copy Markdown
Owner

Summary

  • make the SDL OpenGL context current before every centralized swap-interval update
  • cover startup, display-mode changes, and live r_swapInterval edits through the existing helper
  • extend the Linux VSync and shared SDL3 backend contracts to lock in ordering
  • document the native-Wayland compatibility fix for 0.12.0

Investigation

A native SDL Wayland run performed while investigating #89 logged:

SDL3: failed to set swap interval 0: No OpenGL context has been made current

The initial window-parameter application may leave SDL's GL context detached before startup applies VSync. GLimp_SetScreenParms already repairs the context on its own path, but SDL3_ApplySwapInterval is also called directly during startup and live cvar handling. Moving the guard into that central helper makes every caller safe and leaves the existing error/accounting path intact.

This corrects a concrete initialization error found during #89 investigation. It does not close #89: the reporter's CachyOS/RTX 3070 performance trace is still needed for the broader settings-panel claim.

Validation

  • python tools/tests/linux_vsync_support.py
  • python tools/tests/macos_sdl3_backend_guard.py
  • python tools/tests/linux_sdl3_glew_loader.py
  • python tools/tests/sdl3_multidisplay_windowing.py
  • tools/build/meson_setup.ps1 compile -C builddir renderer-gl_x64
  • python -m py_compile tools/tests/linux_vsync_support.py tools/tests/macos_sdl3_backend_guard.py
  • git diff --check origin/main...HEAD

No external code was incorporated.

Related: #89

@themuffinator

Copy link
Copy Markdown
Owner Author

Native Wayland runtime evidence is now available from the Clang/no-libdecor commit job in run 33015438667.

I downloaded commit-linux-wayland-x64-clang-no-libdecor-wayland-only-renderer-validation and checked the complete artifact:

  • all six reported validation cases passed (default safety, window lifecycle, repeated window transitions, mouse capture, mouse-capture stress, and display diagnostics)
  • SDL3: swap interval set to 0 appears 36 times across startup and transition runs
  • failed to set swap interval: 0 matches
  • No OpenGL context has been made current: 0 matches
  • renderer diagnostics report zero GL errors/fatals/error lines

This directly exercises native SDL Wayland under Mesa llvmpipe and confirms the initialization failure observed during #89 investigation is gone on this CI path. The wider real-hardware performance question in #89 remains open separately.

@themuffinator
themuffinator merged commit 9e5305f into main Aug 26, 2026
21 of 25 checks passed
@themuffinator
themuffinator deleted the codex/fix-sdl3-swapinterval-context branch August 26, 2026 22:26
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.

Linux/CachyOS: native performance, graphics-settings slowdown, and load times

1 participant