views:

50

answers:

1

Hi, guys, I know it's easy to copy vertex/index buffer in D3D10 with IDirect3D10::CopyResource(...) interface.

How to do the same work in D3D9? Is there any similar API for this?

+1  A: 

Just lock the vertex/index buffers and memcpy the data from one to the other.

Goz
I want to avoid Lock method, since Lock will create memory buffer internally, and it could be out of memory.I wish I could reserved a buffer at beginning, and copy the target buffer to reserved buffer when mapping.
Buzz
There is no other way to do it under DX9. If you want to avoid running out of memory remember that you can lock a buffer a bit at a time so you can keep memory usage manageable.
Goz
I was under the impression that locking a dynamic buffer essentially mapped the existing memory for that buffer into your process, so locking a buffer doesn't actually use any additional memory as such.
John Burton
@JB: That "may" be how its implemented. There are no guarantees though ...
Goz
Ok thanks that makes sense
John Burton