Archived

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

what are the limits for DrawPrimitive/DrawIndexedPrimitive Methods?

This topic is 5571 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

Hi! Because the index buffer in use with the DrawIndexedPrimitive-Method is an unsigned short value, it is possible to render up to 65k primitives at once. But are there any other limitations, such as device-dependent ones (can this information be extracted from any DX8-Enumeration-Structure)? What is the maximum number of primitives to render with the DrawPrimitive-method or is this basically the same issue as with DrawIndexedPrimitive? By the way, is it basically bad code not to check how many primitives are to render? Would a "batch-rendering" be the better decision and how would this be implemented? thanks for your help!

Share this post


Link to post
Share on other sites
check out the DirectX caps viewer

D3DCAPS has:

MaxPrimitiveCount = maximum number of primitives that can be drawn with on drawPrimitive call


MaxVertexIndex = maximum vertex index(duh) which means you can reference 65k of vertices.

I don''t know if this is different for different hardware devices, I suspect that they all use 65k. Check out the d3d documentation, it might have more info, as for the rest, I''m not really sure




Share this post


Link to post
Share on other sites

Also bare in mind that if you have a single buffer (IB or VB), that if you try to lock it having just submitted them to DIP you will in all likelihood cause a stall. This is because your CPU will have to wait for the DIP to complete on the GPU before its granted the lock. With multiple buffers or less full ones, its obviously less of an issue.

Share this post


Link to post
Share on other sites
My Radeon 8500 supports "MaxVertexIndex" 16777215, but all other cards I''ve seen so far have 65535. Usually, the best idea is to set the base index instead of using indices beyond 65535 - that way you can access up to 4 billion vertices even with 16-bit index buffers, which obviously only take up half as much space and AGP bandwidth. Now go create some artwork with 4 billion vertices.

- JQ
Full Speed Games. Coming soon.

Share this post


Link to post
Share on other sites
DX7 cards support 0xffff (65535) as the maximum number of vertices used in DrawPrimitive, or highest index in DrawIndexedPrimitive.
DX8 cards typically should support much higher. You can use 32bit indices if you look in the sDK docs, but obviously there is no point if your card only supports 0xffff! This is probably a good limit to use as so few users have proper DX8 hardware (even the GF2 has this limit).



Read about my game, project #1
NEW (9th September)diaries for week #5

Also I''m selling a few programming books very useful to games coders. Titles on my site.


John 3:16

Share this post


Link to post
Share on other sites
Papers at http://developer.nvidia.com suggests that "optimal" buffer size is 2K vertices for non indexed and 10K indices for indexed vertices.
Note that you can render a vertex buffer (when full) multiple times per frame.

eg.

CVertexCache::AddTri(... )
{
// ->BeginScene() must be called before this func

if m_dwNumVertices > vertexbuffersize
{
Render
Flush data just rendered
}

Add vertices to buffer

m_dwNumVertices++
}

call ->EndScene() and Present()
After finished adding triangles

Share this post


Link to post
Share on other sites