Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: RenderWindow initialization delay  (Read 5314 times)

0 Members and 1 Guest are viewing this topic.

AtomCrafty

  • Newbie
  • *
  • Posts: 8
    • View Profile
RenderWindow initialization delay
« on: July 11, 2017, 11:14:03 pm »
Hey there,

for some reason the SFML.Graphics.RenderWindow constructors behave very inconsistenlty on different setups.

If I run the attached program on my laptop, it only takes about 100 ms to create the window, however on my main machine the constructor doesn't return for about 2.4 seconds.
Both devices run the same build of Windows 10 Professional 64 bit, for more specs see below.
Other users have reported different times between 300 and 3000 ms.
The delay is consistent for each individual setup. E.g. my main machine always takes around 2400 ms.

I'm using SFML.NET 2.2 on top of CSFML 2.4 (also tried 2.2/2.2 and the NuGet configuration).
The problem occurs with both 32 and 64 bit, Debug and Release builds.

- Mario

static void Main() {
        var sw = new Stopwatch();

        sw.Start();
        RenderWindow wind = new RenderWindow(new VideoMode(800, 600, 32), "Test");
        sw.Stop();
        Console.WriteLine($"Time to create window: {sw.Elapsed.Seconds}.{sw.Elapsed.Milliseconds:D3} seconds");

        wind.Closed += (s, e) => wind.Close();

        while(wind.IsOpen) {
                wind.DispatchEvents();
                wind.Clear();
                wind.Display();
        }
}

Specs:

Laptop (~100 ms):
Microsoft Surface Book
Windows 10 Professional 64 bit (version 1703)
Intel Code i7 6600U (2.60 GHz)
8 GB memory
Intel HD Graphics 520 + Unspecified NVIDIA GPU

PC (~2400 ms):
Windows 10 Professional 64 bit (version 1703)
Intel Core i7-3820 (3.6 GHz)
32 GB memory
NVIDIA GeForce GTX 970 2-way SLI + multiple screens (maybe that's an issue?)
« Last Edit: July 11, 2017, 11:17:06 pm by AtomCrafty »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11033
    • View Profile
    • development blog
    • Email
Re: RenderWindow initialization delay
« Reply #1 on: July 14, 2017, 09:21:04 pm »
Run it through a profiler, close the application right after the constructor, check what takes up all the time.
My guess is your graphics driver is taking its time.
Or something with .NET, what framework do you use?
« Last Edit: July 14, 2017, 09:27:50 pm by eXpl0it3r »
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

AtomCrafty

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: RenderWindow initialization delay
« Reply #2 on: July 19, 2017, 02:35:55 am »
>Run it through a profiler
I already did that, the result was just that the RenderWindow constructor takes ages to return.

>What framework do you use?
I'm compiling against .NET Framework version 4.5.2

I just updated my graphics drivers and nothing changed :/ (Version 384.76)

Btw: I'm now using a slightly different SFML setup, but the problem still prevails...
I've compiled the SFML.Net sources as AnyCpu and embedded the single managed and all 32 and 64 bit dlls into my executable to reduce clutter in the program directory.
But tbh I don't think this is relevant to the problem since everything is still acting as it was before.

dabbertorres

  • Hero Member
  • *****
  • Posts: 505
    • View Profile
    • website/blog
Re: RenderWindow initialization delay
« Reply #3 on: July 22, 2017, 07:13:39 pm »
Any difference with SLI disabled?

AtomCrafty

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: RenderWindow initialization delay
« Reply #4 on: July 26, 2017, 11:56:46 pm »
It seems to be about 200 ms slower on average, not exactly what I was hoping for :/

 

anything