Archived

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

Funkymunky

DIP D3DLOCK_DISCARD

Recommended Posts

Funkymunky    1413
Can someone please post the correct code procedure to append indices to an index buffer, such that i dont need to call D3DLOCK_DISCARD each frame on my dynamic index buffer? Im confused about where I specify the starting index, etc.

Share this post


Link to post
Share on other sites
S1CA    1418
I''m not sure that any IHVs are doing buffer renaming on IBs yet so at the moment its likely to be a non-issue.

I''d suspect that when/if they do start doing renaming (dynamic IBs isn''t such a common case), the same rules as with dynamic vertex buffers will apply (possibly moreso due to the much smaller size of IBs). The correct VB scheme is in the DX FAQ:

http://msdn.microsoft.com/library/default.asp?URL=/library/techart/DirectX8faq.htm

Simply don''t lock with DISCARD until you''ve reached the end of the buffer and do lock with NOOVERWRITE at other times remembering not to access any previously written parts of the buffer.

Due to the small nature of IBs, batching may not be necessary anyway to get the most out of hardware IBs (though most cards don''t support hardware IBs) - depending on the size calling with discard every time might be the right thing to do!

--
Simon O''''Connor
Creative Asylum Ltd
www.creative-asylum.com

Share this post


Link to post
Share on other sites