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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - jerrymk

Pages: [1]
1
Window / RenderWindow lags occasionally for up to 100ms
« on: April 09, 2021, 10:33:55 am »
UPDATE!!
Turned out I was using in built Intel graphics, changing it to dedicated graphics card kinda solved it... taking around 5ms, let me know if this is normal (for something like GeForce 840M low end graphics card) it now goes like 60 fps on 800*600 and 1920*1080, 25 fps on 1920*2160.

Now displaying takes 5 times the time it draws... more reasonable, but I'd like more if possible (It's just a few triangles (1000), and only one draw call... maybe my graphics card is just REALLY BAD)

Main profiler - new loop: 1
Main profiler - poll events: 13
Main profiler - graphene movement test: 6
Main profiler - graphene spawn element: 242
Spawn layout generator: 2
       Generate layout: 303
                                        Triangles: 1016
                  Draw: 1601
               Display: 174618
5fps

This is the timings of each part of game loop using sf::Clock.
poll event took 13us
generating vertex array with my own function with 1016 triangles took 303us
drawing a single vertex array to the renderwindow took 1601us

However window->display() took up to 174ms, well over 20ms most of the cycles.

Here is a sample of time window->display() took for a few cycles:
(click to show/hide)

As you can see, there is a few cycles that displayed very fast.

I tried vsync, framerate limit...

Here is the code for window displaying:
void renderUI() {
                LayoutGenerator layoutGenerator(this);
                layoutGenerator.generateLayout(_rootElement, Vector2f(0, 0), Vector2f((float)_window->getSize().x, (float)_window->getSize().y));
                _window->draw(layoutGenerator.getVertexArray()->getBuffer(), layoutGenerator.getVertexArray()->getSize(), sf::Triangles);
                _window->display();
        }

Edit:
And the slowness is worse when maximized to 1920*1080, 90% of the cycles take over 100ms to do window display, while 5-10% is less than 2ms
Data above is on 800*600

And window.clear does not solve it, I don't think I need it anyways

Update:
The context settings was ContextSettings(0, 0, 4, 0, 4, 0, false); (anti-aliasing level 4)
And turn it down to 0(no aa)@800*600 made it go 30fps on average (30ms window.display time)
full screen 1920*1080 with no aa is still 100ms+
Although without aa 800*600 feels much smoother (mainly because of less stutter, not faster framerates), but still really bad. How can I fix it? I already turned off multi threading on my graphics driver.


Pages: [1]