• Advertisement
Sign in to follow this  

Odd D3DXLoadMeshFromX behaviour

This topic is 873 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've recently begun using the debug runtime for D3D9 and have found a behaviour that just strikes me as odd with the function D3DXLoadMeshFromX.
This function seems to essentially fail if given any different flags to the "options" parameter than either D3DXMESH_SYSTEMMEM or a flat zero (which I assume results in the associated vertex and index buffers using the default memory pool). When failing, it returns D3DERR_INVALIDCALL. The debug layer however, even at the absolute maximum reporting setting, offers absolutely zero insight into why this may be (in fact it reports nothing at all at this failure). Neither does the documentation for the function list any particular D3DXMESH_XXX options as being invalid or dependent on being combined with anything else and of course, search engines reveal nothing much either.

 

But that alone is not the weird thing. It turns out that when given option flags of 0 or D3DXMESH_SYSTEMMEM the function succeeds and returns S_OK. But, now the debug layer wakes up and lists a couple of warnings (OK) but also errors. There's no execution interruption for these presumed "errors" either, even though the debug runtime is set to "break on D3D9 errors". The debug output is as follows:

Direct3D9: (WARN) :Indexbuffer created with POOL_DEFAULT but WRITEONLY not set. Performance penalty could be severe.
Direct3D9: (WARN) :Vertexbuffer created with POOL_DEFAULT but WRITEONLY not set. Performance penalty could be severe.
Direct3D9: (ERROR) :************************************************************
Direct3D9: (ERROR) :ASSERTION FAILED! File s:\gfx_aug09\windows\directx\dxg\inactive\d3d9\d3d\fw\ibuffer.cpp Line 1287: m_pbData != 0
Direct3D9: (ERROR) :************************************************************

The failed assertion occurs in a file I obviously don't have access to (presumably part of D3D9 itself); judging by the name it pertains to an index buffer. Whatever m_pbData is I have no idea, neither why it is supposed to be null (and if so, why it is not).
The warnings on the other hand are also quite weird (and if I use D3DXMESH_SYSTEMMEM it will only change to say "POOL_SYSTEMMEM but WRITEONLY not set"). In fact, if I add the D3DXMESH_WRITEONLY flag, the function goes back to failing with error code D3DERR_INVALIDCALL and no debug output again so this whole thing seems to be self-contradictory.

 

It should be mentioned that this is using Direct3D9Ex and is an attempt to convert an old codebase to that from Direct3D9, if this may cause these issues (perhaps the debug runtime wasn't designed for this and will output incorrect data at times?).

If anybody has any insight about this or further suggestions on what to try I would be grateful to hear it.

 

Also sorry if this post may be hard to follow; I just thought it better to write it now in the middle of the night in the hopes of maybe getting some replies by the morning when I will have to go up against this again considering the majority of the frequenters of this forum seems to have a quite different timezone than mine smile.png

Share this post


Link to post
Share on other sites
Advertisement

The D3DX helper library won't output debug stuff by just enabling the D3D debug layer. You also need to explicitly link against the debug lib (d3dx9d.lib). Hope that helps.

Share this post


Link to post
Share on other sites

Oh hah, I was sure that was linked since I got plenty of debugging output warnings about redundant state changes and such, but apparently it wasn't.

Doing that let me know that
 

 

D3DX: GenerateAdjacency: Cannot generate adjacency when the mesh's index buffer or vertex buffer is write only.

which makes sense.

Thanks for pointing that out, should hopefully give me some more info to go by now :)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement