resource construction WAS: [GD-General] longjmp for C++
Brought to you by:
vexxed72
From: Corrinne Y. <cor...@sp...> - 2002-01-11 15:04:54
|
-----Original Message----- From: Javier Arevalo [mailto:ja...@py...] Sent: Friday, January 11, 2002 2:22 AM To: cor...@sp...; Gam...@li... Subject: Re: [GD-General] longjmp for C++ performs a resource allocation upon construction or initialization, is also responsible for releasing said resource upon destruction / shutdown. discipline and identify ownership of resources, whether they be individual memory blocks, entire heaps or D3D textures. -- I would highly suggest against having resources as small and low level as individual D3D texture (which already has its construction and deletion) to be responsible for its construction and initialization. -- Things as large as level should be able to construct and destroy itself. But things as small as textures, you would in effect be making them a 1-layer wrapper. This is highly inefficient. -- The interesting thing about "levels" is that there are in fact 2 methods that are distinct: "construction" and "restoration." -- Not only should level be able to construct / destroy as you had suggested. But it should be capable of releasing (device dependent resources) as much as possible, but not so "destroyed" that it cannot "restore" (but not a full construct) with the start of a new device state. -- As with many things in programming, there is moderation to all. And too fine a granularity in class automated construction and deletion ("point", "polygon") adds unnecessary overhead to 3D engines. -- Restarting levels is very simple, very easy. It really isn't as complicated as most of the suggestions here so far. -- This is indeed straying very far from whether there is a class-safe equivalent of longjmp for C++ classes. :) -- I really think there is very little (possibly none) to add to the pretty simple subject of restarting a level; so I would leave the rest of this "new" topic up to the rest of you who still would like to discuss it. -- Let me know when this winds back to longjmp. :) |