Quantcast
Channel: AMD Developer Forums: Message List - OpenGL & Vulkan
Viewing all articles
Browse latest Browse all 631

Re: OpenGL: multi-thread object creation slow/unstable performance

$
0
0

I wouldn't recommend using "loader threads" with multiple contexts in this manner. You are correct - the driver needs to do quite a bit of extra work when it detects that there are contexts current in multiple threads in order to keep objects in sync. At best, this will add some synchronization overhead between contexts, and at worst it will drop performance on your main thread even when the secondary thread is not active.

 

If you really want to stream data from another thread, my recommendation would be to use a single context, create the objects in a main thread (textures, buffers, etc.), map buffers and pass the pointers to your worker threads. At this point, the worker threads can fill the buffers with data read from disk, network, procedurally generated, etc., in parallel. When they're done, signal the main thread. Upon receiving this signal, the main thread unmaps the buffer and the data will be ready to use. For textures, simply use the buffer bound to PIXEL_UNPACK_BUFFER to stage the texture data.

 

Do not use multiple contexts like this. It will work, but it won't give you the performance you're looking for.


Viewing all articles
Browse latest Browse all 631

Trending Articles