2

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?

Buzz
  • 1,549
  • 3
  • 16
  • 31

1 Answers1

1

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

Goz
  • 61,365
  • 24
  • 124
  • 204
  • 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 Apr 12 '10 at 09:24
  • 1
    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 Apr 12 '10 at 09:45
  • 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. – jcoder Apr 12 '10 at 13:33