PDA

View Full Version : DirectX: Managed textures not recovering


Raptisoft
01-03-2005, 05:35 PM
Hi all,

Okay, I'm using DirectX7 (have also seen the problem in DX8). Here's the issue: I'm declaring all my textures managed. Works most of the time-- that is, when I come back from an alt-tab, everything recovers fine.

Occasionally-- and this seems to happen especially when the program is out of focus for a long time-- the textures-- MANAGED textures-- will come back with junk on them. Not every texture, not all the time, but pretty much most of them.

Does anyone know a reason why a managed DX texture would not recover itself? Did I forget to call some obscure directX function (IDirectDraw::DoNotGarbleMostOfMyManagedTextures) or what? Has anyone ever seen such an atrocity?

Thanks in advance.

C_Coder
01-04-2005, 02:15 PM
I don't recall which but I have seen some commercial games with this problem. Correct me if I am wrong but I think it is a problem of DX. I prefer to mange the textures myself and reload them on Alt-tab. IMO it is better that you wait for the textures to load and all the textures are fine than to have them reload fast but at the end they contain garbage.

DX puts managed textures in system memory so that to reload them from memory when focus is regained. In my experience with Windows, a lot of applications mke page faults to page memory in the paging file. It could be that some of the pages where the managed textures are located get corrupted or invalidated and that's when the garbage is loaded. I can say this can only happen in long periods of inactivity. (out of focus)

Hope this helps! :)

Raptisoft
01-04-2005, 04:40 PM
Oh, BTW, I'm having some luck by calling EvictManagedTextures, which is supposed to toss everything out of texture memory for reload.

It's not perfect, but two alt-tabs WILL bring it back, just sometimes one won't.

C_Coder
01-04-2005, 11:14 PM
I would still not trust it. Do you want your game to look bad at customers? I personally don't think so. I would go for the reload approach. You could also load all your textures in memory yourself so that you can reload them faster from memory. :D

There's was another thread recently on Alt-tab by VengefulPastry. Maybe you should take a look at that for more suggestions.

Raptisoft
01-05-2005, 04:50 AM
I dunno, I don't think anyone buys or doesn't buy a game based on how well it recovers from alt-tab. :)

I am putting in some backup stuff though. I want to use managed textures just because DX will handle them so that they don't run out of video memory. But keeping my own copy + directX's copy = double memory.

svero
01-05-2005, 05:06 AM
I dunno, I don't think anyone buys or doesn't buy a game based on how well it recovers from alt-tab. :)

Maybe not directly because of this, but it certainly goes a ways to making people feel good about the overall quality of the product. That might affect sales.