Writing game engine in C++, considering switching to D
ponce via Digitalmars-d
digitalmars-d at puremagic.com
Fri Feb 20 09:49:21 PST 2015
On Friday, 20 February 2015 at 15:26:02 UTC, John Colvin wrote:
>
> However, if you make the context current in the GC thread
> that's cleaning up, then you should be fine. There's nothing
> wrong with having the same context current in multiple threads
> as long as you don't access it concurrently.
I'm sorry but there is two problems with your solution:
- first an OpenGL context cannot be bound to more than one thread
simultaneously
https://msdn.microsoft.com/en-us/library/windows/desktop/dd374387%28v=vs.85%29.aspx
"A rendering context can be current to only one thread at a time."
Looks odd since compute APIs do not have this limitation.
- At the point where destructors are called by the GC, all other
threads have been resumed. http://dlang.org/garbage.html
So concurrent OpenGL calls may happen for the same context which
is forbidden.
Really such ressources should not be freed by the GC, and I with
it would not call destructors at all.
More information about the Digitalmars-d
mailing list