   DX9 Surface and Texture structures corrupt!
  Has anyone ever seen this?Whenever I call D3DXCreateTextureFromFile() or CreateOffscreenPlainSurface() under DirectX 9 (August 2007 SDK), the surface or texture structure returned seems to have the Width and Height members stored under Priority and LOD respectively.For example, the following call:   LPDIRECT3DDEVICE9  pD3DDevice;   LPDIRECT3DTEXTURE9 pTexture;   D3DXCreateTextureFromFile( pD3DDevice, "Dialog16_32.bmp", &pTexture );in which the file is a 640 x 480, 32-bit bitmap, always indicates success. But the pTexture structure ALWAYS contains Width=22 and Height=3, no matter what is passed in. When looking further down in the debugger, I see members Priority=640 and LOD=480. It appears those are supposed to be my width and height.I'm thinking I may not have the SDK loaded properly and I'm not really calling the functions I think I am, or maybe August 2007 is a pig? Or maybe I just have no business programming!Any ideas?   
  Are you using the debug runtimes? Or older/newer runtimes somehow? The debug watch windows rely on the internal structures being in a well defined format, which may well not be the case for retail or incorrectly versioned library versions.   ;  You definitely have #define D3D_DEBUG_INFO in your code? Otherwise the debuggers' information is invalid - the extra fields for IDirect3DSurface9 are only filled in when that define is used...And no, I've not seen this behaviour myself nor have I ever read about anyone else seeing it [smile]hthJack   ;  Thanks guys!Yes, I have D3D_DEBUG_INFO defined, but I am not sure about the library versions. I did in fact have the DirectX 9.0c runtimes installed before I installed the SDK. I will try removing these.In any case, I definitely think there is an installation problem here somwhere. The only other thing I can think of is possibly a video format incompatibility since the DX3D device is using PF_X8R8G8B8 while I am trying to load PF_A8R8G8B8 data from the file, but my brother (he wrote much of the code too) swears that nothing works if the device format is PF_A8R8G8B8. We'll have to test that. But I can't really see how this would cause the mis-match in the debugger. I'll keep hacking and post when I find the problem.Thanks for the help!;Quote:Original post by jollyjeffersYou definitely have #define D3D_DEBUG_INFO in your code? Otherwise the debuggers' information is invalid - the extra fields for IDirect3DSurface9 are only filled in when that define is used...And no, I've not seen this behaviour myself nor have I ever read about anyone else seeing it [smile]hthJackWhen enabling the d3d debug info, I've never seen it work.  I get result like mtemple is seeing.  Keep in mind that you should never really try to use these values, they're just supposed to be useful when debugging.  GetDesc, GetLevelDesc should be used to find the size, format, etc.   ;  Ahhhh! I see!The information reported when D3D_DEBUG_INFO is defined is basically garbage! I was fooled even further when I tested what I thought were structure members Width and Height. When I saw the same garbage values, as reported by the debugger, I thought the actual structure was getting screwed up. But these supposed structure members don't even exist when D3D_DEBUG_INFO is not defined.But a call to GetLevelDesc() showed me that the proper width, heigh, format, etc. values were actually right where they were supposed to be. So I have been chasing a ghost for more than a day!Since the debug values reported when D3D_DEBUG_INFO is defined are totally unreliable, it makes me wonder what the point of having it defined is.Anyway, thanks soooo much for the warning on this! My actual textures appear to be just fine!;Quote:Original post by mtempleSince the debug values reported when D3D_DEBUG_INFO is defined are totally unreliable, it makes me wonder what the point of having it defined is.It is a bit of a dangerous debugging 'tool' (*cough*hack*cough*) [smile] I forget now, but there was something else that define screwed up that exploded my code a while back - I don't bother using it anymore.Jack;  Thank you for the confirmation, Jack!