Re: Lost Device - Release Timing

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



I don't think there is time better than another.
But I think that detecting loss and releasing at that time might not be the
best thing. Because when your device is lost, usually it's your app being
minimized, or taken away by another fullscreen D3D app. In both cases, I
would stop my app from doing any further processing. It shouldn't be a
lengthy operation to release or D3D resources, but it depends on how you
manage them. YMMV

Personally, I release them just prior to restoring the device, that is, when
my app comes back to live...

Wessam Bahnassi
Microsoft DirectX MVP,
Lead Programmer
In|Framez

"cadull" <clinton.no@xxxxxxxxxxxxxxxxxxxxx> wrote in message
news:OxqDfbRTFHA.3308@xxxxxxxxxxxxxxxxxxxxxxx
> Hi,
>
> When the device is lost, some resources need releasing before calling
> IDirect3DDevice9::Reset. Are there any restrictions within this time as to
> when they can be released or any advantages to choosing a particular time?
>
> The documentation on lost devices implies that the resources should be
> released after IDirect3DDevice9::TestCooperativeLevel returns
> D3DERR_DEVICENOTRESET:
>
> "If the device can be restored, the application prepares the device by
> destroying all video-memory resources and any swap chains."
>
> The EmptyProject sample says that it frees the resources as soon as the
> device is lost, with the comment near OnLostDevice:
>
> "This callback function will be called immediately after the Direct3D
> device
> has entered a lost state and before IDirect3DDevice9::Reset is called."
>
> However in tracing the code it does seem to wait for D3DERR_DEVICENOTRESET
> first. After looking over a few thousand lines of code I could be mistaken
> though.
>
> Despite this documentation and sample implementation, it would appear that
> the resources can be released earlier. Quoting the documentation again:
>
> "All methods that derive from IUnknown are guaranteed to work after a
> device
> is lost."
>
> The timing would have negligible impact when executed (assuming few
> dynamic
> resources), so I'm mainly interested in what is possible or advisable -
> following which the impact on my engine design will be the main
> consideration.
>
> Regards,
> cadull
>
>


.



Relevant Pages

  • Lost Device - Release Timing
    ... some resources need releasing before calling ... The documentation on lost devices implies that the resources should be ...
    (microsoft.public.win32.programmer.directx.graphics)
  • Re: Memory leak
    ... >immediately when I close the app. ... >resources, GC would at some point do this for me. ... I AM releasing all resources. ... >ii) how to track down where the memory leak is occuring. ...
    (microsoft.public.dotnet.languages.csharp)
  • RE: Memory leak
    ... It is possible for memory leaks to occur if you are using any unmanaged resources in your application. ... > immediately when I close the app. ... I AM releasing all resources. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Garbage Colletor
    ... It's extremely easy to handle resources in C++ as you stated but the ... Logically speaking, the memory is still in fact available, the moment you release your last reference to it. ... The "using" statement and IDisposable exist for one purpose: to explicitly release resources held by an object without releasing the object itself. ... In fact, the garbage collection model is, at least for that particular operation, much more efficient, because there's no need to go through the entire object cleaning things up. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Mrs Stupid.
    ... William Black ... We probably won't get the intelligence records for another seventy five ... until it is decided that releasing them will cause no embarrassment or ... I think that's probably because they lost them... ...
    (sci.military.naval)