Skip to content

VSync setting is not being respected when switching WindowState inside Update event. #2000

Closed
@AQtun81

Description

@AQtun81

Summary

Switching Window.WindowState inside Window.Update event ignores VSync setting defaulting to false.
Switching window state inside Window.Load event works properly.
This issue can be omitted in a hacky way by adding Window.VSync = Window.VSync after switching Window.WindowState

Steps to reproduce

  • Platform: Desktop (Windows 11)
  • Framework Version: .NET 8.0
  • API: OpenGL
  • API Version: OpenGL 3.3.0 Core Profile Context 24.2.1.240215
  1. Initialize window using WindowOptions with VSync set to true
  2. Assign Update event and inside the event change WindowState to Fullscreen.

This will result in fullscreen window that has vsync disabled, with Window.VSync still being set to true.
This issue seems to be present only when switching from any window state to fullscreen.

Minimal code sample reproducing the issue

using Silk.NET.Maths;
using Silk.NET.Windowing;

WindowOptions options = WindowOptions.Default;
options.Size = new Vector2D<int>(1280, 720);
options.Title = "Window Name";
options.VSync = true;

ulong frame = 0;

IWindow Window = Silk.NET.Windowing.Window.Create(options);
Window.Update += OnUpdate;

Window.Run();

void OnUpdate(double dt)
{
    frame++;
    if (frame == 100)
    {
        Window.WindowState = WindowState.Fullscreen;
        // trick below solves the issue
        //Window.VSync = Window.VSync;
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions