Jump to content
  • Advertisement

Archived

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

Qatal

why is vertex buffer rendering so myuch slower than UP?

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

for some reason, when i use a vertex buffer (created, optimized and then left alone from the start of the program) to render my terrain it runs about 100 times slower than the same code using DrawPrimitiveUP. has anyone else had this problem? i thought vertex buffers were supposed to be a lot faster, and they certainly were in dx7??? what am i doing wrong? thanks Chris

Share this post


Link to post
Share on other sites
Advertisement
How do you setup the buffers? What system? Without more info the question is meaningless (and yes, VBs are faster than UP )

Share this post


Link to post
Share on other sites
i am making a huge momma of a vertex buffer to hold maybe 32*32*6 vertices, then filling it by copying vertices complete from a temporary buffer, then drawing the lot (not indexed). my framerate drops to 0.5fps.

that enough detail?
let me know if its now

thanks

Qatal

Share this post


Link to post
Share on other sites
Nope, not enough detail.

Are you doing this copying once at startup, or every frame?

If you are copying at startup, make a static buffer, and use the writeonly flag. This is the fastest most optimal way to use a vertex buffer. Combine with vertex shaders to get the fastest possible vertex animation.

If you are copying per frame, make a dynamic buffer and use the write only flag. Learn what the DISCARD and NOOVERWRITE flags do. If you draw many meshes per frame, ensure your VB is large enough to hold 2 or 3 at a time. This is comparable to what Draw[Indexed]PrimitiveUP does. If you misuse the flags, you will see a drop in frame rate. If you use the flags correctly, you will see a slight gain in frame rate over the DIPUP() call.

The frame rates you''re seeing suggest you are locking per frame with a static buffer which is probably the worst thing you can do.

Check out nVidia''s developer section. Every year they post their slides from GDC. They cover things that kill framerate, things that help frame rate, and things that are generally useful.

Share this post


Link to post
Share on other sites
There may be something in the way you''re creating the VB (the pool/usage) - a brief snippet of your CreateVertexBuffer(), DrawPrimitive(), and DrawPrimitiveUP() calls would be helpful. It could also be that the way you''re creating the VB doesn''t play nice with your d3d initialization.

Share this post


Link to post
Share on other sites
i am using D3DUSAGE_WRITEONLY and D3DPOOL_DEFAULT in CreateVertexBuffer.

yes, the buffer is made once, and it is a static buffer

Share this post


Link to post
Share on other sites
Something else must be different, or wrong then. When using DIPUP() the data is transferred to the card each time you draw. With the static buffer the data is transferred to the card once, and stored on the card. There is no way it''s slower since it saves all the AGP data transfer time... which is the whole point of using vertex buffers.

I''m not sure what could be wrong. Are you sure nothing else changed between benchmarks? Both were done in the same mode (Release vs debug)? Both done with the same release of the SDK? Both done with the same SDK runtime (retail vs. debug)?

Share this post


Link to post
Share on other sites
Rule #1 about coding club is don''t talk about coding club.

Rule #2 about coding club is that if your code has problems, 99.999% of the time its your fault.

Share this post


Link to post
Share on other sites
And I''ve hit that .001% a couple times, let me tell you... *shiver* Anyway, you want to make sure the vertex buffer is:
a) playing nicely with any other memory you''re using (because it''s on the video card, which is VERY limited)
b) check and make sure you''re vertex declarations are on 4-byte boundaries. This should provide SOME speed increase
c) what have you changed when you ported your code from DrawUP and DrawBuffer? (EXACT code would be nice...)
d) part of the speedup of vertex buffers is when using indicing, DirectX can cache the vertices when it knows they''ll show up again (DrawIndexedUP doesn''t have AS GREAT an advantage from this because memory isn''t already allocated on the card... or something like that, read it somewhere...)
Provide some code, some C++, some funky stuff, and maybe we''ll be able to help a bit more...

Chris Pergrossi
My Realm | "Good Morning, Dave"

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!