Skip to content
matricks edited this page Dec 31, 2011 · 7 revisions

This branch I'm doing work on removing the OpenGL render calls from the main thread into a new separate thread.

Reason

The reason to do this is to make so that the network, input and game can update without waiting for the vsync:ed flip. This will reduce the latency in the network and input.

Design

All graphics commands are put into a (CCommandBuffer) that is later pushed to a separate thread (CCommandProcessorHandler) that executes that buffer. The buffer is pushed during the IGraphics::Swap call.

The source

The whole implementation lives in https://github.com/matricks/teeworlds/blob/threadedflip/src/engine/client/graphics_threaded.h and https://github.com/matricks/teeworlds/blob/threadedflip/src/engine/client/graphics_threaded.cpp. No changes is done to the graphics interface as of yet but a smaller change will be needed to finalize it.

Left todo

  • Screenshot functionallity
  • Shutdown code
  • Video modes

Future work

  • The CCommandBuffer should perhaps be a ring buffer.
Clone this wiki locally