Skip to main content
GameDev.net gamedev.net
🔒 Locked

Tips for optimising D3D7

Started by Kylotan Oct 4, 2002 at 2:33 PM 5 replies 550+ views
Original Post
Kylotan
Kylotan
I''m writing a simple 3D program in DirectX7, and finding the performance is not too good. I am drawing about 900 polys, single texture, TNL device, at 640x480x32bpp, but only getting about 50-60 fps on my GeForce2 with a 1.1GHz processor. This seems a bit slow to me. So, if I''m right and this is slow, I was wondering if there were any basic hints for getting more performance that I don''t know about... I don''t need people to give me code, just basic rules of thumb that should be followed. I can''t profile my code as the MSVC profiler always hangs when I profile this. I have no idea why. I''m aware that lots of people must have asked this many months ago, but with the search not working, I thought I''d ask again. Links to external documents are just as welcome as real answers. [ MSVC Fixes | STL | SDL | Game AI | Sockets | C++ Faq Lite | Boost | Asking Questions | Organising code files | My stuff ]
siaspete
siaspete
I''m going to get the obvious ones out of the way first (and risk looking like a jerk)... Is vsync off? How are you drawing your primitives?

There are a couple of articles on the nvidia site about general D3D7 guidelines, here''s the page (wish NVIDIA wouldn''t keep moving things around)...

http://developer.nvidia.com/view.asp?IO=docs_performance

Hope this helps somewhat, sorry if you''ve been there already.


Helpful links:
How To Ask Questions The Smart Way | Google can help with your question | Search MSDN for help with standard C or Windows functions
JonnyQuest
JonnyQuest
- use vertex buffers (in an optimal fashion, see various nVidia docs on this)
- make sure you''re setting up your surfaces (primary/backbuffer surfaces, texture surfaces) correctly.
- are you locking anything?
- what kind of depth buffer are you using?
- are you using indexed vertices? if not, try using them, if you are, try without them
- could your clearing be a problem?
- are you flipping or blitting?
- try to profile using your own profiling code

- JQ
Full Speed Games. Period.
~phil
Kylotan
Kylotan
VSync is indeed off at the moment (and yep, you can see the tearing).

I''m using DrawPrimitive on some smaller objects (<20 triangles) and DrawPrimitiveVB on the main one (heightmapped floor). I''m looking up what the ''optimal fashion'' is while I type this. Maybe I''m sending too few and too many polys at once (some objects are small, some are more than 200 polys).

Setting up my surfaces correctly... how would I know what is correct and what is not?

There''s no locking during the main loop, just a few calculations and DrawPrimitive/DrawPrimitiveVB operations. I use no more than 6 texture changes per frame.

Depth buffer is a 16bit z-buffer.

I clear with Clear(0, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER, 0x00000044, 1.0, 0L) and Flip (rather than blit) using the while/Flip code from the SDK examples.

Thanks for your patience.

[ MSVC Fixes | STL | SDL | Game AI | Sockets | C++ Faq Lite | Boost | Asking Questions | Organising code files | My stuff ]
Fidelio_
Fidelio_
quote:
Original post by Kylotan
I''m writing a simple 3D program in DirectX7, and finding the performance is not too good. I am drawing about 900 polys, single texture, TNL device, at 640x480x32bpp, but only getting about 50-60 fps on my GeForce2 with a 1.1GHz processor. This seems a bit slow to me. So, if I''m right and this is slow, I was wondering if there were any basic hints for getting more performance that I don''t know about... I don''t need people to give me code, just basic rules of thumb that should be followed.



How do you draw exactly ? Optimally you draw large static objects in one vertex buffer, especially the ones that have the same texture. How many calls to draw(indexed)primitive do you make per frame ? put a counter on that.

And why not use DX8 or 8.1 ? After all 8.0 was released in 2000, 2 years ago.
Kylotan
Kylotan
My scene is -really- simple.

I have one object of about 800 polys - a height-mapped floor.
Then 4 objects of 2 polys - walls.
Then 6 objects of 2 polys each - the skybox.
Finally 1 object of 12 polys - a spinning cube.

6 calls to DrawPrimitive, 2 call to DrawPrimitiveVB (the floor and the cube). 1 texture per object. Everything as triangle lists. I''m guessing the bottleneck is perhaps that 800-poly floor call. Not sure how I can break that up into batches of 200 or so while still keeping the same interface to render all my objects. Perhaps I need some sort of metaobject that will render the floor a strip at a time using an index buffer.

I don''t want to use DirectX 8 because I don''t want to require users to have DirectX 8 to run my simple demo. The DirectX 8 runtimes may be free, but it''s a big download for modem users, and won''t run on some machines (some pre-MMX Pentiums, Cyrix 6x86, etc).

[ MSVC Fixes | STL | SDL | Game AI | Sockets | C++ Faq Lite | Boost | Asking Questions | Organising code files | My stuff ]
KalvinB
KalvinB
DX 8 won''t work on older hardware even if the hardware would run the same app had it used DX 7. Unless you''re doing pixel shaders bust out your 10 foot pole and beat DX 8 with it.

DX 8 is a joke unless you need all the bells and whistles. I don''t know what MS was thinking. Oh wait, yes I do "how can we force people to upgrade today?"

I switched to 8 from 7 and thought it was pretty cool until my pretty basic app ran at 30spf (literally) on my 133 craptop even though I know a far more graphics intensive project "Tombstone" runs decent on it with D3D 7. Instead of going back to DX7 I opted to go with OGL which runs well enough to be usable. My current project needs to be easily ported anyway.

Ben


IcarusIndie.com [ The Rabbit Hole | The Labyrinth | DevZone | Gang Wars | The Wall | Hosting | Dot Com | GameShot ]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.