Skip to content

glwindow: disable fps limit for accurate fps measurement#34

Merged
hermet merged 1 commit into
mainfrom
hermet/fps
Apr 9, 2026
Merged

glwindow: disable fps limit for accurate fps measurement#34
hermet merged 1 commit into
mainfrom
hermet/fps

Conversation

@hermet

@hermet hermet commented Apr 9, 2026

Copy link
Copy Markdown
Member

No description provided.

@hermet hermet requested a review from wenjieshen April 9, 2026 03:52
@hermet hermet self-assigned this Apr 9, 2026
Copilot AI review requested due to automatic review settings April 9, 2026 03:52
@hermet hermet added the enhancement Improve examples label Apr 9, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the OpenGL example window setup to avoid vsync-based frame limiting so FPS output reflects actual render throughput.

Changes:

  • Disable SDL swap interval (vsync) for GlWindow via SDL_GL_SetSwapInterval(0).
  • Minor formatting-only whitespace change in the GlWindow constructor.
Comments suppressed due to low confidence (2)

src/Example.h:388

  • SDL_GL_SetSwapInterval(0) can fail (returns -1) depending on platform/driver; failing silently would defeat the goal of accurate FPS measurement. Please check the return value and log SDL_GetError() (or otherwise surface that vsync couldn’t be disabled).
        window = SDL_CreateWindow("ThorVG Example (OpenGL/ES)", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, width, height, SDL_WINDOW_OPENGL | SDL_WINDOW_HIDDEN | SDL_WINDOW_RESIZABLE);
        context = SDL_GL_CreateContext(window);

        //Create a Canvas

src/Example.h:388

  • Disabling the swap interval here is unconditional for all GL runs, which may significantly increase CPU/GPU usage and introduce tearing even when FPS reporting (print) is off. Consider making this conditional on the FPS-measurement mode (e.g., print) and applying it after window->print is configured (before the first SDL_GL_SwapWindow).

        //Create a Canvas

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/Example.h Outdated
@hermet hermet merged commit 62496d0 into main Apr 9, 2026
2 checks passed
@hermet hermet deleted the hermet/fps branch April 9, 2026 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Improve examples

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants