[SDL] Multi-threaded OpenGL+SDL
Stephane Marchesin
stephane.marchesin at wanadoo.fr
Sun Jan 7 03:40:45 PST 2007
Andrew Zabolotny wrote:
> From Sat, 06 Jan 2007 20:29:49 +0100
> Stephane Marchesin <stephane.marchesin at wanadoo.fr> wrote:
>
>
>>> and index buffers, I thought it would be logical to convert the
>>> heightmap info those buffers right after loading them in the second
>>> thread. However, my first experience finished with the application
>>> crashing as soon as I call any GL function in the second thread.
>>>
>> Yes, not all OpenGL implementations are thread-safe. Actually, I know
>> of no implementation, be it on windows or linux, that is fully thread
>> safe (by thread safe, I mean doing OpenGL from multiple threads works
>> and doesn't cause weird bugs). Nvidia for linux comes close to it,
>> though.
>>
> Well, after reading nvidia's notes on the driver I'm under the
> impression that it supports threading pretty well: most notes
> regarding threading is how to fight with various bugs in *programs*
> that don't use threads properly. And I'm sure this situation will only
> improve with time, so it would be good to add at least minimal support
> for it in SDL.
>
Well, from my experience, two threads doing any kind of DMA transfers
to/from the same card (that's when using two separate contexts) will
result in crashes or weird bugs (screen corruption, card hangup...). So
I really would advise doing that for anything serious. Not to mention
that other OpenGL implementations dont support that kind of things.
Stephane
More information about the SDL
mailing list