D3DXLoadSurfaceFromSurface Crash On ancient PCs
Hi guys, now I wanna paint a small texture which is gray scaled to a texture atlas, I also have a color property for the small texture so I need to multiply the colors from the small texture with my color property to get the final result. Here is a brief desc for how I make this:
SmallTex.dds
||
|| 1, create D3D Texture with Static Usage and Managed Pool
\/
IDirect3DTexture9* pBaseTex
||
|| 2, copy to a temp texture( dynamic, Default pool ) for color multiplying
|| I use D3DXLoadSurfaceFromSurface here
\/
IDirect3DTexture9* pTempTex ( gray scaled )
||
|| 3, lock the temp texture and do color multiply per pixel
\/
IDirect3DTexture9* pTempTex ( colored )
||
|| 4, copy the colored texture to the correct position of the texture atlas
|| I use D3DXLoadSurfaceFromSurface again here
\/
IDirect3DTexture9* pTexAtlas
I copied the base texture to a temp texture because the base texture could have been used by other rendering stuffes and I think this could avoid Stalls.
Whatever, though the program runs fine on moden PCs, I did encounter crashes on the very old graphic card TNT2. It was when doing the 2nd step, copying the base texture to the temp texture. It didn't always crash, maybe the 1st time and 2nd time it was all right but the 3rd time it crashed. The debug program just poped up a box saying something like Access Violation. But there seemed to be nothing I could do since it was inside the D3DXLoadSurfaceFromSurface function.
Later I tried to change the temp texture to be in System Memory, and it never crashed anymore. The information I could find for the functions like D3DXLoadSurfaceFrom* was so few that I don't know whether I made the wrong use of it. I wanna know why the program crashed before I used SystemMem.
Another problem is that after I made that change to the texture location, the 2nd step now runs fine but the 4th step( copy the temp colored texture to the Atlas ) failed sometimes( I only encountered twice, both on WinVista ). The Atlas is Dynamic and in SystemMem too. I update it to a video memory texture later for rendering. But this time it's not a crash, but the D3DXLoadSurfaceFromSurface function returned a fail result.
So what's the most proper and correct use of the D3DXLoadSurfaceFromSurface function? Or where can I find more detailed descriptions for interfaces like this?
Thanks,
Ming
Well, you could try using smaller surfaces for one, unless you're using system memory. It looks like that video card doesn't have enough memory for all that.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement