Archived

This topic is now archived and is closed to further replies.

Parameters for VertexBuffer!!

This topic is 5310 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

how to use these parameters,and how to match them for better performance??? D3DUSAGE_DONOTCLIP ,D3DUSAGE_DYNAMIC ,D3DUSAGE_WRITEONLY vs D3DPOOL_DEFAULT, D3DPOOL_MANAGED in CreateVertexBuffer()/CreateIndexBuffer. When i must use D3DUSAGE_DYNAMIC,i nerver use this parameter, but my application isn''t any wrong?

Share this post


Link to post
Share on other sites
quote:
Original post by 88er
how to use these parameters,and how to match them for
better performance???

D3DUSAGE_DONOTCLIP ,D3DUSAGE_DYNAMIC ,D3DUSAGE_WRITEONLY
vs
D3DPOOL_DEFAULT, D3DPOOL_MANAGED
in CreateVertexBuffer()/CreateIndexBuffer.

When i must use D3DUSAGE_DYNAMIC,i nerver use this parameter,
but my application isn''t any wrong?




Dynamic is if the VB will be dynamic in size.. in other words, if the size will change. Writeonly means you can only write information to the VB and not read it. Managed let''s DX decide the best place in memory to put the data from the VB.

Hope that helped a little! The SDK docs are your friend!

Share this post


Link to post
Share on other sites
Dyanmic has nothing to do with it's size. It's dynamic if the vertex (or index) data will change often. If you're transforming particles, or doing morphing in software, the vertex data will change, potentially every frame. Dynamic is your way of saying, I'm going to send you new data all the time, don't cache this in video RAM.

When using dynamic, your lock calls will use DISCARD, and NOOVERWRITE flags. NOOVERWRITE means you're appending data to the end of the buffer, data that you've never written to since your last DISCARD. DISCARD means you need fresh space to store vertices (ie: you've run out of room for the use NOOVERWRITE).

DONOTCLIP I've never used, but I imagine it controls with or not to adjust vertices such that the triangles points are all on screen. Color, UV, Normals, etc will have to be interpolated to clip correctly. You probably don't want to clip unless you're targetting old cheap crappy hardware. On todays hardware doing clipping in software may kill performance, the card can clip instantly for you regardless of what you pass it.

WRITEONLY indicates you will never read for the vertex buffer. ALWAYS use this flag. This lets the card put the vertex data in faster GPU memory.

MANAGED means that DX will attempt to save values, destroy and recreated the buffer for you when you get a lost device. This can affect where the card can put the buffer. DEFAULT may give better performance (as D3D never has to read back values to recreate the object, it may go in faster GPU RAM).

If you search, you might find a few months old response I wrote explaining how to use dyanamic buffer correctly, how the flags are used, and a step by step detailed sample.

(did the search - it's here: )
http://www.gamedev.net/community/forums/topic.asp?topic_id=148414

[edited by - Namethatnobodyelsetook on May 29, 2003 4:00:57 PM]

Share this post


Link to post
Share on other sites