idea how to improve FPS (without threading)

Post your ideas and suggestions how to improve the game.

Moderator: ickputzdirwech

sthalik
Long Handed Inserter
Long Handed Inserter
Posts: 56
Joined: Tue May 01, 2018 9:32 am
Contact:

idea how to improve FPS (without threading)

Post by sthalik »

Hey,

There's a hack to improve FPS with a fully synchronous game loop. On all my Radeon and GTX cards, all time was spent¹ inside both SwapBuffers() and update(). But you can execute them sort-of in parallel.

I think what you're doing is this:

Code: Select all

while !should_quit
  call_message_pump()
  update()
  render()
  swapbuffers()
But what you can do is this:

Code: Select all

call_message_pump()
update()

while !should_quit
  render()
  glFlush()
  update()
  swapbuffers()
  call_message_pump()
Then a decent portion of all time normally spent in swapbuffers() should be spent in glFlush(). You don't need to actually rework a lot of code or mod APIs because the order of update() and render() doesn't actually change.

I don't know if you already know this trick but perhaps it can help with megabases.

¹ The representative workload is fully unzoomed 4K screen with an 8-blue-output red circuit blueprint.
Rseding91
Factorio Staff
Factorio Staff
Posts: 14896
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: idea how to improve FPS (without threading)

Post by Rseding91 »

Update and swap buffers currently run in parallel on multiple threads. All of the time spent in swap buffers is the GPU drivers converting what we told the GPU to do into what the GPU can use to execute and then the actual execution of that.
If you want to get ahold of me I'm almost always on Discord.
Post Reply

Return to “Ideas and Suggestions”