Sign in to follow this  
xujiezhige

CloneMesh()

Recommended Posts

xujiezhige    96
I load a mesh from Xfile using CDXUTXfileMesh::Create. Then i clone the mesh using CloneMesh( D3DXMESH_WRITEONLY ).

Which memory pool does the new mesh resides, POOL_MANAGED or POOL_DEFAULT?[img]http://public.gamedev.net//public/style_emoticons/default/sad.png[/img]

Share this post


Link to post
Share on other sites
programci_84    336
D3DXMESH_MANAGED means D3DPOOL_MANAGED for vertex and index buffer of the mesh. Like this one, D3DXMESH_WRITEONLY means D3DUSAGE_WRITEONLY for both vertex and index bufferof the mesh.

So, you can check DX docs for D3DUSAGE and D3DPOOL. Docs say about D3DUSAGE_WRITEONLY: [i]"Buffers created with D3DPOOL_DEFAULT that do not specify D3DUSAGE_WRITEONLY might suffer a severe performance penalty."[/i]

Share this post


Link to post
Share on other sites
xujiezhige    96
Thank you, TomKQT and programci_84.

I know how to specify memory pool. But don't know if not specify memory pool, just giving only D3DUSAGE_WRITEONLY, which memory pool it resides.

I had found the sentence---[i]"Buffers created with D3DPOOL_DEFAULT that do not specify D3DUSAGE_WRITEONLY might suffer a severe performance penalty.".[/i]
But I don't understand it well, does it mean if specify D3DUSAGE_WRITEONLY, the memory pool is D3DPOOL_DEFAULT?

maybe that's it meaning.[img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img]

Share this post


Link to post
Share on other sites
programci_84    336
[quote name='Jeason' timestamp='1330329531' post='4916917']
I know how to specify memory pool. But don't know if not specify memory pool, just giving only D3DUSAGE_WRITEONLY, which memory pool it resides.
[/quote]
You've 2 memory pool parameters for D3DX Mesh functions: D3DXMESH_MANAGED and D3DXMESH_SYSTEMMEM. If you don't specify one of'em, the function will choose D3DPOOL_DEFAULT for both vertex and index buffer of the mesh. So, if you specify only D3DXMESH_WRITEONLY, buffers will reside default memory pool.

[quote name='Jeason' timestamp='1330329531' post='4916917']
I had found the sentence---[i]"Buffers created with D3DPOOL_DEFAULT that do not specify D3DUSAGE_WRITEONLY might suffer a severe performance penalty.".[/i]
But I don't understand it well, does it mean if specify D3DUSAGE_WRITEONLY, the memory pool is D3DPOOL_DEFAULT?

maybe that's it meaning.[img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img]
[/quote]
As far as I understand, the sentence says: "Unless you specify D3DUSAGE_WRITEONLY, D3DPOOL_DEFAULT is a bad choice for memory pool. i.e. D3DPOOL_DEFAULT works well with only D3DUSAGE_WRITEONLY".

hth.
-R

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this