Skip to content
This repository has been archived by the owner on Jun 19, 2021. It is now read-only.

Move Vertex Buffer building to chunk loader thread #192

Open
jonas-schievink opened this issue Aug 8, 2016 · 2 comments
Open

Move Vertex Buffer building to chunk loader thread #192

jonas-schievink opened this issue Aug 8, 2016 · 2 comments

Comments

@jonas-schievink
Copy link
Contributor

#190 introduced an algorithm to generate a Vertex Buffer for each chunk as the corresponding ChunkView is created. Since the actual Vertex Buffer creation happens at the very end, the algorithm can be moved to the chunk loader thread to offload some work from the renderer thread.

Ideally, we'd like to reduce the operations executed when a ChunkView is created to an absolute minimum to prevent any stuttering when loading new chunks.

The algorithm isn't very complex yet, but that might change if we decide to compute more things about the chunk.

@LukasKalbertodt
Copy link
Member

I've already thought about this, but OpenGL combined with multithreading is not a great idea most of the time. We could create the Vecs in another thread and create the VertexBuffer in the main thread... mmmmh. To me the algorithm seemed pretty fast; never noticed any delay in --release mode.

@jonas-schievink
Copy link
Contributor Author

We could create the Vecs in another thread and create the VertexBuffer in the main thread...

That's what I was thinking of, too. I don't think glium's VertexBuffers implement Send.

This is less about actually optimizing and more about making me feel better, anyways (and it is, at least conceptually, a simple change). It might make a difference in performance if we want to compute more complex things about the chunk.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants