Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 30 Aug 2012
Offline Last Active Jul 19 2014 08:24 AM

Posts I've Made

In Topic: Vertexbuffer - huge lag.

08 July 2014 - 04:01 PM

Yep, fixed the issue with the indices and it's sticking at pretty close to 5ms even with the dynamic vertex buffer at around 10,000 vertices.
Once again, thanks for everyone's help and patience.

In Topic: Vertexbuffer - huge lag.

08 July 2014 - 06:35 AM

gchewood, why you are creating such massive vertex buffer?

vb=new DynamicVertexBuffer(GraphicsDevice, VertexPositionNormalTexture.VertexDeclaration, vertices.Length*100, BufferUsage.WriteOnly);

I thought you said your mesh is 10,000 vertices, doesn't it mean you're creating 1,000,000 vertex buffer here? I wonder if this can cause FPS drop.

No, sorry. That's my mistake for not making it clear. The vertex buffer is around 20,000 vertices as the array 'vertices' at that point is of size 200. It's that size as that's around the maximum it will need to be.





Looks like it's time to see your create mesh function.


may be lots of duplicated vertices.


no index buffer.

Hmmmm, ok. This is a potential problem. Just checked the index buffer for when I'm up to about 10,000 vertices. The index buffer is at about 200,000.


So that seems problematic. 

Yep, the issue is with the code I'm using the create the base vertex and index arrays. They're being extracted from a .X model. I just checked, the vertices, normals and texture coordinates are all fine. But it's just creating a hideous number of indices for some reason. Right, at least I know where the issue is. I'm glad my intuition was right.

Thanks for all of the help, given my very vaguely described problem everyone. If anyone has ever extracted the index data from a model in xna before, please post with any info. Otherwise, I'm sure I'll figure it out.


In Topic: Vertexbuffer - huge lag.

07 July 2014 - 07:56 PM

Yeah, I'm gonna run through some tutorials with PIX and see if that can help me. I'm also gonna see if I can cut the polycount a bit and then try geometry instancing instead. If I'm really not making any big mistakes in my use of the vertex buffer, it just seems that's not the ideal solution to my problem.

It's that last comparison though that's still making me skeptical. My, admittedly uninformed, intuition doesn't seem to accept that a dynamic vertex buffer which is supposedly created for this very purpose, is slower than drawing each piece independently.

In Topic: Vertexbuffer - huge lag.

07 July 2014 - 06:56 PM

Lol, well everyone else's responses don't seem to match your certainty on that? 


I thought I already did show you the code used to create the vertex buffer. Again:

vb=new DynamicVertexBuffer(GraphicsDevice, VertexPositionNormalTexture.VertexDeclaration, vertices.Length*100, BufferUsage.WriteOnly);

and then to set the vertices:

vb.SetData(activeVertices, 0, activeVertices.Length, SetDataOptions.Discard);

And that performs the same no matter what I set for SetDataOptions. That's what you were asking for right? 

So why is a dynamic vertex buffer with just 1 draw call slower than doing like 20 or so from the individual models? That doesn't seem right?

In Topic: Vertexbuffer - huge lag.

07 July 2014 - 05:10 PM

If the only thing I draw is the dynamic vertex buffer, it jumps to 10ms (for the same 10,000 vertex buffer). Isn't that to be expected? There were various other things going on as well.


Yes, the models use the identical textures. They're using the same shader, which is where the sampling states are set. So the same.

If I change the shader to not use textures, the outcome is more or less the same, only slightly better performance which I guess is to be expected.

I'm completely new to using PIX so I'll certainly try that but it'll take a while to familiarise myself with it!