Writing game engine in C++, considering switching to D

ketmar via Digitalmars-d digitalmars-d at puremagic.com
Fri Feb 20 10:07:18 PST 2015


On Fri, 20 Feb 2015 17:49:21 +0000, ponce wrote:

> 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.

the funny thing is that destructor can be called while another thread is 
*inside* OpenGL call. is starts to be funniest with each post.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20150220/bfdeec6f/attachment.sig>


More information about the Digitalmars-d mailing list