Is the renderer single-threaded?

manu3d

Active Member
Contributor
Architecture
That is, can I safely assume that methods in classes such as WorldRenderLwjgl and DefaultRenderingProcess will never be called concurrently? For the way they are written they don't seem to be thread-safe, but I'd like a confirmation.
 

Florian

Active Member
Contributor
Architecture
I don't think that there is currently someone who is active and knows the render code in and out. So you have to check for yourself if that is the case.

One useful tool for checking that is to let the ide show the call hirachy. In idea you can do it via menu -> Navigate -> Call Hirachy

The rending and most updates are done at the main thread, so I assume too that the access is only by the main thread (e.g. call hirachy of all methods has mainloop in it at some point).

That the rending isn't done on a separate thread is one of the biggest possible optimizations that have not been done yet (and I assume it is not easy). However a lot of preperation for the rending is done in seperate threads.
 

Marcin Sciesinski

Code ALL the Ages!
Contributor
World
Architecture
Yes, most of the game is single-threaded. The only instances of multi-threading in Engine/Core are: chunk generation, chunk tesselation and network stuff.

I know the Pathfinding is also using threads, but that's a mod.
 

manu3d

Active Member
Contributor
Architecture
Thank you Florian for the tip about Call Hierarchy: I didn't know about it and looks quite useful.
I am studying the rendering code but I won't be able to focus on turning it into a multithreaded version, sorry. I do hope to turn into something a little easier to read though, so that changes to it might become less daunting.

Marcin, thank you for your confirmation and for highlighting multithreaded processes. I might have a look at the chunk generation/tasselation to see how it is done and how multithreading works in that context.

Again, thank you to you both. Any chance you could chip in on this thread? Nobody has replied to it yet.
 
Top