Jump to content
  • Advertisement
Sign in to follow this  
NiGoea

1k, 10k, 100k, 1000k tris. Slow or fast? [SOLVED]

This topic is 3269 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 guys, please help me beucase this is driving me crazy :°( FPS-type engine. Problem is: I can't render many triangles because FPS tend to go extremely down. Instead of introducing the achitecture, I will report an eloquent example. I have a 20.000 triangles quake-like map. There are six materials. Since in my engine I have a DrawIndexedPrimitive for each material, in have in total 6 DIP per frame. Using the simpler shader ever (write only the color, without even sampling from any texture) I have 22 FPS, on a GeForce 6800 Ultra (it was a high end card). Now comes the funniest thing. I've tried to remove some DIP, remaining with 4 DIP each 250 triangles => 1000 triangles in total => peanuts But still having 33 FPS !!! 33 FPS for 1000 TRIS !!! with the most trivial shader possible.... To demonstrate the problem is on the DIP, if I rem the line, FPS jump to more than 700. So let's recap: 4 DIP 250 triangles each, trivial shader => 33 FPS. Without the DIP, more than 700 FPS. What could be ? This is the DIP line of code: r = m_d3ddevice->DrawIndexedPrimitive( D3DPT_TRIANGLELIST, 0, minIndex, numVertices, startIndex, trisCount); The only interesting thing I can say is that numVertices is always around 60.000 for each DIP (evidently indexes are spread trought all the VB). HELP ME :D! [Edited by - NiGoea on November 2, 2009 8:05:19 AM]

Share this post


Link to post
Share on other sites
Advertisement
numVertices is supposed to be the number of vertices you actually want to draw, not the size of your vertex buffer. So if you're drawing 250 triangles in a D3DPT_TRIANGLELIST, you want to draw 750 vertices and numVertices should be 750.

Share this post


Link to post
Share on other sites
Quote:
Original post by Codeka
numVertices is supposed to be the number of vertices you actually want to draw, not the size of your vertex buffer. So if you're drawing 250 triangles in a D3DPT_TRIANGLELIST, you want to draw 750 vertices and numVertices should be 750.


From DirectX SDK documentation:
"the number of locations within the contiguous block of vertex buffer memory required for the drawing call is called NumVertices"

that is, if your triangles need a vertex at position 10 (index=10), and a vertex at position 9010, you have at least to specify 9010-10 = 9000 vertexes.
Am I wrong ?

thanks ;)

Share this post


Link to post
Share on other sites
No, you're right. The triangle count can be much larger, depending on which indices you're using.

Are you locking the vertex buffer each frame? Perhaps you're stalling the GPU, though I'd still expect a higher frame rate than what you're seeing.

Have you enabled the debug runtimes (from the DirectX control panel app (Start/All Progams/DirectX SDK/Utilities/))? It will print warnings and errors into your VStudio output window.

Have you tried stepping through your code? Perhaps you're accidentally loading a texture or something each frame without realizing it. Or loading your shader.

Share this post


Link to post
Share on other sites
Oops, sorry, it seems you're right. I've never really used large vertex buffers and indexed randomly into it like you're doing, so I guess that explains that particularl gap in my knowledge :)

I would second the suggestion of turning up the logging in the debug runtime. If that doesn't show up anything, maybe a profiler would help?

Share this post


Link to post
Share on other sites
I agree that FPS seems low. Thing I'd try:

Verify there aren't any rogue huge triangles. That can kill performance.

Check to make sure you don't have AA override from the control panel.

Try to reduce the resolution to see if you're pixel/bandwidth bound.

Make sure in the debugger that you're supplying the correct values to the DIP call.


You can also try to use PerfHUD to find your bottleneck.

Share this post


Link to post
Share on other sites
SOLVED !!

Thank you all for your suggestions, because they anyway helped me to find other minimal errors.

The problem was a flag in CreateDevice(...).
I was using D3DCREATE_SOFTWARE_VERTEXPROCESSING instead ofD3DCREATE_HARDWARE_VERTEXPROCESSING... don't know why :)

thanks

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!