RobVoisey
RobVoisey

Reputation: 1083

Multi-threaded Rendering in OpenGL

Is this even possible? Im learning DirectX atm and am trying to apply some of what i've learnt to OpenGL.

I know you can have multi-threaded rendering in DirectX using deferred contexts, but i didnt think OpenGL had this support, i've found examples of multithreading in OpenGL but not multithreaded rendering which is what im trying to find out; or maybe i've mis-understood the difference?

If it is possible, could anyone provide some basic code for me as an example.

Upvotes: 1

Views: 3026

Answers (2)

datenwolf
datenwolf

Reputation: 162164

This is not really an answer to the OPs question, but it is of importance to his request:

The GPU is somewhat like a mutually exclusive resource. If you have multiple threads performing drawing operations you're generating management overhead. The work has to split up to shader units or some timeslicing is involved. Either way, if the drawing operations go to the same framebuffer the operations must be synchronized, which means the GPU pipelines get stalled quite oftenly.

The net result is, that performing multithreaded operation on a GPU will most likely result in largely reduced performance.

Also there's no need to do multithreaded operation on a GPU to parallelize the work. This already happens by single drawing operations being split up to the GPUs individual shader units.

Upvotes: 2

Nicol Bolas
Nicol Bolas

Reputation: 473192

OpenGL doesn't have an equivalent to D3D11's Deferred Contexts. The closest thing to that would be display lists, but these solve an entirely different problem and are very much not meant to be rebuilt over and over again.

Upvotes: 1

Related Questions