DrawIndexedPrimitive's Performance

Started by
12 comments, last by yanuart 22 years, 1 month ago
So at what level should I draw the line, for ex. I have an option such as this :
I can call DrawIndexedPrimitive just once but the number triangles is "Count1"
or
I can optimized my code and call DrawIndexedPrimitive "numCalls" times and the number of the total triangles is less ("Count2" triangles)
Now.. how can I determined those parameter ??
ps : Count1 > Count2 & numCalls > 1
Ride the thrill of your life
Play Motorama
Advertisement
What i''m doing is:

- Setup all VertexBuffers before rendering starts
- Create a streaming Indexbuffer (created with D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY)
before rendering starts)
- During rendering collect the indices of all triangles of all visible leaves.
- Update the streaming Indexbuffer (Locked with D3DLOCK_DISCARD | D3DLOCK_WRITEONLY) with vertex indices referenced by the triangles collected in the previous step
- Render as much triangles as fit into the Indexbuffer in one call (up to 3000 in my case)

Hope this helps.

quote:Original post by yanuart
I''ve made an octree by splitting a mesh object scene into an octree
data structure. The data structure consists of the face within the node.
The creation of the octree is fine as I''ve managed to divide n conquer
all the triangle into an octree correctly.
Everything is working fine except the performance issues, it''s so damn slowwwwwww..... I''m using DrawIndexedPrimitive to render my octree node.
I''ve tested that even if I''m just rendering 8 nodes (inside the viewing frustum)
and the number of triangles in a node is just 500 (it makes 8 * 500 = 4000 faces)
I only get 10 fps.. what''s wrong ??
Hmm.. my guess is that I''ve used too many DrawIndexedPrimitive function
(about 40 times for each node, but this is bcoz I''m using a single Indexbuffer from the mesh).
What''s wrong with my method ??

is it true ??

ps : hardware is not the issue here



eRazor :
Hmm.. does that means I''ve to create & release a new IndexBuffer for the faces which are visible each time I want to render ?? since the size of the IndexBuffer will be varies each time I want to render my scene.
Do you think that those steps are time expensive ?
I''ve read about that once but I haven''t prove it myself,
or do you think it''s wise that I just made one IndexBuffer with a static size ?
Ride the thrill of your life
Play Motorama
Nah, just create an index buffer of reasonable size (let's 1000 verts) upfront. Then during rendering fill the buffer up to the specified size and call DrawPrimitive. Loop.

Don't forget to lock the VB with D3DLOCK_DISCARD at the start of each loop iteration as this will allow the driver to return a fresh memory pointer while it streams the contents of the previous lock operation at AGP speed to the card.


quote:Original post by yanuart
eRazor :
Hmm.. does that means I've to create & release a new IndexBuffer for the faces which are visible each time I want to render ?? since the size of the IndexBuffer will be varies each time I want to render my scene.
Do you think that those steps are time expensive ?
I've read about that once but I haven't prove it myself,
or do you think it's wise that I just made one IndexBuffer with a static size ?




Edited by - eRAZOR on February 20, 2002 3:08:42 PM

This topic is closed to new replies.

Advertisement