I have a program that deals with a texture sized 1920x1080 and updates the texture via SDL_UpdateTexture
in a multithreaded environment. The Texture is "tiled" between the threads, so thread 1 will update a different area than thread 2. For example t1
will update the area 0,0,64,64
and t2
will update 65, 65, 128, 128
.
Can SDL_UpdateTexture
be used in this case without any locking, so that the threads can update the texture conucurrently?
Have a look at
Multithreaded Rendering on OpenGL
But, briefly: GL isn't thread-safe (or even thread-aware). On Windows, you can't have the context active on more than one thread at a time, so you wouldn't be able to update your texture without synchronizing the threads (which defeats the purpose of multithreading). I'd wager that it's the same on Linux.