Jump to content
  • Advertisement
Sign in to follow this  
HippieHunter

Selective VertexBuffer changes

This topic is 4723 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 will probly have to do my own test, but just asking....does anyone know if uploading a full 1 meg Vertexbuffer has the same effect as changing 50% of the vertices selectively? is Selective vertex Modification even a worth while prospect? ie lock the buffer and change values at different locations in the returned pointer.

Share this post


Link to post
Share on other sites
Advertisement
Difficult to say, but usually the upload-all-in-one-go is a bit faster if you specify _DISCARD in the lock params (iirc).

Provided I'm remembering my constants correctly, the discard allows the hardware to allocate new memory for your new upload and then free the existing memory when any drawing/work is complete.

It is useful to note that a lot of even trivial loops through vertex data (e.g. doing a selective operation between lock/unlock) can involve reading the contents. An i++ or v*=0.5f for example. Reading back can really hurt your performance.

Try running with the debug runtimes as well, they tend to be quite helpful with spitting out performance warnings with regards to locking/writing VB's [smile]

Maybe even PIX will be of use to you...

hth
Jack

Share this post


Link to post
Share on other sites
If you need to change the vertices by some numerically-definable logic, you should consider using vertex shaders to do the transformation. You can assign weights to the vertices to control which individual vertices are affected by your shader's custom logic.

Vertex shader constant uploading is far more lightweight operation than geometry uploading in almost any case, because of the amount of data involved and other, non-obvious reasons (such as post-TL cache utilization).

Of course, if you need to add or remove vertices from the mesh dynamically, you still have to lock the buffer.

Share this post


Link to post
Share on other sites
Quote:
Original post by HippieHunter
This is in reference to Terrain Paging, so the Vertex shader while usefull for animation doesnt apply as far as i can tell.

Right, well I'd go with copying data across in one big lump... That worked quite nicely for my terrain paging system, and it also makes the code fairly simple.

hth
Jack

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!