   slow fps when rendering 4000+ vertices
  I have a problem with my DirectX code.I'm trying to create a particle system. I create a vertex buffer at the beginning of my program, then I update all my particle's position's and then I render. The update and rendering part are in a loop.To render I lock my vb, memcpy all the points into the buffer and unlock it.I then call DrawPrimitive(D3DPT_POINTLIST, 0, iNumVertices );I've noticed that when I send <4000 vertices to render my frame rate is ~ 32. However when I have more then 4000, the fps drop to about 8 and when i'm at 7000 vertices it goes down to 3fps.What am I doing wrong? I would think that I could render a full screen 800x600 = 480,000 particles at 60fps with ease. Many computer games run at higher resolutions.   
  How are you creating the vertex buffer, and how are you locking it? (I'm looking for the specific code and a couple surrounding lines). Mismanaging dynamic buffers like that can seriously impact your framerate because you could be gagging the CPU -GPU bus with a lot of data transfer.   ;  At the beginning I do the following to create my vb:if (FAILED(m_pD3Device->CreateVertexBuffer( iNumParticles * sizeof(VERTEX_PARTICLE), D3DUSAGE_WRITEONLY |D3DUSAGE_DYNAMIC | D3DUSAGE_POINTS, D3DFVF_VERTEX_PARTICLE, D3DPOOL_DEFAULT, &m_pVertexBuffer, NULL) ) ) { then in a loop I update all my particles.  After the positions are updated I then update the VB and then I call DrawPrimitive().if (FAILED(m_pVertexBuffer->Lock(0, iNumParticles * sizeof(VERTEX_PARTICLE), (void **)&m_pParticleVertex, D3DLOCK_DISCARD))) { SAFE_RELEASE(m_pVertexBuffer); return;} //update all verticesmemcpy(m_pParticleVertex, pNewVertices, iNumParticles * sizeof(VERTEX_PARTICLE) ); m_pVertexBuffer->Unlock();   ;  How big are your particles on the screen? If they are all filling the screen you shouldn't be surprised that your card doesn't have enough fillrate. If they are small, something is very wrong.   ;  my particles are only 1 pixel big right now.I suspect there is something wrong but I don't know what it is.   ;  Hello,Try making your VB big enough to hold several instances of the particle data (e.g. 10 times as big).  Use D3DLOCK_NOOVERWRITE flag instead of D3DLOCK_DISCARD as long as there is room in the buffer for the data.  Save the offset each time.  When the buffer can not hold any more data, start your offset back at 0 and use D3DLOCK_DISCARD.Using D3DLOCK_DISCARD every update should be what is causing the loss in performance.  I use the above method in my game and it works great.  It is also suggested by Microsoft as an opimization.Hope that helps.-Mike   ;  Although his speed decreases seem brutal, much worse than a DISCARD vs NOOVERWRITE thing. You haven't accidentally used the reference rasterizer? :)   ;  I think a fillrate issue would scale more to the number of particles.  The OP states that the fps drops dramatically beyond a threshold of 4000.  I think this suggests that the bus is getting clobbered by the data transfer beyond that size.  Of course, this is only a guess :)-Mike   ;Quote:Original post by MikeVittHello,Try making your VB big enough to hold several instances of the particle data (e.g. 10 times as big).  Use D3DLOCK_NOOVERWRITE flag instead of D3DLOCK_DISCARD as long as there is room in the buffer for the data.  Save the offset each time.  When the buffer can not hold any more data, start your offset back at 0 and use D3DLOCK_DISCARD.Using D3DLOCK_DISCARD every update should be what is causing the loss in performance.  I use the above method in my game and it works great.  It is also suggested by Microsoft as an opimization.Hope that helps.-Mikethanks for the suggestion.  I'll give it a try tonight   ;Quote:Original post by Anonymous PosterAlthough his speed decreases seem brutal, much worse than a DISCARD vs NOOVERWRITE thing. You haven't accidentally used the reference rasterizer? :)I'm using HW rasterizer   