[DX9] Texture becoming garbled after window resize

Started by
2 comments, last by RealMarkP 13 years, 10 months ago
I have a few textures in memory that become garbled or display as a lime green color when I resize my window. I'm having a hard time tracking this bug down and PIX, when inspecting the textures, claims everything is working alright. I have a main texture in memory using D3DPOOL_DEFAULT. It displays fine when first running my engine. I have a backup copy of the texture in D3DPOOL_SYSTEMMEM. Whenever the window size changes, I release all my textures (except for the ones in D3DPOOL_SYSTEMMEM), reset my device, and call UpdateTexture() to copy my backup copy of the texture back into D3DPOOL_DEFAULT. Resizing my window works alright if it's being resized only a few pixels. Moving the window around doesn't have an effect. Maximizing the window is hit and miss. Minimizing the window always leaves the window garbled. PIX tells me the textures are in tact. Any ideas?
------------Anything prior to 9am should be illegal.
Advertisement
Have you tried running with the reference device? A driver issue could cause a problem, in which case a driver update might help. You haven't mentioned the hardware you're using.

Any particular reason you're not using the managed pool? The only reason I can think of to use the default pool with system copies is when using render targets, in which case it's possible your backups are wrong (which you can verify by saving them).

I can speculate a little more, but not before I get an answer regarding the managed pool.
I tried running it using software rendering and my textures became completely black. Looks like they still might be getting garbled. I'll try dumping the textures to file to see what it gives me. I also ran my code on a different computer with a different video card. The reason why I'm using the default pool is because I'm planning on using render targets later on when I build the game. Currently I just have a generic texture class that uses the default pool and has a backup 'shadow' copy in the systemmem pool.

Screenshots:
Before
After Resize

EDIT: When I resize the window to be smaller (After Resize Screenshot), the texture gets garbled but as soon as I resize back to it's original size the texture appears normal again. This is what confuses me.

[Edited by - RealMarkP on May 17, 2010 12:38:00 PM]
------------Anything prior to 9am should be illegal.
I'm going to bump this thread in my last attempt to get an answer. My only alternative is to refactor my code to use the managed pool. Using PIX, it looks almost like that the D3DPOOL_SYSTEMMEM texture, that I use for updating the default texture, is somehow getting garbled between releasing or the UpdateTexture() funciton call is not working properly (and not giving me an error).

Questions:
- When I reset my device after a resize, is it possible that the systemmem texture is not persisted? Was it sheer luck that my code worked before (ie. the texture data was in tact in VRAM and just by luck I got a handle to that particular portion of ram).
- Could UpdateTexture() fail in any way without giving an error?


If you guys need more information from me to help me fix this bug, please post it. I can also email you an exe so you can take a look at it using PIX or other tools.
------------Anything prior to 9am should be illegal.

This topic is closed to new replies.

Advertisement